Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: LayoutTests/http/tests/serviceworker/indexeddb.html

Issue 468753003: SW tests update (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 467133002 and fix test Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/serviceworker/indexeddb.html
diff --git a/LayoutTests/http/tests/serviceworker/indexeddb.html b/LayoutTests/http/tests/serviceworker/indexeddb.html
index 50aacaf9a31aadc38e8ccf1add7be2749faf484e..718f814687775569923dadd03d9e1c43bbfecb00 100644
--- a/LayoutTests/http/tests/serviceworker/indexeddb.html
+++ b/LayoutTests/http/tests/serviceworker/indexeddb.html
@@ -4,32 +4,34 @@
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<script>
-var test = async_test('Verify Indexed DB operation in a Service Worker');
-test.step(function() {
+async_test(function(t) {
var scope = 'resources/blank.html';
service_worker_unregister_and_register(
- test, 'resources/indexeddb-worker.js', scope).then(test.step_func(onRegister));
-
- function onRegister(worker) {
+ t, 'resources/indexeddb-worker.js', scope)
+ .then(function(registration) {
+ return wait_for_update(t, registration);
+ })
+ .then(function(sw) {
var messageChannel = new MessageChannel();
- messageChannel.port1.onmessage = test.step_func(onMessage);
-
- worker.postMessage({port: messageChannel.port2}, [messageChannel.port2]);
- }
-
+ messageChannel.port1.onmessage = t.step_func(onMessage);
+ sw.postMessage({port: messageChannel.port2}, [messageChannel.port2]);
+ })
+ .catch(unreached_rejection(t));
+
function onMessage() {
- var openRequest = indexedDB.open('db');
- openRequest.onsuccess = test.step_func(function() {
- var db = openRequest.result;
- var tx = db.transaction('store');
- var store = tx.objectStore('store');
- var getRequest = store.get('key');
- getRequest.onsuccess = test.step_func(function() {
- assert_equals(getRequest.result, 'value',
- 'The get() result should match what the worker put().');
- service_worker_unregister_and_done(test, scope);
+ var openRequest = indexedDB.open('db');
+ openRequest.onsuccess = t.step_func(function() {
+ var db = openRequest.result;
+ var tx = db.transaction('store');
+ var store = tx.objectStore('store');
+ var getRequest = store.get('key');
+ getRequest.onsuccess = t.step_func(function() {
+ assert_equals(
+ getRequest.result, 'value',
+ 'The get() result should match what the worker put().');
+ service_worker_unregister_and_done(t, scope);
});
});
}
-});
+ }, 'Verify Indexed DB operation in a Service Worker');
</script>

Powered by Google App Engine
This is Rietveld 408576698