OLD | NEW |
(Empty) | |
| 1 <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 var otherHandler = function(e) { |
| 12 if (connection.type != initialType) |
| 13 testFailed("The connection type did not revert."); |
| 14 finishJSTest(); |
| 15 }; |
| 16 |
| 17 var handler = function(e) { |
| 18 if (connection.type != newConnectionType) |
| 19 testFailed("The connection type did not change."); |
| 20 connection.removeEventListener('typechange', handler); |
| 21 connection.addEventListener('typechange', otherHandler); |
| 22 internals.setNetworkConnectionInfo(initialType); |
| 23 }; |
| 24 |
| 25 connection.addEventListener('typechange', handler); |
| 26 internals.setNetworkConnectionInfo(newConnectionType); |
| 27 |
| 28 </script> |
| 29 </body> |
| 30 </html> |
OLD | NEW |