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> |