| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/workers/WorkerThread.h" | 5 #include "core/workers/WorkerThread.h" |
| 6 | 6 |
| 7 #include "core/workers/WorkerThreadTestHelper.h" | 7 #include "core/workers/WorkerThreadTestHelper.h" |
| 8 #include "platform/testing/UnitTestHelpers.h" | 8 #include "platform/testing/UnitTestHelpers.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 "fake user agent", | 179 "fake user agent", |
| 180 "//fake source code", | 180 "//fake source code", |
| 181 nullptr, /* cachedMetaData */ | 181 nullptr, /* cachedMetaData */ |
| 182 PauseWorkerGlobalScopeOnStart, | 182 PauseWorkerGlobalScopeOnStart, |
| 183 headers.get(), | 183 headers.get(), |
| 184 "", | 184 "", |
| 185 m_securityOrigin.get(), | 185 m_securityOrigin.get(), |
| 186 nullptr, /* workerClients */ | 186 nullptr, /* workerClients */ |
| 187 WebAddressSpaceLocal, | 187 WebAddressSpaceLocal, |
| 188 nullptr /* originTrialToken */, | 188 nullptr /* originTrialToken */, |
| 189 nullptr /* WorkerSettings */, |
| 189 V8CacheOptionsDefault); | 190 V8CacheOptionsDefault); |
| 190 m_workerThread->start(std::move(startupData)); | 191 m_workerThread->start(std::move(startupData)); |
| 191 | 192 |
| 192 m_workerThread->appendDebuggerTask(crossThreadBind(&waitForTermination, cros
sThreadUnretained(m_workerThread.get()))); | 193 m_workerThread->appendDebuggerTask(crossThreadBind(&waitForTermination, cros
sThreadUnretained(m_workerThread.get()))); |
| 193 | 194 |
| 194 // Wait for the debugger task. | 195 // Wait for the debugger task. |
| 195 testing::enterRunLoop(); | 196 testing::enterRunLoop(); |
| 196 | 197 |
| 197 // Start termination while the debugger task is running. | 198 // Start termination while the debugger task is running. |
| 198 EXPECT_TRUE(m_workerThread->m_runningDebuggerTask); | 199 EXPECT_TRUE(m_workerThread->m_runningDebuggerTask); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 306 |
| 306 // Clean up in order to satisfy DCHECKs in dtors. | 307 // Clean up in order to satisfy DCHECKs in dtors. |
| 307 m_workerThread->m_runningDebuggerTask = false; | 308 m_workerThread->m_runningDebuggerTask = false; |
| 308 m_workerThread->forciblyTerminateExecution(); | 309 m_workerThread->forciblyTerminateExecution(); |
| 309 m_workerThread->waitForShutdownForTesting(); | 310 m_workerThread->waitForShutdownForTesting(); |
| 310 } | 311 } |
| 311 | 312 |
| 312 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers. | 313 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers. |
| 313 | 314 |
| 314 } // namespace blink | 315 } // namespace blink |
| OLD | NEW |