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

Side by Side Diff: LayoutTests/http/tests/workers/terminate-during-sync-operation.html

Issue 293363014: Split termiante-during-sync-operation.html into three. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src='resources/worker-util.js'></script>
4 <script>
5 var workersStarted;
6 var workersClosed;
7
8 var testNumber = -1;
9 var syncOperationTests = new Array('openDatabaseSync', 'requestFileSystemSync', 'fileSyncOperations');
10
11 // 30 workers seemed to cause the crash to happen frequently.
12 var workers = new Array(30);
13
14 function startNextTest()
15 {
16 testNumber++;
17 log('Waiting for all workers to exit.');
18 if (testNumber >= syncOperationTests.length) {
19 waitUntilWorkerThreadsExit(done)
20 return;
21 }
22 waitUntilWorkerThreadsExit(startWorkers)
23 }
24
25 function startWorkers()
26 {
27 log('Testing interrupting: ' + syncOperationTests[testNumber]);
28 log('Starting workers.');
29 workersStarted = 0;
30 workersClosed = 0;
31 for (var i = 0; i < workers.length; ++i) {
32 workers[i] = new Worker('resources/sync-operations.js?arg=' + i)
33 workers[i].onmessage = onWorkerStarted;
34 }
35 }
36
37 // Do our best to try to interrupt the database open
38 // call by waiting for the worker to start and then
39 // telling it to do the open database call (and
40 // then terminate the worker).
41 function onWorkerStarted()
42 {
43 workersStarted++;
44 log('Started worker count: ' + workersStarted);
45 if (workersStarted < workers.length)
46 return;
47
48 log('Running operation.');
49 for (var i = 0; i < workers.length; ++i)
50 workers[i].postMessage(syncOperationTests[testNumber]);
51
52 setTimeout('closeWorker()', 0);
53 }
54
55 function closeWorker()
56 {
57 workers[workersClosed].terminate();
58 workersClosed++;
59 log('Closed worker count: ' + workersClosed);
60 if (workersClosed < workers.length)
61 setTimeout('closeWorker()', 3);
62 else
63 startNextTest();
64 }
65
66 function runTest()
67 {
68 log('Starting test run.');
69 if (window.testRunner) {
70 testRunner.dumpAsText();
71 testRunner.waitUntilDone();
72 }
73 startNextTest();
74 }
75 </script>
76 </head>
77 <body onload='runTest()'>
78 <p>Test that terminating the worker while it is performing synchronous file or d atabase operations will not cause any crashes, asserts, etc.</p>
79 <div id='result'>
80 </div>
81 </body>
82 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698