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 web-workers have access to NetInfo.'); |
| 10 |
| 11 var worker = new Worker("resources/web-worker.js"); |
| 12 |
| 13 var msg_count = 0; |
| 14 |
| 15 worker.addEventListener('message', function(e) { |
| 16 if (msg_count == 0) { |
| 17 if (e.data != connection.type) { |
| 18 testFailed("Worker type disagrees with main frame."); |
| 19 } |
| 20 internals.setNetworkConnectionInfo(newConnectionType); |
| 21 } else if (msg_count == 1) { |
| 22 if (e.data != newConnectionType) |
| 23 testFailed("Worker switched to wrong connection type."); |
| 24 internals.setNetworkConnectionInfo(initialType); |
| 25 } else if (msg_count == 2) { |
| 26 if (e.data != initialType) |
| 27 testFailed("Worker did not revert back to initial type."); |
| 28 finishJSTest(); |
| 29 } |
| 30 msg_count += 1; |
| 31 }); |
| 32 |
| 33 worker.postMessage('kickoff'); |
| 34 </script> |
| 35 </body> |
| 36 </html> |
OLD | NEW |