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

Unified Diff: third_party/WebKit/LayoutTests/external/wpt/netinfo/Netinfo.html

Issue 2908103002: NetInfo external Web LayoutTest (Closed)
Patch Set: ps 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/external/wpt/netinfo/Netinfo.html
diff --git a/third_party/WebKit/LayoutTests/external/wpt/netinfo/Netinfo.html b/third_party/WebKit/LayoutTests/external/wpt/netinfo/Netinfo.html
new file mode 100644
index 0000000000000000000000000000000000000000..d4e3575b5532b36e18c519eea78eedc5fa15f761
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/external/wpt/netinfo/Netinfo.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>NetInfo Test</title>
+<link rel="help" href="https://wicg.github.io/netinfo/">
+<meta name="flags" content="">
foolip 2017/05/29 19:28:00 This line isn't necessary. Since the filename isn
tbansal1 2017/05/30 21:49:41 Done.
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+
+<h2>Description</h2>
foolip 2017/05/29 19:28:00 These bits, while often found in LayoutTests, aren
tbansal1 2017/05/30 21:49:41 Done.
+<p>
+ This test validates that all of the NetInfo attributes exist and are set to
+ their correct values.
+</p>
+
+<script>
+test(function() {
foolip 2017/05/29 19:28:00 It's a good idea in general to have separate tests
tbansal1 2017/05/30 21:49:41 Done. Using one test per attribute.
+ assert_greater_than_equal(navigator.connection.downlinkMax, 0,
+ 'downlinkMax must be non-negative');
+
+ assert_true(navigator.connection.type == "bluetooth"
foolip 2017/05/29 19:28:00 assert_in_array would help for this and effectiveT
tbansal1 2017/05/30 21:49:41 Thanks, this makes the test much cleaner.
+ || navigator.connection.type == "cellular"
+ || navigator.connection.type == "ethernet"
+ || navigator.connection.type == "mixed"
+ || navigator.connection.type == "none"
+ || navigator.connection.type == "other"
+ || navigator.connection.type == "unknown"
+ || navigator.connection.type == "wifi"
+ || navigator.connection.type == "wimax",
+ 'type is unexpected');
+
+ assert_greater_than_equal(navigator.connection.rtt, 0,
foolip 2017/05/29 19:28:00 Can you also assert_equals(navigator.connection.rt
tbansal1 2017/05/30 21:49:41 Done.
+ 'rtt must be non-negative');
+
+ assert_greater_than_equal(navigator.connection.downlink, 0,
+ 'downlink must be non-negative');
+
+ assert_true(navigator.connection.effectiveType == "slow-2g"
+ || navigator.connection.effectiveType == "2g"
+ || navigator.connection.effectiveType == "3g"
+ || navigator.connection.effectiveType == "4g",
+ 'effectiveType is unexpected');
+ });
+</script>
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698