Bug 1263469 P3 Test FetchEvent.request.cache value on reload in wpt test. r=ehsan
authorBen Kelly <ben@wanderview.com>
Fri, 15 Apr 2016 11:15:58 -0700
changeset 331379 afd29752788807ef5cb8917ba033eb7f00631039
parent 331378 a908bea60e6764b675a750b41bd6551af2eeaf69
child 331380 a8392b3322a93d68b123be2d10e7727e3ba8298a
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1263469
milestone48.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 1263469 P3 Test FetchEvent.request.cache value on reload in wpt test. r=ehsan
testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html
--- a/testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/fetch-event.https.html
@@ -435,30 +435,46 @@ async_test(function(t) {
     ];
     service_worker_unregister_and_register(t, worker, scope)
       .then(function(reg) {
           return wait_for_state(t, reg.installing, 'activated');
         })
       .then(function() { return with_iframe(scope); })
       .then(function(f) {
           frame = f;
+          assert_equals(frame.contentWindow.document.body.textContent, 'default');
           var tests = cacheTypes.map(function(type) {
-            return new Promise(function(resolve) {
+            return new Promise(function(resolve, reject) {
                 return frame.contentWindow.fetch(scope + '=' + type,
                                                  {cache: type})
                   .then(function(response) { return response.text(); })
                   .then(function(response_text) {
                       var expected = (type === undefined) ? 'default' : type;
                       assert_equals(response_text, expected,
                                     'Service Worker should respond to fetch with the correct type');
                     })
-                  .then(resolve);
+                  .then(resolve)
+                  .catch(reject);
               });
           });
-          return Promise.all(tests);
+        })
+      .then(function() {
+          return new Promise(function(resolve, reject) {
+            frame.addEventListener('load', function onLoad() {
+              frame.removeEventListener('load', onLoad);
+              try {
+                assert_equals(frame.contentWindow.document.body.textContent,
+                              'no-cache');
+                resolve();
+              } catch (e) {
+                reject(e);
+              }
+            });
+            frame.contentWindow.location.reload();
+          });
         })
       .then(function() {
           frame.remove();
           return service_worker_unregister_and_done(t, scope);
         })
       .catch(unreached_rejection(t));
   }, 'Service Worker responds to fetch event with the correct cache types');