Bug 1456661 [wpt PR 10619] - [wptrunner] Add regression tests for server config, a=testonly
authorMike Pennisi <mike@mikepennisi.com>
Tue, 01 May 2018 14:43:07 +0000
changeset 472656 bc7e5fabfddb5d914c8e8d710c7fe31ef6520b4a
parent 472655 d1ff4bc3361ae747e647cc1552b9df2071d0e6a1
child 472657 a8cc92a826094e75978745ee4d439209957a92f7
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1456661, 10619
milestone61.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 1456661 [wpt PR 10619] - [wptrunner] Add regression tests for server config, a=testonly Automatic update from web-platform-tests[infra] Re-locate test for server configuration The `infrastructure/assumptions/` directory is intended for tests relating to browser configuration and operating system environment. Createa new directory dedicated to integration tests for the WPT server configuration. -- [wptrunner] Add regression tests for server config A recent commit [1] organized WPT configuration management into a dedicated class. In so doing, it unintentionally disabled the default secure WebSocket server. A subsequent commit [2] corrected the regression. Add a set of tests to demonstrate the intended behavior and to help avoid future regressions. [1] bfef1f20a419d24633e48d24c14e6a7503e1d48c [2] a5a8fbfafd075bf290525ad6a433ec5684ea874d -- wpt-commits: 230112faf2762e54acfdc8eebf633fc749ba2baf, 3a0a2e48c47614a961493dc0baddcd818146799c wpt-pr: 10619
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/infrastructure/README.md
testing/web-platform/tests/infrastructure/assumptions/secure-context.https.any.js
testing/web-platform/tests/infrastructure/server/secure-context.https.any.js
testing/web-platform/tests/infrastructure/server/wpt-server-http.sub.html
testing/web-platform/tests/infrastructure/server/wpt-server-websocket.sub.html
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -342590,32 +342590,44 @@
      "/infrastructure/assumptions/non-secure-context.any.html",
      {}
     ],
     [
      "/infrastructure/assumptions/non-secure-context.any.worker.html",
      {}
     ]
    ],
-   "infrastructure/assumptions/secure-context.https.any.js": [
-    [
-     "/infrastructure/assumptions/secure-context.https.any.html",
-     {}
-    ],
-    [
-     "/infrastructure/assumptions/secure-context.https.any.worker.html",
-     {}
-    ]
-   ],
    "infrastructure/expected-fail/failing-test.html": [
     [
      "/infrastructure/expected-fail/failing-test.html",
      {}
     ]
    ],
+   "infrastructure/server/secure-context.https.any.js": [
+    [
+     "/infrastructure/server/secure-context.https.any.html",
+     {}
+    ],
+    [
+     "/infrastructure/server/secure-context.https.any.worker.html",
+     {}
+    ]
+   ],
+   "infrastructure/server/wpt-server-http.sub.html": [
+    [
+     "/infrastructure/server/wpt-server-http.sub.html",
+     {}
+    ]
+   ],
+   "infrastructure/server/wpt-server-websocket.sub.html": [
+    [
+     "/infrastructure/server/wpt-server-websocket.sub.html",
+     {}
+    ]
+   ],
    "infrastructure/testdriver/click.html": [
     [
      "/infrastructure/testdriver/click.html",
      {
       "testdriver": true
      }
     ]
    ],
@@ -579238,17 +579250,17 @@
    "50eab1cff1bf2b1e68403ac724aa8043205901be",
    "support"
   ],
   "images/yellow75.png": [
    "4e33f8928d27bd64a96d72c32de08ebd483ab888",
    "support"
   ],
   "infrastructure/README.md": [
-   "2f3b62e45352d2226918e0959616c04a82547d9f",
+   "17caa93b8e495a096e26ffcfc229cecca453a644",
    "support"
   ],
   "infrastructure/assumptions/OWNERS": [
    "946f23f945163bf9f9da080291b21473f6e1cbd0",
    "support"
   ],
   "infrastructure/assumptions/ahem-notref.html": [
    "944e5db7eb0d7274ed547002410c25c9fbdc20b3",
@@ -579297,20 +579309,16 @@
   "infrastructure/assumptions/min-font-size.html": [
    "df47a9a9342da260175776c3406856be096d0012",
    "reftest"
   ],
   "infrastructure/assumptions/non-secure-context.any.js": [
    "7fc2a5023259d6dbddf93a018409c45b891a8c86",
    "testharness"
   ],
-  "infrastructure/assumptions/secure-context.https.any.js": [
-   "6f246bdc6d67a92a6518870542c20d2f8b2b5f5d",
-   "testharness"
-  ],
   "infrastructure/assumptions/tools/ahem-generate-table.py": [
    "24ddd1f2cbd478653820899aa63c35f02d0a551c",
    "support"
   ],
   "infrastructure/assumptions/tools/build.sh": [
    "e7549e915a809b48cac816dacdd7a9bbf476b596",
    "support"
   ],
@@ -579329,16 +579337,28 @@
   "infrastructure/reftest-wait-ref.html": [
    "62552ac6981fc0c7aca84983569717eb2990a31e",
    "support"
   ],
   "infrastructure/reftest-wait.html": [
    "1a291b68cdf6edcfc28a2ff22e294e8e8ebc0c42",
    "reftest"
   ],
+  "infrastructure/server/secure-context.https.any.js": [
+   "6f246bdc6d67a92a6518870542c20d2f8b2b5f5d",
+   "testharness"
+  ],
+  "infrastructure/server/wpt-server-http.sub.html": [
+   "c39602efd7574944e8495e9ed0d98c6811f9e2e7",
+   "testharness"
+  ],
+  "infrastructure/server/wpt-server-websocket.sub.html": [
+   "51c5d794b2b5c4139ed9bab8089f46cdcc9da647",
+   "testharness"
+  ],
   "infrastructure/testdriver/click.html": [
    "afb1a08faa639bdd1ee4387069d76803c5e38d54",
    "testharness"
   ],
   "infrastructure/testdriver/send_keys.html": [
    "f2ede647416d150d7cd3720719f386b9f4d5fb6c",
    "testharness"
   ],
--- a/testing/web-platform/tests/infrastructure/README.md
+++ b/testing/web-platform/tests/infrastructure/README.md
@@ -1,7 +1,9 @@
 This directory contains a number of tests to ensure test running
 infrastructure is operating correctly:
 
  * The tests in assumptions/ are designed to test UA assumptions
    documented in [assumptions.md](/docs/_writing-tests/assumptions.md).
 
+ * The tests in server/ are designed to test the WPT server configuration
+
  * The tests in expected-fail/ should all fail.
rename from testing/web-platform/tests/infrastructure/assumptions/secure-context.https.any.js
rename to testing/web-platform/tests/infrastructure/server/secure-context.https.any.js
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/infrastructure/server/wpt-server-http.sub.html
@@ -0,0 +1,172 @@
+<!doctype html>
+<html>
+  <head>
+    <title>WPT Server checker</title>
+    <meta charset="utf-8" />
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+</body>
+<body>
+<script>
+function check(protocol, domain, port, done) {
+  var url = protocol + '://' + domain + ':' + port + '/media/1x1-green.png';
+  var img = document.createElement('img');
+  img.setAttribute('src', url);
+  img.style.display = 'none';
+  img.onerror = function() {
+    done(false);
+  };
+  img.onload = function() {
+    done(true);
+  };
+
+  document.body.appendChild(img);
+}
+
+async_test(function(t) {
+  check('http', '{{browser_host}}', {{ports[http][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, no subdomain, port #1');
+
+async_test(function(t) {
+  check('http', '{{browser_host}}', {{ports[http][1]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, no subdomain, port #2');
+
+async_test(function(t) {
+  check('http', '{{domains[www]}}', {{ports[http][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, www subdomain #1, port #1');
+
+async_test(function(t) {
+  check('http', '{{domains[www]}}', {{ports[http][1]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, www subdomain #1, port #2');
+
+async_test(function(t) {
+  check('http', '{{domains[www1]}}', {{ports[http][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, www subdomain #2, port #1');
+
+async_test(function(t) {
+  check('http', '{{domains[www1]}}', {{ports[http][1]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, www subdomain #2, port #2');
+
+async_test(function(t) {
+  check('http', '{{domains[www2]}}', {{ports[http][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, www subdomain #3, port #1');
+
+async_test(function(t) {
+  check('http', '{{domains[www2]}}', {{ports[http][1]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, www subdomain #3, port #2');
+
+async_test(function(t) {
+  check('http', '{{domains[élève]}}', {{ports[http][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, punycode subdomain #1, port #1');
+
+async_test(function(t) {
+  check('http', '{{domains[élève]}}', {{ports[http][1]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, punycode subdomain #1, port #2');
+
+async_test(function(t) {
+  check('http', '{{domains[天気の良い日]}}', {{ports[http][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, punycode subdomain #2, port #1');
+
+async_test(function(t) {
+  check('http', '{{domains[天気の良い日]}}', {{ports[http][1]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTP protocol, punycode subdomain #2, port #2');
+
+async_test(function(t) {
+  check('https', '{{browser_host}}', {{ports[https][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTPS protocol, no subdomain');
+
+async_test(function(t) {
+  check('https', '{{domains[www]}}', {{ports[https][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTPS protocol, www subdomain #1');
+
+async_test(function(t) {
+  check('https', '{{domains[www1]}}', {{ports[https][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTPS protocol, www subdomain #2');
+
+async_test(function(t) {
+  check('https', '{{domains[www2]}}', {{ports[https][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTPS protocol, www subdomain #3');
+
+async_test(function(t) {
+  check('https', '{{domains[élève]}}', {{ports[https][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTPS protocol, punycode subdomain #1');
+
+async_test(function(t) {
+  check('https', '{{domains[天気の良い日]}}', {{ports[https][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'HTTPS protocol, punycode subdomain #2');
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/infrastructure/server/wpt-server-websocket.sub.html
@@ -0,0 +1,122 @@
+<!doctype html>
+<html>
+  <head>
+    <title>WPT Server checker</title>
+    <meta charset="utf-8" />
+    <script src="/resources/testharness.js"></script>
+    <script src="/resources/testharnessreport.js"></script>
+  </head>
+</body>
+<body>
+<script>
+function check(protocol, domain, port, done) {
+  var url = protocol + '://' + domain + ':' + port + '/echo';
+  var ws = new WebSocket(url);
+
+  ws.addEventListener('error', function() {
+    done(false);
+  });
+
+  ws.addEventListener('open', function() {
+    done(true);
+  });
+}
+
+async_test(function(t) {
+  check('ws', '{{browser_host}}', {{ports[ws][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WS protocol, no subdomain');
+
+async_test(function(t) {
+  check('ws', '{{domains[www1]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WS protocol, www subdomain #1');
+
+async_test(function(t) {
+  check('ws', '{{domains[www1]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WS protocol, www subdomain #2');
+
+async_test(function(t) {
+  check('ws', '{{domains[www2]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WS protocol, www subdomain #3');
+
+async_test(function(t) {
+  check('ws', '{{domains[élève]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WS protocol, punycode subdomain #1');
+
+async_test(function(t) {
+  check('ws', '{{domains[天気の良い日]}}', {{ports[ws][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WS protocol, punycode subdomain #2');
+
+async_test(function(t) {
+  check('wss', '{{browser_host}}', {{ports[wss][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WSS protocol, no subdomain');
+
+async_test(function(t) {
+  check('wss', '{{domains[www1]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WSS protocol, www subdomain #1');
+
+async_test(function(t) {
+  check('wss', '{{domains[www1]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WSS protocol, www subdomain #2');
+
+async_test(function(t) {
+  check('wss', '{{domains[www2]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WSS protocol, www subdomain #3');
+
+async_test(function(t) {
+  check('wss', '{{domains[élève]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WSS protocol, punycode subdomain #1');
+
+async_test(function(t) {
+  check('wss', '{{domains[天気の良い日]}}', {{ports[wss][0]}}, t.step_func(function(result) {
+    assert_true(result);
+
+    t.done();
+  }));
+}, 'WSS protocol, punycode subdomain #2');
+</script>
+</body>
+</html>