Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / serviceworker / registration-end-to-end.html
index 877bd26..4845afb 100644 (file)
@@ -7,7 +7,7 @@
 var t = async_test('Registration: end-to-end');
 t.step(function() {
 
-    var scope = '/in-scope/';
+    var scope = 'resources/in-scope/';
     var serviceWorkerStates = [];
     var lastServiceWorkerState = '';
     var receivedMessageFromPort = '';
@@ -15,7 +15,7 @@ t.step(function() {
 
     assert_true(navigator.serviceWorker instanceof ServiceWorkerContainer);
     assert_equals(typeof navigator.serviceWorker.register, 'function');
-    assert_equals(typeof navigator.serviceWorker.unregister, 'function');
+    assert_equals(typeof navigator.serviceWorker.getRegistration, 'function');
 
     navigator.serviceWorker.oncurrentchange = function() {
         ++currentChangeCount;
@@ -23,9 +23,6 @@ t.step(function() {
 
     service_worker_unregister_and_register(
         t, 'resources/end-to-end-worker.js', scope)
-      .then(function(registration) {
-          return wait_for_update(t, registration);
-        })
       .then(onRegister)
       .catch(unreached_rejection(t));
 
@@ -35,7 +32,8 @@ t.step(function() {
         return messageChannel.port1;
     }
 
-    function onRegister(sw) {
+    function onRegister(registration) {
+        var sw = registration.installing;
         serviceWorkerStates.push(sw.state);
         lastServiceWorkerState = sw.state;
 
@@ -51,9 +49,6 @@ t.step(function() {
                 serviceWorkerStates.push(sw.state);
 
                 switch (sw.state) {
-                case 'installing':
-                    assert_equals(lastServiceWorkerState, 'parsed');
-                    break;
                 case 'installed':
                     assert_equals(lastServiceWorkerState, 'installing');
                     break;
@@ -77,7 +72,7 @@ t.step(function() {
 
         Promise.all([sawMessage, sawActive]).then(t.step_func(function() {
             assert_array_equals(serviceWorkerStates,
-                                ['parsed', 'installing', 'installed', 'activating', 'activated'],
+                                ['installing', 'installed', 'activating', 'activated'],
                                 'Service worker should pass through all states');
 
             assert_equals(currentChangeCount, 0,
@@ -91,7 +86,7 @@ t.step(function() {
                     resolve();
                 });
             }));
-            navigator.serviceWorker.unregister(scope);
+            registration.unregister();
             sawRedundant.then(t.step_func(function() {
                 t.done();
             }));