wpt-server-http.sub.html (6771B)
1 <!doctype html> 2 <html> 3 <head> 4 <title>WPT Server checker</title> 5 <meta charset="utf-8" /> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 </head> 9 </body> 10 <body> 11 <script> 12 function check(protocol, domain, port, done) { 13 var scheme = protocol == "h2" ? "https" : protocol; 14 var url = scheme + '://' + domain + ':' + port + '/media/1x1-green.png'; 15 var img = document.createElement('img'); 16 img.setAttribute('src', url); 17 img.style.display = 'none'; 18 img.onerror = function() { 19 done(false); 20 }; 21 img.onload = function() { 22 done(true); 23 }; 24 25 document.body.appendChild(img); 26 } 27 28 async_test(function(t) { 29 check('http', '{{browser_host}}', {{ports[http][0]}}, t.step_func(function(result) { 30 assert_true(result); 31 32 t.done(); 33 })); 34 }, 'HTTP protocol, no subdomain, port #1'); 35 36 async_test(function(t) { 37 check('http', '{{browser_host}}', {{ports[http][1]}}, t.step_func(function(result) { 38 assert_true(result); 39 40 t.done(); 41 })); 42 }, 'HTTP protocol, no subdomain, port #2'); 43 44 async_test(function(t) { 45 check('http', '{{domains[www]}}', {{ports[http][0]}}, t.step_func(function(result) { 46 assert_true(result); 47 48 t.done(); 49 })); 50 }, 'HTTP protocol, www subdomain #1, port #1'); 51 52 async_test(function(t) { 53 check('http', '{{domains[www]}}', {{ports[http][1]}}, t.step_func(function(result) { 54 assert_true(result); 55 56 t.done(); 57 })); 58 }, 'HTTP protocol, www subdomain #1, port #2'); 59 60 async_test(function(t) { 61 check('http', '{{domains[www1]}}', {{ports[http][0]}}, t.step_func(function(result) { 62 assert_true(result); 63 64 t.done(); 65 })); 66 }, 'HTTP protocol, www subdomain #2, port #1'); 67 68 async_test(function(t) { 69 check('http', '{{domains[www1]}}', {{ports[http][1]}}, t.step_func(function(result) { 70 assert_true(result); 71 72 t.done(); 73 })); 74 }, 'HTTP protocol, www subdomain #2, port #2'); 75 76 async_test(function(t) { 77 check('http', '{{domains[www2]}}', {{ports[http][0]}}, t.step_func(function(result) { 78 assert_true(result); 79 80 t.done(); 81 })); 82 }, 'HTTP protocol, www subdomain #3, port #1'); 83 84 async_test(function(t) { 85 check('http', '{{domains[www2]}}', {{ports[http][1]}}, t.step_func(function(result) { 86 assert_true(result); 87 88 t.done(); 89 })); 90 }, 'HTTP protocol, www subdomain #3, port #2'); 91 92 async_test(function(t) { 93 check('http', '{{domains[élève]}}', {{ports[http][0]}}, t.step_func(function(result) { 94 assert_true(result); 95 96 t.done(); 97 })); 98 }, 'HTTP protocol, punycode subdomain #1, port #1'); 99 100 async_test(function(t) { 101 check('http', '{{domains[élève]}}', {{ports[http][1]}}, t.step_func(function(result) { 102 assert_true(result); 103 104 t.done(); 105 })); 106 }, 'HTTP protocol, punycode subdomain #1, port #2'); 107 108 async_test(function(t) { 109 check('http', '{{domains[天気の良い日]}}', {{ports[http][0]}}, t.step_func(function(result) { 110 assert_true(result); 111 112 t.done(); 113 })); 114 }, 'HTTP protocol, punycode subdomain #2, port #1'); 115 116 async_test(function(t) { 117 check('http', '{{domains[天気の良い日]}}', {{ports[http][1]}}, t.step_func(function(result) { 118 assert_true(result); 119 120 t.done(); 121 })); 122 }, 'HTTP protocol, punycode subdomain #2, port #2'); 123 124 async_test(function(t) { 125 check('http', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) { 126 assert_false(result); 127 128 t.done(); 129 })); 130 }, 'HTTP protocol, non-existent domain, port #1'); 131 132 async_test(function(t) { 133 check('http', 'nonexistent.{{domains[]}}', {{ports[http][1]}}, t.step_func(function(result) { 134 assert_false(result); 135 136 t.done(); 137 })); 138 }, 'HTTP protocol, non-existent domain, port #2'); 139 140 async_test(function(t) { 141 check('https', '{{browser_host}}', {{ports[https][0]}}, t.step_func(function(result) { 142 assert_true(result); 143 144 t.done(); 145 })); 146 }, 'HTTPS protocol, no subdomain'); 147 148 async_test(function(t) { 149 check('https', '{{domains[www]}}', {{ports[https][0]}}, t.step_func(function(result) { 150 assert_true(result); 151 152 t.done(); 153 })); 154 }, 'HTTPS protocol, www subdomain #1'); 155 156 async_test(function(t) { 157 check('https', '{{domains[www1]}}', {{ports[https][0]}}, t.step_func(function(result) { 158 assert_true(result); 159 160 t.done(); 161 })); 162 }, 'HTTPS protocol, www subdomain #2'); 163 164 async_test(function(t) { 165 check('https', '{{domains[www2]}}', {{ports[https][0]}}, t.step_func(function(result) { 166 assert_true(result); 167 168 t.done(); 169 })); 170 }, 'HTTPS protocol, www subdomain #3'); 171 172 async_test(function(t) { 173 check('https', '{{domains[élève]}}', {{ports[https][0]}}, t.step_func(function(result) { 174 assert_true(result); 175 176 t.done(); 177 })); 178 }, 'HTTPS protocol, punycode subdomain #1'); 179 180 async_test(function(t) { 181 check('https', '{{domains[天気の良い日]}}', {{ports[https][0]}}, t.step_func(function(result) { 182 assert_true(result); 183 184 t.done(); 185 })); 186 }, 'HTTPS protocol, punycode subdomain #2'); 187 188 async_test(function(t) { 189 check('https', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) { 190 assert_false(result); 191 192 t.done(); 193 })); 194 }, 'HTTPS protocol, non-existent domain, port #1'); 195 196 async_test(function(t) { 197 check('https', 'nonexistent.{{domains[]}}', {{ports[http][1]}}, t.step_func(function(result) { 198 assert_false(result); 199 200 t.done(); 201 })); 202 }, 'HTTPS protocol, non-existent domain, port #2'); 203 204 async_test(function(t) { 205 check('h2', '{{browser_host}}', {{ports[h2][0]}}, t.step_func(function(result) { 206 assert_true(result); 207 208 t.done(); 209 })); 210 }, 'H2 protocol, no subdomain'); 211 212 async_test(function(t) { 213 check('h2', '{{domains[www]}}', {{ports[h2][0]}}, t.step_func(function(result) { 214 assert_true(result); 215 216 t.done(); 217 })); 218 }, 'H2 protocol, www subdomain #1'); 219 220 async_test(function(t) { 221 check('h2', '{{domains[www1]}}', {{ports[h2][0]}}, t.step_func(function(result) { 222 assert_true(result); 223 224 t.done(); 225 })); 226 }, 'H2 protocol, www subdomain #2'); 227 228 async_test(function(t) { 229 check('h2', '{{domains[www2]}}', {{ports[h2][0]}}, t.step_func(function(result) { 230 assert_true(result); 231 232 t.done(); 233 })); 234 }, 'H2 protocol, www subdomain #3'); 235 236 async_test(function(t) { 237 check('h2', '{{domains[élève]}}', {{ports[h2][0]}}, t.step_func(function(result) { 238 assert_true(result); 239 240 t.done(); 241 })); 242 }, 'H2 protocol, punycode subdomain #1'); 243 244 async_test(function(t) { 245 check('h2', '{{domains[天気の良い日]}}', {{ports[h2][0]}}, t.step_func(function(result) { 246 assert_true(result); 247 248 t.done(); 249 })); 250 }, 'H2 protocol, punycode subdomain #2'); 251 252 async_test(function(t) { 253 check('h2', 'nonexistent.{{domains[]}}', {{ports[http][0]}}, t.step_func(function(result) { 254 assert_false(result); 255 256 t.done(); 257 })); 258 }, 'H2 protocol, non-existent domain, port #1'); 259 260 </script> 261 </body> 262 </html>