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

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

Issue 2903493002: NetInfo network quality extension: Add callbacks and Layout tests (Closed)
Patch Set: haraken comments Created 3 years, 6 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 shouldBeDefined("navigator.connection.downlinkMax");
16 shouldBeDefined("navigator.connection.effectiveType"); 16 shouldBeDefined("navigator.connection.effectiveType");
17 shouldBeDefined("navigator.connection.rtt"); 17 shouldBeDefined("navigator.connection.rtt");
18 shouldBeDefined("navigator.connection.downlink"); 18 shouldBeDefined("navigator.connection.downlink");
19 19
20 var typeChangeListener = function(e) { 20 var typeChangeListener = function(e) {
21 shouldBe("typeof connection.type", '"string"'); 21 shouldBe("typeof connection.type", '"string"');
22 shouldBe('connection.type', 'initialType'); 22 shouldBe('connection.type', 'initialType');
23 shouldBe('connection.downlinkMax', 'initialDownlinkMax'); 23 shouldBe('connection.downlinkMax', 'initialDownlinkMax');
24 shouldBe('connection.effectiveType', 'initialEffectiveType');
25 shouldBe('connection.rtt', 'initialRtt');
26 shouldBe('connection.downlink', 'initialDownlink');
24 finishJSTest(); 27 finishJSTest();
25 } 28 }
26 29
27 var changeListener = function(e) { 30 var changeListener = function(e) {
28 shouldBe("typeof connection.type", '"string"'); 31 shouldBe("typeof connection.type", '"string"');
29 shouldBe('connection.type', 'newConnectionType'); 32 shouldBe('connection.type', 'newConnectionType');
30 shouldBe('connection.downlinkMax', 'newDownlinkMax'); 33 shouldBe('connection.downlinkMax', 'newDownlinkMax');
34 shouldBe('connection.effectiveType', 'initialEffectiveType');
35 shouldBe('connection.rtt', 'initialRtt');
36 shouldBe('connection.downlink', 'initialDownlink');
31 connection.removeEventListener('change', changeListener); 37 connection.removeEventListener('change', changeListener);
32 connection.addEventListener('typechange', typeChangeListener); 38 connection.addEventListener('typechange', typeChangeListener);
33 internals.setNetworkConnectionInfoOverride(isTypeOnline(initialType), in itialType, initialDownlinkMax); 39 internals.setNetworkConnectionInfoOverride(isTypeOnline(initialType), in itialType, initialDownlinkMax);
34 } 40 }
35 41
36 connection.addEventListener('change', changeListener); 42 connection.addEventListener('change', changeListener);
37 internals.setNetworkConnectionInfoOverride(isTypeOnline(newConnectionType), newC onnectionType, newDownlinkMax); 43 internals.setNetworkConnectionInfoOverride(isTypeOnline(newConnectionType), newC onnectionType, newDownlinkMax);
38 44
39 </script> 45 </script>
40 </body> 46 </body>
41 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698