blob: c4db6eafe0e31daaf2b965bbe90a31431b6643bd [file] [log] [blame]
(async function(testRunner) {
const {page, session, dp} = await testRunner.startBlank(
`Tests basic function of the BackgroundService domain.`);
// Enable non-existant service.
let result = await dp.BackgroundService.startObserving({service: 'fakeservice'});
testRunner.log(`Found error: ${result.error.message}`);
// Enable actual service.
result = await dp.BackgroundService.startObserving({service: 'backgroundFetch'});
testRunner.log(`Enabled successfully: ${!result.error}`);
// Enabling a Service should return the recording state.
dp.BackgroundService.startObserving({service: 'backgroundSync'});
result = await dp.BackgroundService.onceRecordingStateChanged();
testRunner.log(result.params);
// Enable recording.
dp.BackgroundService.setRecording({shouldRecord: true, service: 'backgroundSync'});
result = await dp.BackgroundService.onceRecordingStateChanged();
testRunner.log(result.params);
// Disable recording.
dp.BackgroundService.setRecording({shouldRecord: false, service: 'backgroundSync'});
result = await dp.BackgroundService.onceRecordingStateChanged();
testRunner.log(result.params);
testRunner.completeTest();
});