| Index: third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
|
| index 3552cf927b834b91d47569669584e1f36398c09c..526bd66496bf0727509a9f669c3f913cc0e9261a 100644
|
| --- a/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
|
| +++ b/third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp
|
| @@ -44,9 +44,14 @@
|
| m_workerThread->startWithSourceCode(m_securityOrigin.get(), "while(true) {}");
|
| }
|
|
|
| + void waitForShutdown()
|
| + {
|
| + m_workerThread->m_shutdownEvent->wait();
|
| + }
|
| +
|
| void setForceTerminationDelayInMs(long long forceTerminationDelayInMs)
|
| {
|
| - m_workerThread->m_forceTerminationDelayInMs = forceTerminationDelayInMs;
|
| + m_workerThread->setForceTerminationDelayInMsForTesting(forceTerminationDelayInMs);
|
| }
|
|
|
| bool isForceTerminationTaskScheduled()
|
| @@ -99,7 +104,7 @@
|
| // gracefully shut down.
|
| m_workerThread->terminate();
|
| EXPECT_TRUE(isForceTerminationTaskScheduled());
|
| - m_workerThread->waitForShutdownForTesting();
|
| + waitForShutdown();
|
| EXPECT_EQ(WorkerThread::ExitCode::GracefullyTerminated, m_workerThread->getExitCode());
|
| }
|
|
|
| @@ -123,7 +128,7 @@
|
| // (2) If the thread has already been initialized on the worker thread,
|
| // terminate() should gracefully shut down the thread.
|
| m_workerThread->terminate();
|
| - m_workerThread->waitForShutdownForTesting();
|
| + waitForShutdown();
|
| WorkerThread::ExitCode exitCode = m_workerThread->getExitCode();
|
| EXPECT_EQ(WorkerThread::ExitCode::GracefullyTerminated, exitCode);
|
| }
|
| @@ -171,7 +176,7 @@
|
|
|
| // Wait until the force termination task runs.
|
| testing::runDelayedTasks(kForceTerminationDelayInMs);
|
| - m_workerThread->waitForShutdownForTesting();
|
| + waitForShutdown();
|
| EXPECT_EQ(WorkerThread::ExitCode::AsyncForciblyTerminated, m_workerThread->getExitCode());
|
| }
|
|
|
| @@ -196,7 +201,7 @@
|
|
|
| // Wait until the force termination task runs.
|
| testing::runDelayedTasks(kForceTerminationDelayInMs);
|
| - m_workerThread->waitForShutdownForTesting();
|
| + waitForShutdown();
|
| EXPECT_EQ(WorkerThread::ExitCode::AsyncForciblyTerminated, m_workerThread->getExitCode());
|
| }
|
|
|
| @@ -220,39 +225,6 @@
|
| EXPECT_EQ(WorkerThread::ExitCode::SyncForciblyTerminated, m_workerThread->getExitCode());
|
| }
|
|
|
| -TEST_F(WorkerThreadTest, StartAndTerminateOnScriptLoaded_TerminateWhileDebuggerTaskIsRunning)
|
| -{
|
| - expectReportingCallsForWorkerForciblyTerminated();
|
| - startWithSourceCodeNotToFinish();
|
| - m_workerThread->waitUntilScriptLoaded();
|
| -
|
| - // Simulate that a debugger task is running.
|
| - m_workerThread->m_runningDebuggerTask = true;
|
| -
|
| - // terminate() should not schedule a force termination task because there is
|
| - // a running debugger task.
|
| - m_workerThread->terminate();
|
| - EXPECT_FALSE(isForceTerminationTaskScheduled());
|
| - EXPECT_EQ(WorkerThread::ExitCode::NotTerminated, m_workerThread->getExitCode());
|
| -
|
| - // Multiple terminate() calls should not take effect.
|
| - m_workerThread->terminate();
|
| - m_workerThread->terminate();
|
| - EXPECT_FALSE(isForceTerminationTaskScheduled());
|
| - EXPECT_EQ(WorkerThread::ExitCode::NotTerminated, m_workerThread->getExitCode());
|
| -
|
| - // Focible termination request should also respect the running debugger
|
| - // task.
|
| - m_workerThread->terminateInternal(WorkerThread::TerminationMode::Forcible);
|
| - EXPECT_FALSE(isForceTerminationTaskScheduled());
|
| - EXPECT_EQ(WorkerThread::ExitCode::NotTerminated, m_workerThread->getExitCode());
|
| -
|
| - // Clean up in order to satisfy DCHECKs in dtors.
|
| - m_workerThread->m_runningDebuggerTask = false;
|
| - m_workerThread->forciblyTerminateExecution();
|
| - m_workerThread->waitForShutdownForTesting();
|
| -}
|
| -
|
| // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers.
|
|
|
| } // namespace blink
|
|
|