Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / netinfo / basic-operation.html
blob037e9cbeef0cd28e348fefbab592ee478b6a85bc
1 <!DOCTYPE html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 <script src="resources/netinfo_common.js"></script>
5 </head>
6 <body>
7 <script>
8 description('Tests the basic operation of NetInfo.');
10 shouldBe('typeof window.internals.observeGC', '"function"',
11 'this test requires window.internals');
13 shouldBeDefined("navigator.connection");
14 shouldBeDefined("navigator.connection.type");
15 shouldBeDefined("navigator.connection.downlinkMax");
17 var typeChangeListener = function(e) {
18 shouldBe("typeof connection.type", '"string"');
19 shouldBe('connection.type', 'initialType');
20 shouldBe('connection.downlinkMax', 'initialDownlinkMax');
21 finishJSTest();
24 var changeListener = function(e) {
25 shouldBe("typeof connection.type", '"string"');
26 shouldBe('connection.type', 'newConnectionType');
27 shouldBe('connection.downlinkMax', 'newDownlinkMax');
28 connection.removeEventListener('change', changeListener);
29 connection.addEventListener('typechange', typeChangeListener);
30 internals.setNetworkConnectionInfo(initialType, initialDownlinkMax);
33 connection.addEventListener('change', changeListener);
34 internals.setNetworkConnectionInfo(newConnectionType, newDownlinkMax);
36 </script>
37 </body>
38 </html>