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

Unified Diff: third_party/WebKit/LayoutTests/netinfo/network-quality.html

Issue 2903493002: NetInfo network quality extension: Add callbacks and Layout tests (Closed)
Patch Set: haraken comments Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/netinfo/network-quality.html
diff --git a/third_party/WebKit/LayoutTests/netinfo/network-quality.html b/third_party/WebKit/LayoutTests/netinfo/network-quality.html
new file mode 100644
index 0000000000000000000000000000000000000000..9cfb2d969be66d23cd8c54b76a8be12e8e16a4de
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/netinfo/network-quality.html
@@ -0,0 +1,40 @@
+<!DOCTYPE html>
+<head>
+<script src="../resources/js-test.js"></script>
+<script src="resources/netinfo_common.js"></script>
+</head>
+<body>
+<script>
+description('Tests that all rtt and downlink is exposed correctly.');
+
+if (!window.internals)
+ log("This test requires window.internals");
+
+var values = [
+ ["slow-2g", 25.0, 2.0, "slow-2g", 25.0, 2.0],
+ ["slow-2g", 40.0, 2.0, "slow-2g", 50.0, 2.0],
+ ["slow-2g", 40.0, 0.0, "slow-2g", 50.0, 0.0],
+ ["slow-2g", 40.0, 0.125, "slow-2g", 50.0, 0.125],
+ ["slow-2g", 40.0, 0.103, "slow-2g", 50.0, 0.1],
+ ["slow-2g", 40.0, 0.123, "slow-2g", 50.0, 0.125],
+ ["2g", 40.0, 0.123, "2g", 50.0, 0.125],
+ ["3g", 40.0, 0.123, "3g", 50.0, 0.125],
+ ["3g", 10.0, 0.123, "3g", 0.0, 0.125],
+];
+
+var count = 0;
+connection.addEventListener('change', function(e) {
+ shouldBe('connection.effectiveType', 'values[count][3]');
+ shouldBe('connection.rtt', 'values[count][4]');
+ shouldBe('connection.downlink', 'values[count][5]');
+
+ if (++count === values.length)
+ finishJSTest();
+});
+
+for(var i = 0; i < values.length; i++)
+ internals.setNetworkQualityInfoOverride(values[i][0], values[i][1], values[i][2]);
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698