| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Test for font-display @font-face descriptor with User-Agent Intervention<
/title> | 2 <title>Test for font-display @font-face descriptor with User-Agent Intervention<
/title> |
| 3 <style> | 3 <style> |
| 4 .hidden { display: none; } | 4 .hidden { display: none; } |
| 5 </style> | 5 </style> |
| 6 <p>Tests how text with a font that takes <i>delay</i> seconds to load look like
after <i>T</i> seconds from load start.</p> | 6 <p>Tests how text with a font that takes <i>delay</i> seconds to load look like
after <i>T</i> seconds from load start.</p> |
| 7 <table id="container"> | 7 <table id="container"> |
| 8 <tr> | 8 <tr> |
| 9 <th>T[sec]</th> | 9 <th>T[sec]</th> |
| 10 <th>delay[sec]</th> | 10 <th>delay[sec]</th> |
| 11 <th>auto</th> | 11 <th>auto</th> |
| 12 <th>block</th> | 12 <th>block</th> |
| 13 <th>swap</th> | 13 <th>swap</th> |
| 14 <th>fallback</th> | 14 <th>fallback</th> |
| 15 <th>optional</th> | 15 <th>optional</th> |
| 16 </tr> | 16 </tr> |
| 17 </table> | 17 </table> |
| 18 <script> | 18 <script> |
| 19 if (window.testRunner) | 19 if (window.testRunner) |
| 20 testRunner.waitUntilDone(); | 20 testRunner.waitUntilDone(); |
| 21 | 21 |
| 22 // 2G cellular networks will cause an User-Agent Intervention. | 22 // 2G cellular networks will cause an User-Agent Intervention. |
| 23 // Under the situation, 'auto' should behave as 'swap'. | 23 // Under the situation, 'auto' should behave as 'swap'. |
| 24 if (window.internals) { | 24 if (window.internals) { |
| 25 internals.setNetworkStateNotifierTestOnly(true); | 25 internals.setNetworkConnectionInfoOverride(true, 'cellular2g', 1.0); |
| 26 internals.setNetworkConnectionInfo('cellular2g', 1.0); | |
| 27 | 26 |
| 28 // Reset the state of the singleton network state notifier. | 27 // Reset the state of the singleton network state notifier. |
| 29 window.addEventListener('beforeunload', function() { | 28 window.addEventListener('beforeunload', function() { |
| 30 internals.setNetworkStateNotifierTestOnly(false); | 29 internals.clearNetworkConnectionInfoOverride(); |
| 31 }, false); | 30 }, false); |
| 32 } | 31 } |
| 33 | 32 |
| 34 var fontDisplayValues = ['auto', 'block', 'swap', 'fallback', 'optional']; | 33 var fontDisplayValues = ['auto', 'block', 'swap', 'fallback', 'optional']; |
| 35 var configs = [{time: 0, delay: 1000}, | 34 var configs = [{time: 0, delay: 1000}, |
| 36 {time: 1000, delay: 0}, | 35 {time: 1000, delay: 0}, |
| 37 {time: 1000, delay: 500}, | 36 {time: 1000, delay: 500}, |
| 38 {time: 1000, delay: 3000}, | 37 {time: 1000, delay: 3000}, |
| 39 {time: 5000, delay: 2000}, | 38 {time: 5000, delay: 2000}, |
| 40 {time: 5000, delay: 4000}, | 39 {time: 5000, delay: 4000}, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 } | 72 } |
| 74 table.appendChild(tr); | 73 table.appendChild(tr); |
| 75 setTimeout((function(tr){tr.classList.remove('hidden')}).bind(null, tr),
maxTime - config.time); | 74 setTimeout((function(tr){tr.classList.remove('hidden')}).bind(null, tr),
maxTime - config.time); |
| 76 } | 75 } |
| 77 | 76 |
| 78 if (window.testRunner) | 77 if (window.testRunner) |
| 79 setTimeout(function() { testRunner.notifyDone(); }, maxTime); | 78 setTimeout(function() { testRunner.notifyDone(); }, maxTime); |
| 80 } | 79 } |
| 81 | 80 |
| 82 </script> | 81 </script> |
| OLD | NEW |