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

Side by Side Diff: LayoutTests/netinfo/unregister-during-event.html

Issue 1308943005: [NetInfo] Add Blink support for connection.change, connection.downlinkMax, and wimax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 3 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');
17
16 finishJSTest(); 18 finishJSTest();
17 }; 19 };
18 20
19 var handler = function(e) { 21 var handler = function(e) {
20 shouldBe('connection.type', 'newConnectionType'); 22 shouldBe('connection.type', 'newConnectionType');
21 connection.removeEventListener('typechange', handler); 23 shouldBe('connection.downlinkMax', 'newDownlinkMax');
22 connection.addEventListener('typechange', otherHandler); 24 connection.removeEventListener('change', handler);
23 internals.setNetworkConnectionInfo(initialType); 25 connection.addEventListener('change', otherHandler);
26 internals.setNetworkConnectionInfo(initialType, initialDownlinkMax);
24 }; 27 };
25 28
26 connection.addEventListener('typechange', handler); 29 connection.addEventListener('change', handler);
27 internals.setNetworkConnectionInfo(newConnectionType); 30 internals.setNetworkConnectionInfo(newConnectionType, newDownlinkMax);
28 31
29 </script> 32 </script>
30 </body> 33 </body>
31 </html> 34 </html>
OLDNEW
« no previous file with comments | « LayoutTests/netinfo/type-change-no-listener-expected.txt ('k') | LayoutTests/netinfo/unregister-during-event-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698