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

Unified Diff: LayoutTests/http/tests/workers/resources/terminate-during-sync-operation.js

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/workers/terminate-during-sync-operation.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/http/tests/workers/resources/terminate-during-sync-operation.js
diff --git a/LayoutTests/http/tests/workers/terminate-during-sync-operation.html b/LayoutTests/http/tests/workers/resources/terminate-during-sync-operation.js
similarity index 55%
rename from LayoutTests/http/tests/workers/terminate-during-sync-operation.html
rename to LayoutTests/http/tests/workers/resources/terminate-during-sync-operation.js
index 8489bafcb82c7b227d535e9a4d386dc6b5d28cc3..11a9cd56b96a79e7c8fe64426ee0e9edfe4556ae 100644
--- a/LayoutTests/http/tests/workers/terminate-during-sync-operation.html
+++ b/LayoutTests/http/tests/workers/resources/terminate-during-sync-operation.js
@@ -1,36 +1,17 @@
-<html>
-<head>
-<script src='resources/worker-util.js'></script>
-<script>
var workersStarted;
var workersClosed;
-
-var testNumber = -1;
-var syncOperationTests = new Array('openDatabaseSync', 'requestFileSystemSync', 'fileSyncOperations');
-
// 30 workers seemed to cause the crash to happen frequently.
var workers = new Array(30);
-function startNextTest()
+function startWorkers(operationName)
{
- testNumber++;
- log('Waiting for all workers to exit.');
- if (testNumber >= syncOperationTests.length) {
- waitUntilWorkerThreadsExit(done)
- return;
- }
- waitUntilWorkerThreadsExit(startWorkers)
-}
-
-function startWorkers()
-{
- log('Testing interrupting: ' + syncOperationTests[testNumber]);
+ log('Testing interrupting: ' + operationName);
log('Starting workers.');
workersStarted = 0;
workersClosed = 0;
for (var i = 0; i < workers.length; ++i) {
workers[i] = new Worker('resources/sync-operations.js?arg=' + i)
- workers[i].onmessage = onWorkerStarted;
+ workers[i].onmessage = onWorkerStarted.bind(null, operationName);
}
}
@@ -38,7 +19,7 @@ function startWorkers()
// call by waiting for the worker to start and then
// telling it to do the open database call (and
// then terminate the worker).
-function onWorkerStarted()
+function onWorkerStarted(operationName)
{
workersStarted++;
log('Started worker count: ' + workersStarted);
@@ -47,7 +28,7 @@ function onWorkerStarted()
log('Running operation.');
for (var i = 0; i < workers.length; ++i)
- workers[i].postMessage(syncOperationTests[testNumber]);
+ workers[i].postMessage(operationName);
setTimeout('closeWorker()', 0);
}
@@ -60,23 +41,15 @@ function closeWorker()
if (workersClosed < workers.length)
setTimeout('closeWorker()', 3);
else
- startNextTest();
+ waitUntilWorkerThreadsExit(done)
}
-function runTest()
+function runTest(operationName)
{
log('Starting test run.');
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
- startNextTest();
+ startWorkers(operationName);
}
-</script>
-</head>
-<body onload='runTest()'>
-<p>Test that terminating the worker while it is performing synchronous file or database operations will not cause any crashes, asserts, etc.</p>
-<div id='result'>
-</div>
-</body>
-</html>
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/http/tests/workers/terminate-during-sync-operation.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698