Bug 1485060 [wpt PR 12598] - [Shadow DOM] Fix test using assert_array_equals, a=testonly
authorPierre-Marie Dartus <dartus.pierremarie@gmail.com>
Tue, 11 Sep 2018 10:00:06 +0000
changeset 436002 3f6470c8ab4782ef9e384bc16dbe032cea19a200
parent 436001 c2ff4ef0946b09717162a824fdea1a1d1fd8b635
child 436003 1e57e2191f0dd0e922ea68b0b8a41e976d7a2974
push id34625
push userdvarga@mozilla.com
push dateThu, 13 Sep 2018 02:31:40 +0000
treeherdermozilla-central@51e9e9660b3e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1485060, 12598
milestone64.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 1485060 [wpt PR 12598] - [Shadow DOM] Fix test using assert_array_equals, a=testonly Automatic update from web-platform-tests[Shadow DOM] Fix test using assert_array_equals (#12598) Fix occurrences of assert_array_equals where it is used to compare the array length instead of the array itself. https://wpt.fyi/results/shadow-dom/leaktests/get-elements.html?sha=0398567bac https://wpt.fyi/results/shadow-dom/Extensions-to-Event-Interface.html?sha=0398567bac -- wpt-commits: 334fe760e46f7bf64c3a514b0fd6f5ef84da52f5 wpt-pr: 12598
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/shadow-dom/Extensions-to-Event-Interface.html
testing/web-platform/tests/shadow-dom/leaktests/get-elements.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -641492,17 +641492,17 @@
    "fbf20e81ac488bf9a27766fb6f8bb69e5250dc28",
    "testharness"
   ],
   "shadow-dom/Element-interface-shadowRoot-attribute.html": [
    "02d8050997cfaa0b6b1668c9b350a2ae526bccdd",
    "testharness"
   ],
   "shadow-dom/Extensions-to-Event-Interface.html": [
-   "52cda0b6bb863cf5f09d9752874165656bfc3fe3",
+   "806d539cad45d55d635ee55637be2c8b5c014b55",
    "testharness"
   ],
   "shadow-dom/HTMLSlotElement-interface.html": [
    "4327e5d03e0356b94514d41f9994a5aa0e982bd0",
    "testharness"
   ],
   "shadow-dom/META.yml": [
    "8fb0a9b995d6289bb28582fa01e6bb092afa5dda",
@@ -641588,17 +641588,17 @@
    "dfcac99da023ec2bbd94835f71efaef952a62341",
    "reftest"
   ],
   "shadow-dom/layout-slot-no-longer-fallback.html": [
    "7507f11ac18e6590367a147acbc78834b0d19afd",
    "reftest"
   ],
   "shadow-dom/leaktests/get-elements.html": [
-   "2ce916a650ed3749e18b6fd1abe488a562b0faaf",
+   "40fa9b69314a9cd9f1eee777ce4120440d7801df",
    "testharness"
   ],
   "shadow-dom/leaktests/html-collection.html": [
    "d156569714636d2bc713390748bfcf560a8d0dbe",
    "testharness"
   ],
   "shadow-dom/leaktests/window-frames.html": [
    "5ba2531ff26a27f6309bce11d488d2ff77f563f3",
--- a/testing/web-platform/tests/shadow-dom/Extensions-to-Event-Interface.html
+++ b/testing/web-platform/tests/shadow-dom/Extensions-to-Event-Interface.html
@@ -49,17 +49,17 @@ A (4) --------------------------- A-SR (
 
 function testComposedEvent(mode) {
     test(function () {
         var nodes = createFixedTestTree(mode);
         var log = dispatchEventWithEventLog(nodes, nodes.A1a, new Event('my-event', {composed: true, bubbles: true}));
 
         var expectedPath = ['A1a', 'A1-SR', 'A1', 'A-SR', 'A'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : ['A1', 'A-SR', 'A'],
             'composedPath must only contain unclosed nodes of the current target.');
     }, 'The event must propagate out of ' + mode + ' mode shadow boundaries when the composed flag is set');
 }
 
 testComposedEvent('open');
@@ -77,17 +77,17 @@ A ------------------------------- A-SR
 
 function testNonComposedEvent(mode) {
     test(function () {
         var nodes = createFixedTestTree(mode);
         var log = dispatchEventWithEventLog(nodes, nodes.A1a, new Event('my-event', {composed: false, bubbles: true}));
 
         var expectedPath = ['A1a', 'A1-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
     }, 'The event must not propagate out of ' + mode + ' mode shadow boundaries when the composed flag is unset');
 }
 
 testNonComposedEvent('open');
 testNonComposedEvent('closed');
 
@@ -103,17 +103,17 @@ A ------------------------------- A-SR
 
 function testNonComposedEventWithRelatedTarget(mode) {
     test(function () {
         var nodes = createFixedTestTree(mode);
         var log = dispatchEventWithEventLog(nodes, nodes.A1a, new MouseEvent('foo', {composed: false, bubbles: true, relatedTarget: nodes['A2-S']}));
 
         var expectedPath = ['A1a', 'A1-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.relatedTargets, ['A2-S', 'A2-S']);
     }, 'The event must not propagate out of ' + mode + ' mode shadow boundaries when the composed flag is unset on an event with relatedTarget');
 }
 
 testNonComposedEventWithRelatedTarget('open');
 testNonComposedEventWithRelatedTarget('closed');
@@ -131,17 +131,17 @@ A --------------------------------------
 function testScopedEventWithUnscopedRelatedTargetThroughSlot(mode) {
     test(function () {
         var nodes = createFixedTestTree(mode);
         var log = dispatchEventWithEventLog(nodes, nodes.B1a, new MouseEvent('foo', {scoped: true, relatedTargetScoped: false, bubbles: true, relatedTarget: nodes['B1b2']}));
 
         var expectedPath = ['B1a', 'B1c-S', 'B1-SR', 'B1', 'B-SR'];
         var pathExposedToB1a = ['B1a', 'B1', 'B-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.pathAtTargets[2], expectedPath);
         assert_array_equals(log.pathAtTargets[3], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.pathAtTargets[4], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.relatedTargets, ['B1', 'B1b', 'B1b', 'B1', 'B1']);
     }, 'The event must not propagate out of ' + mode + ' mode shadow tree of the target but must propagate out of inner shadow trees when the scoped flag is set');
 }
@@ -162,17 +162,17 @@ A ------------------------------- A-SR (
 function testComposedEventWithRelatedTarget(mode) {
     test(function () {
         var nodes = createFixedTestTree(mode);
         log = dispatchEventWithEventLog(nodes, nodes.A1a, new MouseEvent('foo', {composed: true, bubbles: true, relatedTarget: nodes['A2-S']}));
 
         var expectedPath = ['A1a', 'A1-SR', 'A1', 'A-SR'];
         var pathExposedToA1 = ['A1', 'A-SR'];
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], expectedPath);
         assert_array_equals(log.pathAtTargets[1], expectedPath);
         assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : pathExposedToA1);
         assert_array_equals(log.pathAtTargets[3], mode == 'open' ? expectedPath : pathExposedToA1);
         assert_array_equals(log.relatedTargets, ['A2-S', 'A2-S', 'A2-S', 'A2-S']);
     }, 'The event must propagate out of ' + mode + ' mode shadow tree in which the relative target and the relative related target are the same');
 }
 
@@ -197,17 +197,17 @@ function testComposedEventThroughSlot(mo
         var expectedPath =          ['B1a', 'B1c-S', 'B1-SR', 'B1', 'B-SR', 'B', 'A2-S', 'A-SR', 'A'];
         var expectedRelatedTarget = ['A',   'A',     'A',     'A',   'A',   'A', 'A1',   'A1',   'A'];
         var pathExposedToB1a =      ['B1a',                   'B1', 'B-SR', 'B',                 'A'];
         var pathExposedToB1cS =     ['B1a', 'B1c-S', 'B1-SR', 'B1', 'B-SR', 'B',                 'A'];
         var pathExposedToB =        [                                       'B',                 'A'];
         var pathExposedToA1 =       [                                       'B', 'A2-S', 'A-SR', 'A'];
 
         assert_array_equals(log.eventPath, expectedPath);
-        assert_array_equals(log.eventPath.length, log.pathAtTargets.length);
+        assert_equals(log.eventPath.length, log.pathAtTargets.length);
         assert_array_equals(log.pathAtTargets[0], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.pathAtTargets[1], mode == 'open' ? expectedPath : pathExposedToB1cS);
         assert_array_equals(log.pathAtTargets[2], mode == 'open' ? expectedPath : pathExposedToB1cS);
         assert_array_equals(log.pathAtTargets[3], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.pathAtTargets[4], mode == 'open' ? expectedPath : pathExposedToB1a);
         assert_array_equals(log.pathAtTargets[5], mode == 'open' ? expectedPath : pathExposedToB);
         assert_array_equals(log.pathAtTargets[6], mode == 'open' ? expectedPath : pathExposedToA1);
         assert_array_equals(log.pathAtTargets[7], mode == 'open' ? expectedPath : pathExposedToA1);
--- a/testing/web-platform/tests/shadow-dom/leaktests/get-elements.html
+++ b/testing/web-platform/tests/shadow-dom/leaktests/get-elements.html
@@ -80,63 +80,63 @@ test(function() {
     assert_equals(document.getElementsByClassName('bar')[0].getAttribute('label'), 'doc-div');
     assert_equals(document.getElementsByClassName('bar').length, 1);
     assert_equals(document.getElementsByClassName('bar')[0].getAttribute('label'), 'doc-div');
     assert_equals(document.querySelectorAll('.bar').length, 1);
 
     assert_equals(doc.querySelectorAll('.bar').length, 1);
     assert_equals(doc.getElementsByClassName('bar')[0].getAttribute('label'), 'doc-div');
 
-    assert_array_equals(hostOpen.querySelectorAll('.bar').length, 0);
+    assert_equals(hostOpen.querySelectorAll('.bar').length, 0);
 
     assert_equals(shadowOpen.querySelectorAll('.bar').length, 1);
     assert_equals(shadowOpen.querySelectorAll('.bar')[0].getAttribute('label'), 'shadow-open-div');
 
-    assert_array_equals(hostClosed.querySelectorAll('.bar').length, 0);
+    assert_equals(hostClosed.querySelectorAll('.bar').length, 0);
 
     assert_equals(shadowClosed.querySelectorAll('.bar').length, 1);
     assert_equals(shadowClosed.querySelectorAll('.bar')[0].getAttribute('label'), 'shadow-closed-div');
 }, 'getElementsByClassName() should not leak nodes in shadow tree');
 
 test(function() {
     // getElementsByName (Document)
     assert_equals(document.getElementsByName('baz').length, 1);
     assert_equals(document.getElementsByName('baz')[0].getAttribute('label'), 'doc-form');
     assert_equals(document.getElementsByName('baz').length, 1);
     assert_equals(document.getElementsByName('baz')[0].getAttribute('label'), 'doc-form');
     assert_equals(document.querySelectorAll('[name=baz]').length, 1);
 
     assert_equals(doc.querySelectorAll('[name=baz]').length, 1);
 
-    assert_array_equals(hostOpen.querySelectorAll('[name=baz]').length, 0);
+    assert_equals(hostOpen.querySelectorAll('[name=baz]').length, 0);
     assert_equals(shadowOpen.querySelectorAll('[name=baz]').length, 1);
     assert_equals(shadowOpen.querySelectorAll('[name=baz]')[0].getAttribute('label'), 'shadow-open-form');
 
-    assert_array_equals(hostClosed.querySelectorAll('[name=baz]').length, 0);
+    assert_equals(hostClosed.querySelectorAll('[name=baz]').length, 0);
     assert_equals(shadowClosed.querySelectorAll('[name=baz]').length, 1);
     assert_equals(shadowClosed.querySelectorAll('[name=baz]')[0].getAttribute('label'), 'shadow-closed-form');
 }, 'getElementsByName() should not leak nodes in shadow tree');
 
 test(function() {
     // getElementsByTagName (Element, Document)
     assert_equals(document.getElementsByTagName('my-element').length, 1);
     assert_equals(document.getElementsByTagName('my-element')[0].getAttribute('label'), 'doc-my-element');
     assert_equals(document.getElementsByTagName('my-element').length, 1);
     assert_equals(document.getElementsByTagName('my-element')[0].getAttribute('label'), 'doc-my-element');
     assert_equals(document.querySelectorAll('my-element').length, 1);
 
     assert_equals(doc.querySelectorAll('my-element').length, 1);
     assert_equals(doc.getElementsByTagName('my-element')[0].getAttribute('label'), 'doc-my-element');
 
-    assert_array_equals(hostOpen.querySelectorAll('my-element').length, 0);
+    assert_equals(hostOpen.querySelectorAll('my-element').length, 0);
     // ShadowRoot isn't an Element, does not have getElementsByTagName().
     assert_equals(shadowOpen.querySelectorAll('my-element').length, 1);
     assert_equals(shadowOpen.querySelectorAll('my-element')[0].getAttribute('label'), 'shadow-open-my-element');
 
-    assert_array_equals(hostClosed.querySelectorAll('my-element').length, 0);
+    assert_equals(hostClosed.querySelectorAll('my-element').length, 0);
     assert_equals(shadowClosed.querySelectorAll('my-element').length, 1);
     assert_equals(shadowClosed.querySelectorAll('my-element')[0].getAttribute('label'), 'shadow-closed-my-element');
 }, 'getElementsByTagName() should not leak nodes in shadow tree');
 
 test(function() {
     // getElementsByTagNameNS (Element, Document)
     assert_equals(document.getElementsByTagName('lineargradient').length, 0);
     assert_equals(document.getElementsByTagNameNS('*', 'lineargradient').length, 0);