Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <meta charset="utf-8"> | |
| 3 <title>NetInfo Test</title> | |
| 4 <link rel="help" href="https://wicg.github.io/netinfo/"> | |
| 5 <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.
| |
| 6 <script src="/resources/testharness.js"></script> | |
| 7 <script src="/resources/testharnessreport.js"></script> | |
| 8 | |
| 9 <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.
| |
| 10 <p> | |
| 11 This test validates that all of the NetInfo attributes exist and are set to | |
| 12 their correct values. | |
| 13 </p> | |
| 14 | |
| 15 <script> | |
| 16 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.
| |
| 17 assert_greater_than_equal(navigator.connection.downlinkMax, 0, | |
| 18 'downlinkMax must be non-negative'); | |
| 19 | |
| 20 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.
| |
| 21 || navigator.connection.type == "cellular" | |
| 22 || navigator.connection.type == "ethernet" | |
| 23 || navigator.connection.type == "mixed" | |
| 24 || navigator.connection.type == "none" | |
| 25 || navigator.connection.type == "other" | |
| 26 || navigator.connection.type == "unknown" | |
| 27 || navigator.connection.type == "wifi" | |
| 28 || navigator.connection.type == "wimax", | |
| 29 'type is unexpected'); | |
| 30 | |
| 31 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.
| |
| 32 'rtt must be non-negative'); | |
| 33 | |
| 34 assert_greater_than_equal(navigator.connection.downlink, 0, | |
| 35 'downlink must be non-negative'); | |
| 36 | |
| 37 assert_true(navigator.connection.effectiveType == "slow-2g" | |
| 38 || navigator.connection.effectiveType == "2g" | |
| 39 || navigator.connection.effectiveType == "3g" | |
| 40 || navigator.connection.effectiveType == "4g", | |
| 41 'effectiveType is unexpected'); | |
| 42 }); | |
| 43 </script> | |
| OLD | NEW |