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

Side by Side Diff: third_party/WebKit/LayoutTests/netinfo/resources/netinfo_common.js

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 window.jsTestIsAsync = true; 1 window.jsTestIsAsync = true;
2 2
3 var connection = navigator.connection; 3 var connection = navigator.connection;
4 var initialType = "bluetooth"; 4 var initialType = "bluetooth";
5 var initialDownlinkMax = 1.0; 5 var initialDownlinkMax = 1.0;
6 var newConnectionType = "ethernet"; 6 var newConnectionType = "ethernet";
7 var newDownlinkMax = 2.0; 7 var newDownlinkMax = 2.0;
8 var initialEffectiveType = "3g";
9 var initialRtt = 25.0;
10 var initialDownlink = 10.0;
11 var newEffectiveType = "4g";
12 var newRtt = 50.0;
13 var newDownlink = 30.0;
8 14
9 // Suppress connection messages information from the host. 15 // Suppress connection messages information from the host.
10 if (window.internals) { 16 if (window.internals) {
11 internals.setNetworkConnectionInfoOverride(true, initialType, initialDownlin kMax); 17 internals.setNetworkConnectionInfoOverride(true, initialType, initialDownlin kMax);
18 internals.setNetworkQualityInfoOverride(initialEffectiveType, initialRtt, in itialDownlink);
12 19
13 // Reset the state of the singleton network state notifier. 20 // Reset the state of the singleton network state notifier.
14 window.addEventListener('beforeunload', function() { 21 window.addEventListener('beforeunload', function() {
15 internals.clearNetworkConnectionInfoOverride(); 22 internals.clearNetworkConnectionInfoOverride();
16 }, false); 23 }, false);
17 } 24 }
18 25
19 function isTypeOnline(type) { 26 function isTypeOnline(type) {
20 return type != 'none'; 27 return type != 'none';
21 } 28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698