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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/netinfo/resources/web-worker.js ('k') | LayoutTests/netinfo/web-worker-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a7e42cfa468ffb8b403161ed2a1f1be0807559d8
--- /dev/null
+++ b/LayoutTests/netinfo/web-worker.html
@@ -0,0 +1,39 @@
+<!DOCTYPE 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.');
+
+shouldBe('typeof window.internals.observeGC', '"function"',
+'this test requires window.internals');
+
+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>
« 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