Bug 1339885 Uncomment test cases from WPT test and move to separate case that can be marked expected fail. r=bz
authorBen Kelly <ben@wanderview.com>
Wed, 15 Feb 2017 15:12:37 -0500
changeset 343125 6296e675694a4b256dc54f3be1a6c2b182203323
parent 343124 f45e73d6c9ff8c902f8b989cb89463fe284fc315
child 343126 09a2cd12ac20c702b12e932e15fb87607ab02d2d
child 343185 68b195e78af058066e43991485085482c1af802c
push id31369
push userkwierso@gmail.com
push dateThu, 16 Feb 2017 00:18:40 +0000
treeherdermozilla-central@e9b926463f9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1339885
milestone54.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 1339885 Uncomment test cases from WPT test and move to separate case that can be marked expected fail. r=bz
testing/web-platform/meta/service-workers/service-worker/clients-matchall-client-types.https.html.ini
testing/web-platform/tests/service-workers/service-worker/clients-matchall-client-types.https.html
testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/service-workers/service-worker/clients-matchall-client-types.https.html.ini
@@ -0,0 +1,5 @@
+[clients-matchall-client-types.https.html]
+  type: testharness
+  [Verify matchAll() with window and sharedworker client types]
+    expected: FAIL
+
--- a/testing/web-platform/tests/service-workers/service-worker/clients-matchall-client-types.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/clients-matchall-client-types.https.html
@@ -4,37 +4,37 @@
 <script src="/resources/testharnessreport.js"></script>
 <script src="resources/test-helpers.sub.js"></script>
 <script>
 var scope = 'resources/clients-matchall-client-types';
 var iframe_url = scope + '-iframe.html';
 var shared_worker_url = scope + '-shared-worker.js';
 
 /* visibilityState, focused, url, frameType */
-var expected_without_type = [
+var expected_only_window = [
     ['visible', true, new URL(iframe_url, location).href, 'window', 'nested']
 ];
-var expected_with_window = [
-    ['visible', true, new URL(iframe_url, location).href, 'window', 'nested']
-];
-var expected_with_shared_worker = [
+var expected_only_shared_worker = [
     [,,new URL(shared_worker_url, location).href, 'sharedworker', 'none']
 ];
-var expected_with_all = [
+var expected_window_and_shared_worker = [
     ['visible', true, new URL(iframe_url, location).href, 'window', 'nested'],
     [,,new URL(shared_worker_url, location).href, 'sharedworker', 'none']
 ];
 
 function test_matchall(frame, expected, query_options) {
   // Make sure the frame gets focus.
   frame.focus();
   expected.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
   return new Promise(function(resolve, reject) {
     var channel = new MessageChannel();
     channel.port1.onmessage = function(e) {
+      if (typeof e.data === 'string') {
+        return reject(e.data);
+      }
       assert_equals(e.data.length, expected.length);
       for (var i = 0; i < e.data.length; i++)
         assert_array_equals(e.data[i], expected[i]);
       resolve();
     };
     frame.contentWindow.navigator.serviceWorker.controller.postMessage(
         {port:channel.port2, options:query_options},
         [channel.port2]);
@@ -46,33 +46,55 @@ promise_test(function(t) {
     return service_worker_unregister_and_register(
         t, 'resources/clients-matchall-worker.js', scope)
       .then(function(registration) {
           return wait_for_state(t, registration.installing, 'activated');
         })
       .then(function() { return with_iframe(iframe_url); })
       .then(function(f) {
           frame = f;
+          return test_matchall(frame, expected_only_window, {});
+        })
+      .then(function() {
+          return test_matchall(frame, expected_only_window, {type:'window'});
+        })
+      .then(function() {
+          frame.remove();
+          return service_worker_unregister_and_done(t, scope);
+        })
+      .catch(unreached_rejection(t));
+  }, 'Verify matchAll() with window client type');
+
+promise_test(function(t) {
+    var frame;
+    return service_worker_unregister_and_register(
+        t, 'resources/clients-matchall-worker.js', scope)
+      .then(function(registration) {
+          return wait_for_state(t, registration.installing, 'activated');
+        })
+      .then(function() { return with_iframe(iframe_url); })
+      .then(function(f) {
+          frame = f;
           return new Promise(function(resolve, reject) {
               var w = new SharedWorker(shared_worker_url);
               w.port.onmessage = resolve;
             });
         })
       .then(function() {
-          return test_matchall(frame, expected_without_type, {});
+          return test_matchall(frame, expected_only_window, {});
+        })
+      .then(function() {
+          return test_matchall(frame, expected_only_window, {type:'window'});
         })
       .then(function() {
-          return test_matchall(frame, expected_with_window, {type:'window'});
+          return test_matchall(frame, expected_only_shared_worker,
+                               {type:'sharedworker'});
         })
-      //.then(function() {
-      //    return test_matchall(frame, expected_with_shared_worker,
-      //                         {type:'sharedworker'});
-      //  })
-      //.then(function() {
-      //    return test_matchall(frame, expected_with_all, {type:'all'});
-      //  })
+      .then(function() {
+          return test_matchall(frame, expected_window_and_shared_worker, {type:'all'});
+        })
       .then(function() {
           frame.remove();
           return service_worker_unregister_and_done(t, scope);
         });
-  }, 'Verify matchAll() with various client types');
+  }, 'Verify matchAll() with window and sharedworker client types');
 
 </script>
--- a/testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js
+++ b/testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js
@@ -16,10 +16,13 @@ self.onmessage = function(e) {
                         client.focused,
                         client.url,
                         client.type,
                         frame_type]);
         });
       // Sort by url
       message.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; });
       port.postMessage(message);
-    });
+    })
+  .catch(e => {
+      port.postMessage('clients.matchAll() rejected: ' + e);
+    })
 };