Bug 1171285 - Part 2: Fix test_app_protocol.html to finish both index.html and controlled.html tests; r=jdm
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 03 Jun 2015 20:51:09 -0400
changeset 247150 d1f7a6e2653dfd838f7fce560ac4ed16561fd1d8
parent 247149 7a4371bbe6382e017b8b9b0dffb7bc85b5c0bd0d
child 247151 7d0d8d304cd871f657effcc2d21d4eae5155fd1b
push id28855
push userkwierso@gmail.com
push dateFri, 05 Jun 2015 01:19:30 +0000
treeherdermozilla-central@227d356ac030 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1171285
milestone41.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1171285 - Part 2: Fix test_app_protocol.html to finish both index.html and controlled.html tests; r=jdm
dom/workers/test/serviceworkers/app-protocol/application.zip
dom/workers/test/serviceworkers/app-protocol/index.html
dom/workers/test/serviceworkers/test_app_protocol.html
index 8fd09d1ca5442387b4f5a30c48c1f21876d60eba..72f6c9f9b3ce414d1a9be8d7449b5fb5942a1e20
GIT binary patch
literal 2486
zc$|e*2UL?;8vRWO#Sq0v+tA`l6{LtL=wKmBfG7~72t<RD@IxpmkmLYE6=^Pt1Y`h5
z0uEgmr3gb&222Qo4kKMb5ky&aBV}kZfJ}g$ky$MNIq&@Mo%7Cp_uTt^-^Cw+O2`8M
zAPvap@v(PCrE5_e0H8~}HUp{vg+XTrF#P;L4?`-O=I3-m27t!%7*1wc3@1(y9M~W+
zExx$|5XQCl<r~Y!j?F3bwX|q$Gp;?H+3>iT1Ih~>8aZ7;l8?%h7Tvt1u$iN-M*S^T
z-%hpO5-@mf8oe6DUdjvZex^Ki;6V0kik#K0h4^=<Oey!BeuzfTzQZJ=w@r&XZxJlZ
z9Foh`Ra;``9vvH1^9@ezh%hEGJocj6192gm7kcz_mflR+Bp~1s|45bR{y0NcEULc7
zJ#A~o32yE)=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ers/app-protocol/index.html
@@ -2,30 +2,29 @@
 <html>
   <head>
     <title>Test app for bug 1161684</title>
     <script src='test.js'></script>
     <script type='application/javascript;version=1.7'>
 function registerServiceWorker() {
   return new Promise((resolve, reject) => {
     navigator.serviceWorker.ready.then(() => {
-      ready();
       resolve();
     });
     navigator.serviceWorker.register('sw.js', {scope: '.'})
     .then(registration => {
       ok(true, 'service worker registered');
     })
     .catch(reject);
   });
 }
 
 function runTests() {
   return Promise.resolve()
     .then(() => { return testFetchAppResource('networkresponse'); })
     .then(registerServiceWorker)
-    .then(done);
+    .then(ready);
 }
   </script>
   </head>
   <body onload='runTests()'>
   </body>
 </html>
--- a/dom/workers/test/serviceworkers/test_app_protocol.html
+++ b/dom/workers/test/serviceworkers/test_app_protocol.html
@@ -17,17 +17,16 @@
 
 SimpleTest.waitForExplicitFinish();
 
 const appManifestURL =
   'http://mochi.test:8888/tests/dom/workers/test/serviceworkers/app-protocol/update.webapp';
 let gApp;
 
 function setup() {
-  info('Setting up');
   return new Promise((resolve, reject) => {
     SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.pushPrefEnv({'set': [
       ['dom.mozBrowserFramesEnabled', true],
       ['dom.serviceWorkers.exemptFromPerDomainMax', true],
       ['dom.serviceWorkers.enabled', true],
       ['dom.serviceWorkers.testing.enabled', true]
     ]}, () => {
@@ -70,54 +69,59 @@ function launchApp() {
     return Promise.reject();
   }
   return new Promise((resolve, reject) => {
     let iframe = document.createElement('iframe');
     iframe.setAttribute('mozbrowser', 'true');
     iframe.setAttribute('mozapp', gApp.manifestURL);
     iframe.addEventListener('mozbrowsershowmodalprompt', function listener(e) {
       let message = e.detail.message;
-      if (/READY/.exec(message)) {
+      if (/OK/.exec(message)) {
+        ok(true, "Message from app: " + message);
+      } else if (/KO/.exec(message)) {
+        ok(false, "Message from app: " + message);
+      } else if (/READY/.exec(message)) {
         ok(true, "Message from app: " + message);
         resolve();
+      } else {
+        ok(false, "Unexpected message received: " + message);
       }
     }, false);
     let domParent = document.getElementById('container');
     domParent.appendChild(iframe);
     SpecialPowers.wrap(iframe.contentWindow).location =
       gApp.origin + gApp.manifest.launch_path;
   });
 }
 
 function loadControlled() {
-  info("reloading");
   return new Promise((resolve, reject) => {
     let iframe = document.createElement('iframe');
     iframe.setAttribute('mozbrowser', 'true');
     iframe.setAttribute('mozapp', gApp.manifestURL);
     iframe.addEventListener('mozbrowsershowmodalprompt', function listener(e) {
       let message = e.detail.message;
-      info(message);
       if (/OK/.exec(message)) {
         ok(true, "Message from app: " + message);
       } else if (/KO/.exec(message)) {
         ok(false, "Message from app: " + message);
       } else if (/DONE/.exec(message)) {
         ok(true, "Messaging from app complete");
         iframe.removeEventListener('mozbrowsershowmodalprompt', listener);
         let domParent = document.getElementById('container');
         domParent.removeChild(iframe);
         resolve();
+      } else {
+        ok(false, "Unexpected message received: " + message);
       }
       }, false);
     let domParent = document.getElementById('container');
     domParent.appendChild(iframe);
     SpecialPowers.wrap(iframe.contentWindow).location =
       gApp.origin + '/controlled.html';
-    info("reloaded");
   });
 }
 
 function uninstallApp() {
   return new Promise((resolve, reject) => {
     if (!gApp) {
       return reject();
     }