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/WaitableEvent.h" | 8 #include "platform/WaitableEvent.h" |
9 #include "platform/testing/UnitTestHelpers.h" | 9 #include "platform/testing/UnitTestHelpers.h" |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 274 |
275 // Specify PauseWorkerGlobalScopeOnStart so that the worker thread can pause | 275 // Specify PauseWorkerGlobalScopeOnStart so that the worker thread can pause |
276 // on initialziation to run debugger tasks. | 276 // on initialziation to run debugger tasks. |
277 std::unique_ptr<WorkerThreadStartupData> startupData = | 277 std::unique_ptr<WorkerThreadStartupData> startupData = |
278 WorkerThreadStartupData::create( | 278 WorkerThreadStartupData::create( |
279 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", | 279 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", |
280 "//fake source code", nullptr, /* cachedMetaData */ | 280 "//fake source code", nullptr, /* cachedMetaData */ |
281 PauseWorkerGlobalScopeOnStart, headers.get(), "", | 281 PauseWorkerGlobalScopeOnStart, headers.get(), "", |
282 m_securityOrigin.get(), nullptr, /* workerClients */ | 282 m_securityOrigin.get(), nullptr, /* workerClients */ |
283 WebAddressSpaceLocal, nullptr /* originTrialToken */, | 283 WebAddressSpaceLocal, nullptr /* originTrialToken */, |
284 nullptr /* WorkerSettings */, WorkerV8Settings::Default(), | 284 nullptr /* WorkerSettings */, WorkerV8Settings::Default()); |
285 false /* inspectorNetworkCapability */); | |
286 m_workerThread->start(std::move(startupData)); | 285 m_workerThread->start(std::move(startupData)); |
287 | 286 |
288 // Used to wait for worker thread termination in a debugger task on the | 287 // Used to wait for worker thread termination in a debugger task on the |
289 // worker thread. | 288 // worker thread. |
290 WaitableEvent waitableEvent; | 289 WaitableEvent waitableEvent; |
291 m_workerThread->appendDebuggerTask(crossThreadBind( | 290 m_workerThread->appendDebuggerTask(crossThreadBind( |
292 &waitForSignalTask, crossThreadUnretained(m_workerThread.get()), | 291 &waitForSignalTask, crossThreadUnretained(m_workerThread.get()), |
293 crossThreadUnretained(&waitableEvent))); | 292 crossThreadUnretained(&waitableEvent))); |
294 | 293 |
295 // Wait for the debugger task. | 294 // Wait for the debugger task. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 | 355 |
357 // Resume the debugger task. Shutdown starts after that. | 356 // Resume the debugger task. Shutdown starts after that. |
358 waitableEvent.signal(); | 357 waitableEvent.signal(); |
359 m_workerThread->waitForShutdownForTesting(); | 358 m_workerThread->waitForShutdownForTesting(); |
360 EXPECT_EQ(ExitCode::GracefullyTerminated, getExitCode()); | 359 EXPECT_EQ(ExitCode::GracefullyTerminated, getExitCode()); |
361 } | 360 } |
362 | 361 |
363 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers. | 362 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers. |
364 | 363 |
365 } // namespace blink | 364 } // namespace blink |
OLD | NEW |