| Index: LayoutTests/netinfo/web-worker.html
|
| diff --git a/LayoutTests/netinfo/web-worker.html b/LayoutTests/netinfo/web-worker.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fbef7b31fab03ce02b2d4749a25c9f3290bb0f59
|
| --- /dev/null
|
| +++ b/LayoutTests/netinfo/web-worker.html
|
| @@ -0,0 +1,36 @@
|
| +<html>
|
| +<head>
|
| +<script src="../resources/js-test.js"></script>
|
| +<script src="resources/netinfo_common.js"></script>
|
| +</head>
|
| +<body>
|
| +<script>
|
| +
|
| +description('Tests that web-workers have access to NetInfo.');
|
| +
|
| +var worker = new Worker("resources/web-worker.js");
|
| +
|
| +var msg_count = 0;
|
| +
|
| +worker.addEventListener('message', function(e) {
|
| + if (msg_count == 0) {
|
| + if (e.data != connection.type) {
|
| + testFailed("Worker type disagrees with main frame.");
|
| + }
|
| + internals.setNetworkConnectionInfo(newConnectionType);
|
| + } else if (msg_count == 1) {
|
| + if (e.data != newConnectionType)
|
| + testFailed("Worker switched to wrong connection type.");
|
| + internals.setNetworkConnectionInfo(initialType);
|
| + } else if (msg_count == 2) {
|
| + if (e.data != initialType)
|
| + testFailed("Worker did not revert back to initial type.");
|
| + finishJSTest();
|
| + }
|
| + msg_count += 1;
|
| +});
|
| +
|
| +worker.postMessage('kickoff');
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|