blob: 0c44f9e533eaec63877b340a0992633da8f4d553 [file] [log] [blame]
<!DOCTYPE html>
<title>Service Worker: UseCounter for page controlled-on-load</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<script src="resources/usecounter.js"></script>
<script>
promise_test(function(t) {
var url = 'resources/empty-worker.js';
var scope = 'resources/blank.html?on-load';
return service_worker_unregister_and_register(t, url, scope)
.then(function(registration) {
add_completion_callback(function() { registration.unregister(); });
return wait_for_state(t, registration.installing, 'activated');
})
.then(function() { return with_iframe(scope) })
.then(function(frame) {
add_completion_callback(function() { frame.remove(); });
var w = frame.contentWindow;
var controller = w.navigator.serviceWorker.controller;
assert_true(controller instanceof w.ServiceWorker);
assert_true(isUseCounted(frame), 'should be counted as controlled');
});
}, 'usecounter is counted for a controlled document');
</script>
</html>