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

Side by Side Diff: chrome/test/data/workers/many_shared_workers.html

Issue 9802025: Rewrite HTML5 workers ui_tests to browser_tests. Compared to ui_tests, browser_tests are faster, le… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to revision with blank line at end of worker-utils.js to see if this patches on bots Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head>
3 <script src="worker_utils.js"></script>
4 </head>
2 <body> 5 <body>
3 <div id=result></div> 6 <div id=result></div>
4 <script> 7 <script>
5 function log(message) 8 function log(message)
6 { 9 {
7 document.getElementById("result").innerHTML += message + "<br>"; 10 document.getElementById("result").innerHTML += message + "<br>";
8 } 11 }
9 12
10 var url = document.location.toString(); 13 var url = document.location.toString();
11 var num_workers = parseInt(url.substr(url.search("count=") + 6)); 14 var num_workers = parseInt(url.substr(url.search("count=") + 6));
12 var client_id = parseInt(url.substr(url.search("client_id=") + 10)); 15 var client_id = parseInt(url.substr(url.search("client_id=") + 10));
13 16
14 if (!num_workers) { 17 if (!num_workers) {
15 log("No count= parameter provided - test aborted"); 18 log("No count= parameter provided - test aborted");
16 } 19 }
17 20
18 for (var i = 0; i < num_workers ; ++i) { 21 for (var i = 0; i < num_workers ; ++i) {
19 createWorker(i); 22 createWorker(i);
20 } 23 }
21 24
22 var workers_created = 0; 25 var workers_created = 0;
23 function createWorker(i) { 26 function createWorker(i) {
24 var worker_id = !!client_id ? client_id * num_workers + i : i; 27 var worker_id = !!client_id ? client_id * num_workers + i : i;
25 var worker = new SharedWorker("worker_common.js?id=" + worker_id); 28 var worker = new SharedWorker("worker_common.js?id=" + worker_id);
26 worker.port.postMessage("eval num_clients"); 29 worker.port.postMessage("eval num_clients");
27 worker.port.onmessage = function(event) { 30 worker.port.onmessage = function(event) {
28 workers_created++; 31 workers_created++;
29 log("worker " + worker_id + " started - num_clients = " + event.data); 32 log("worker " + worker_id + " started - num_clients = " + event.data);
30 if (workers_created == num_workers) { 33 if (workers_created == num_workers) {
31 // created the last worker 34 // created the last worker
32 log("SUCCESS: all workers created"); 35 log("SUCCESS: all workers created");
33 document.cookie = "status=OK"; 36 onSuccess();
34 } 37 }
35 } 38 }
36 } 39 }
37 </script> 40 </script>
38 41
39 </body> 42 </body>
40 </html> 43 </html>
OLDNEW
« no previous file with comments | « chrome/test/base/ui_test_utils.cc ('k') | chrome/test/data/workers/queued_shared_worker_shutdown.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698