Index: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp |
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp |
index 0d13f195d720cc210e194a71f8927b1815b017aa..ff81557e42cdc4de5d0bc6b1db5152c6af55c88e 100644 |
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp |
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp |
@@ -104,6 +104,7 @@ |
void TearDown() override |
{ |
m_page.reset(); |
+ CompositorWorkerThread::terminateExecution(); |
CompositorWorkerThread::clearSharedBackingThread(); |
} |
@@ -139,6 +140,7 @@ |
private: |
void executeScriptInWorker(WorkerThread* worker, WaitableEvent* waitEvent) |
{ |
+ EXPECT_GT(worker->workerBackingThread().workerScriptCount(), 0u); |
WorkerOrWorkletScriptController* scriptController = worker->workerGlobalScope()->scriptController(); |
bool evaluateResult = scriptController->evaluate(ScriptSourceCode("var counter = 0; ++counter;")); |
ASSERT_UNUSED(evaluateResult, evaluateResult); |
@@ -170,9 +172,7 @@ |
// Create the second worker and immediately destroy the first worker. |
OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker(); |
- // We don't use terminateAndWait here to avoid forcible termination. |
- firstWorker->terminate(); |
- firstWorker->waitForShutdownForTesting(); |
+ firstWorker->terminateAndWait(); |
// Wait until the second worker is initialized. Verify that the second worker is using the same |
// thread and Isolate as the first worker. |
@@ -194,18 +194,21 @@ |
{ |
// Create the first worker, wait until it is initialized, and terminate it. |
OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(); |
+ WorkerBackingThread* workerBackingThread = &compositorWorker->workerBackingThread(); |
WebThreadSupportingGC* firstThread = &compositorWorker->workerBackingThread().backingThread(); |
checkWorkerCanExecuteScript(compositorWorker.get()); |
- // We don't use terminateAndWait here to avoid forcible termination. |
- compositorWorker->terminate(); |
- compositorWorker->waitForShutdownForTesting(); |
+ ASSERT_EQ(2u, workerBackingThread->workerScriptCount()); |
+ compositorWorker->terminateAndWait(); |
+ |
+ ASSERT_EQ(1u, workerBackingThread->workerScriptCount()); |
// Create the second worker. The backing thread is same. |
compositorWorker = createCompositorWorker(); |
WebThreadSupportingGC* secondThread = &compositorWorker->workerBackingThread().backingThread(); |
EXPECT_EQ(firstThread, secondThread); |
checkWorkerCanExecuteScript(compositorWorker.get()); |
+ ASSERT_EQ(2u, workerBackingThread->workerScriptCount()); |
compositorWorker->terminateAndWait(); |
} |
@@ -220,6 +223,7 @@ |
// Request termination of the first worker and create the second worker |
// as soon as possible. |
+ EXPECT_EQ(2u, firstWorker->workerBackingThread().workerScriptCount()); |
firstWorker->terminate(); |
// We don't wait for its termination. |
// Note: We rely on the assumption that the termination steps don't run |