| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "bindings/core/v8/SourceLocation.h" | 5 #include "bindings/core/v8/SourceLocation.h" |
| 6 #include "bindings/core/v8/V8CacheOptions.h" | 6 #include "bindings/core/v8/V8CacheOptions.h" |
| 7 #include "bindings/core/v8/V8GCController.h" | 7 #include "bindings/core/v8/V8GCController.h" |
| 8 #include "core/frame/csp/ContentSecurityPolicy.h" | 8 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 9 #include "core/inspector/ConsoleMessage.h" | 9 #include "core/inspector/ConsoleMessage.h" |
| 10 #include "core/workers/WorkerBackingThread.h" | 10 #include "core/workers/WorkerBackingThread.h" |
| 11 #include "core/workers/WorkerClients.h" | 11 #include "core/workers/WorkerClients.h" |
| 12 #include "core/workers/WorkerLoaderProxy.h" | 12 #include "core/workers/WorkerLoaderProxy.h" |
| 13 #include "core/workers/WorkerReportingProxy.h" | 13 #include "core/workers/WorkerReportingProxy.h" |
| 14 #include "core/workers/WorkerThread.h" | 14 #include "core/workers/WorkerThread.h" |
| 15 #include "core/workers/WorkerThreadLifecycleObserver.h" |
| 15 #include "core/workers/WorkerThreadStartupData.h" | 16 #include "core/workers/WorkerThreadStartupData.h" |
| 16 #include "platform/ThreadSafeFunctional.h" | 17 #include "platform/ThreadSafeFunctional.h" |
| 17 #include "platform/WaitableEvent.h" | 18 #include "platform/WaitableEvent.h" |
| 18 #include "platform/WebThreadSupportingGC.h" | 19 #include "platform/WebThreadSupportingGC.h" |
| 19 #include "platform/heap/Handle.h" | 20 #include "platform/heap/Handle.h" |
| 20 #include "platform/network/ContentSecurityPolicyParsers.h" | 21 #include "platform/network/ContentSecurityPolicyParsers.h" |
| 21 #include "platform/weborigin/KURL.h" | 22 #include "platform/weborigin/KURL.h" |
| 22 #include "platform/weborigin/SecurityOrigin.h" | 23 #include "platform/weborigin/SecurityOrigin.h" |
| 23 #include "public/platform/WebAddressSpace.h" | 24 #include "public/platform/WebAddressSpace.h" |
| 24 #include "testing/gmock/include/gmock/gmock.h" | 25 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 MOCK_METHOD1(reportConsoleMessage, void(ConsoleMessage*)); | 62 MOCK_METHOD1(reportConsoleMessage, void(ConsoleMessage*)); |
| 62 MOCK_METHOD1(postMessageToPageInspector, void(const String&)); | 63 MOCK_METHOD1(postMessageToPageInspector, void(const String&)); |
| 63 MOCK_METHOD0(postWorkerConsoleAgentEnabled, void()); | 64 MOCK_METHOD0(postWorkerConsoleAgentEnabled, void()); |
| 64 MOCK_METHOD1(didEvaluateWorkerScript, void(bool success)); | 65 MOCK_METHOD1(didEvaluateWorkerScript, void(bool success)); |
| 65 MOCK_METHOD1(workerGlobalScopeStarted, void(WorkerGlobalScope*)); | 66 MOCK_METHOD1(workerGlobalScopeStarted, void(WorkerGlobalScope*)); |
| 66 MOCK_METHOD0(workerGlobalScopeClosed, void()); | 67 MOCK_METHOD0(workerGlobalScopeClosed, void()); |
| 67 MOCK_METHOD0(workerThreadTerminated, void()); | 68 MOCK_METHOD0(workerThreadTerminated, void()); |
| 68 MOCK_METHOD0(willDestroyWorkerGlobalScope, void()); | 69 MOCK_METHOD0(willDestroyWorkerGlobalScope, void()); |
| 69 }; | 70 }; |
| 70 | 71 |
| 72 class MockWorkerThreadLifecycleObserver final : public GarbageCollectedFinalized
<MockWorkerThreadLifecycleObserver>, public WorkerThreadLifecycleObserver { |
| 73 USING_GARBAGE_COLLECTED_MIXIN(MockWorkerThreadLifecycleObserver); |
| 74 WTF_MAKE_NONCOPYABLE(MockWorkerThreadLifecycleObserver); |
| 75 public: |
| 76 explicit MockWorkerThreadLifecycleObserver(WorkerThreadContext* context) |
| 77 : WorkerThreadLifecycleObserver(context) { } |
| 78 |
| 79 MOCK_METHOD0(contextDestroyed, void()); |
| 80 }; |
| 81 |
| 71 class WorkerThreadForTest : public WorkerThread { | 82 class WorkerThreadForTest : public WorkerThread { |
| 72 public: | 83 public: |
| 73 WorkerThreadForTest( | 84 WorkerThreadForTest( |
| 74 WorkerLoaderProxyProvider* mockWorkerLoaderProxyProvider, | 85 WorkerLoaderProxyProvider* mockWorkerLoaderProxyProvider, |
| 75 WorkerReportingProxy& mockWorkerReportingProxy) | 86 WorkerReportingProxy& mockWorkerReportingProxy) |
| 76 : WorkerThread(WorkerLoaderProxy::create(mockWorkerLoaderProxyProvider),
mockWorkerReportingProxy) | 87 : WorkerThread(WorkerLoaderProxy::create(mockWorkerLoaderProxyProvider),
mockWorkerReportingProxy) |
| 77 , m_workerBackingThread(WorkerBackingThread::createForTest("Test thread"
)) | 88 , m_workerBackingThread(WorkerBackingThread::createForTest("Test thread"
)) |
| 78 , m_scriptLoadedEvent(adoptPtr(new WaitableEvent())) | 89 , m_scriptLoadedEvent(adoptPtr(new WaitableEvent())) |
| 79 { | 90 { |
| 80 } | 91 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 private: | 170 private: |
| 160 WorkerThreadForTest* m_thread; | 171 WorkerThreadForTest* m_thread; |
| 161 }; | 172 }; |
| 162 | 173 |
| 163 inline WorkerGlobalScope* WorkerThreadForTest::createWorkerGlobalScope(PassOwnPt
r<WorkerThreadStartupData> startupData) | 174 inline WorkerGlobalScope* WorkerThreadForTest::createWorkerGlobalScope(PassOwnPt
r<WorkerThreadStartupData> startupData) |
| 164 { | 175 { |
| 165 return new FakeWorkerGlobalScope(startupData->m_scriptURL, startupData->m_us
erAgent, this, std::move(startupData->m_starterOriginPrivilegeData), std::move(s
tartupData->m_workerClients)); | 176 return new FakeWorkerGlobalScope(startupData->m_scriptURL, startupData->m_us
erAgent, this, std::move(startupData->m_starterOriginPrivilegeData), std::move(s
tartupData->m_workerClients)); |
| 166 } | 177 } |
| 167 | 178 |
| 168 } // namespace blink | 179 } // namespace blink |
| OLD | NEW |