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

Side by Side Diff: third_party/WebKit/LayoutTests/netinfo/unregister-during-event.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 8
9 description("Tests that it's okay to unregister the event listener while handlin g the event."); 9 description("Tests that it's okay to unregister the event listener while handlin g the event.");
10 10
11 shouldBe('typeof window.internals.observeGC', '"function"', 11 shouldBe('typeof window.internals.observeGC', '"function"',
12 'this test requires window.internals'); 12 'this test requires window.internals');
13 13
14 var otherHandler = function(e) { 14 var otherHandler = function(e) {
15 shouldBe('connection.type', 'initialType'); 15 shouldBe('connection.type', 'initialType');
16 shouldBe('connection.downlinkMax', 'initialDownlinkMax'); 16 shouldBe('connection.downlinkMax', 'initialDownlinkMax');
17 shouldBe('connection.effectiveType', 'initialEffectiveType');
18 shouldBe('connection.rtt', 'initialRtt');
19 shouldBe('connection.downlink', 'initialDownlink');
17 20
18 finishJSTest(); 21 finishJSTest();
19 }; 22 };
20 23
21 var handler = function(e) { 24 var handler = function(e) {
22 shouldBe('connection.type', 'newConnectionType'); 25 shouldBe('connection.type', 'newConnectionType');
23 shouldBe('connection.downlinkMax', 'newDownlinkMax'); 26 shouldBe('connection.downlinkMax', 'newDownlinkMax');
27 shouldBe('connection.effectiveType', 'initialEffectiveType');
28 shouldBe('connection.rtt', 'initialRtt');
29 shouldBe('connection.downlink', 'initialDownlink');
24 connection.removeEventListener('change', handler); 30 connection.removeEventListener('change', handler);
25 connection.addEventListener('change', otherHandler); 31 connection.addEventListener('change', otherHandler);
26 internals.setNetworkConnectionInfoOverride(isTypeOnline(initialType), initia lType, initialDownlinkMax); 32 internals.setNetworkConnectionInfoOverride(isTypeOnline(initialType), initia lType, initialDownlinkMax);
27 }; 33 };
28 34
29 connection.addEventListener('change', handler); 35 connection.addEventListener('change', handler);
30 internals.setNetworkConnectionInfoOverride(isTypeOnline(newConnectionType), newC onnectionType, newDownlinkMax); 36 internals.setNetworkConnectionInfoOverride(isTypeOnline(newConnectionType), newC onnectionType, newDownlinkMax);
31 37
32 </script> 38 </script>
33 </body> 39 </body>
34 </html> 40 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698