OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <head> |
| 3 <script src="../resources/js-test.js"></script> |
| 4 <script src="resources/netinfo_common.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <script> |
| 8 |
| 9 description("Tests that it's okay to unregister the event listener while handlin
g the event."); |
| 10 |
| 11 shouldBe('typeof window.internals.observeGC', '"function"', |
| 12 'this test requires window.internals'); |
| 13 |
| 14 var otherHandler = function(e) { |
| 15 if (connection.type != initialType) |
| 16 testFailed("The connection type did not revert."); |
| 17 finishJSTest(); |
| 18 }; |
| 19 |
| 20 var handler = function(e) { |
| 21 if (connection.type != newConnectionType) |
| 22 testFailed("The connection type did not change."); |
| 23 connection.removeEventListener('typechange', handler); |
| 24 connection.addEventListener('typechange', otherHandler); |
| 25 internals.setNetworkConnectionInfo(initialType); |
| 26 }; |
| 27 |
| 28 connection.addEventListener('typechange', handler); |
| 29 internals.setNetworkConnectionInfo(newConnectionType); |
| 30 |
| 31 </script> |
| 32 </body> |
| 33 </html> |
OLD | NEW |