Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: LayoutTests/netinfo/basic-operation.html

Issue 1308943005: [NetInfo] Add Blink support for connection.change, connection.downlinkMax, and wimax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <head> 2 <head>
3 <script src="../resources/js-test.js"></script> 3 <script src="../resources/js-test.js"></script>
4 <script src="resources/netinfo_common.js"></script> 4 <script src="resources/netinfo_common.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 description('Tests the basic operation of NetInfo.'); 8 description('Tests the basic operation of NetInfo.');
9 9
10 shouldBe('typeof window.internals.observeGC', '"function"', 10 shouldBe('typeof window.internals.observeGC', '"function"',
11 'this test requires window.internals'); 11 'this test requires window.internals');
12 12
13 shouldBeDefined("navigator.connection"); 13 shouldBeDefined("navigator.connection");
14 shouldBeDefined("navigator.connection.type"); 14 shouldBeDefined("navigator.connection.type");
15 shouldBeDefined("navigator.connection.downlinkMax");
15 16
16 connection.addEventListener('typechange', function(e) { 17 var typeChangeListener = function(e) {
18 shouldBe("typeof connection.type", '"string"');
19 shouldBe('connection.type', 'initialType');
20 shouldBe('connection.downlinkMax', 'initialDownlinkMax');
21 finishJSTest();
22 }
23
24 var changeListener = function(e) {
17 shouldBe("typeof connection.type", '"string"'); 25 shouldBe("typeof connection.type", '"string"');
18 shouldBe('connection.type', 'newConnectionType'); 26 shouldBe('connection.type', 'newConnectionType');
19 finishJSTest(); 27 shouldBe('connection.downlinkMax', 'newDownlinkMax');
20 }); 28 connection.removeEventListener('change', changeListener);
29 connection.addEventListener('typechange', typeChangeListener);
30 » internals.setNetworkConnectionInfo(initialType, initialDownlinkMax);
31 }
21 32
22 internals.setNetworkConnectionInfo(newConnectionType); 33 connection.addEventListener('change', changeListener);
34 internals.setNetworkConnectionInfo(newConnectionType, newDownlinkMax);
23 35
24 </script> 36 </script>
25 </body> 37 </body>
26 </html> 38 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698