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

Side by Side Diff: LayoutTests/netinfo/web-worker.html

Issue 299883004: Adds WebWorker support to NetInfo v3. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@netinfo3
Patch Set: Regolding webexposed/ layout tests Created 6 years, 6 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
(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 web-workers have access to NetInfo.');
10
11 shouldBe('typeof window.internals.observeGC', '"function"',
12 'this test requires window.internals');
13
14 var worker = new Worker("resources/web-worker.js");
15
16 var msg_count = 0;
17
18 worker.addEventListener('message', function(e) {
19 if (msg_count == 0) {
20 if (e.data != connection.type) {
21 testFailed("Worker type disagrees with main frame.");
22 }
23 internals.setNetworkConnectionInfo(newConnectionType);
24 } else if (msg_count == 1) {
25 if (e.data != newConnectionType)
26 testFailed("Worker switched to wrong connection type.");
27 internals.setNetworkConnectionInfo(initialType);
28 } else if (msg_count == 2) {
29 if (e.data != initialType)
30 testFailed("Worker did not revert back to initial type.");
31 finishJSTest();
32 }
33 msg_count += 1;
34 });
35
36 worker.postMessage('kickoff');
37 </script>
38 </body>
39 </html>
OLDNEW
« no previous file with comments | « LayoutTests/netinfo/resources/web-worker.js ('k') | LayoutTests/netinfo/web-worker-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698