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 <memory> | 5 #include <memory> |
6 #include "core/dom/TaskRunnerHelper.h" | 6 #include "core/dom/TaskRunnerHelper.h" |
7 #include "core/events/MessageEvent.h" | 7 #include "core/events/MessageEvent.h" |
8 #include "core/inspector/ConsoleMessageStorage.h" | 8 #include "core/inspector/ConsoleMessageStorage.h" |
9 #include "core/testing/DummyPageHolder.h" | 9 #include "core/testing/DummyPageHolder.h" |
10 #include "core/workers/DedicatedWorkerGlobalScope.h" | 10 #include "core/workers/DedicatedWorkerGlobalScope.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 : public InProcessWorkerMessagingProxy { | 113 : public InProcessWorkerMessagingProxy { |
114 public: | 114 public: |
115 InProcessWorkerMessagingProxyForTest(ExecutionContext* execution_context) | 115 InProcessWorkerMessagingProxyForTest(ExecutionContext* execution_context) |
116 : InProcessWorkerMessagingProxy(execution_context, | 116 : InProcessWorkerMessagingProxy(execution_context, |
117 nullptr /* workerObject */, | 117 nullptr /* workerObject */, |
118 nullptr /* workerClients */) { | 118 nullptr /* workerClients */) { |
119 worker_object_proxy_ = WTF::MakeUnique<InProcessWorkerObjectProxyForTest>( | 119 worker_object_proxy_ = WTF::MakeUnique<InProcessWorkerObjectProxyForTest>( |
120 weak_ptr_factory_.CreateWeakPtr(), GetParentFrameTaskRunners()); | 120 weak_ptr_factory_.CreateWeakPtr(), GetParentFrameTaskRunners()); |
121 } | 121 } |
122 | 122 |
123 ~InProcessWorkerMessagingProxyForTest() override { | 123 ~InProcessWorkerMessagingProxyForTest() override { EXPECT_FALSE(blocking_); } |
124 EXPECT_FALSE(blocking_); | |
125 } | |
126 | 124 |
127 void StartWithSourceCode(const String& source) { | 125 void StartWithSourceCode(const String& source) { |
128 KURL script_url(kParsedURLString, "http://fake.url/"); | 126 KURL script_url(kParsedURLString, "http://fake.url/"); |
129 security_origin_ = SecurityOrigin::Create(script_url); | 127 security_origin_ = SecurityOrigin::Create(script_url); |
130 std::unique_ptr<Vector<CSPHeaderAndType>> headers = | 128 std::unique_ptr<Vector<CSPHeaderAndType>> headers = |
131 WTF::MakeUnique<Vector<CSPHeaderAndType>>(); | 129 WTF::MakeUnique<Vector<CSPHeaderAndType>>(); |
132 CSPHeaderAndType header_and_type("contentSecurityPolicy", | 130 CSPHeaderAndType header_and_type("contentSecurityPolicy", |
133 kContentSecurityPolicyHeaderTypeReport); | 131 kContentSecurityPolicyHeaderTypeReport); |
134 headers->push_back(header_and_type); | 132 headers->push_back(header_and_type); |
135 WorkerV8Settings worker_v8_settings = WorkerV8Settings::Default(); | 133 WorkerV8Settings worker_v8_settings = WorkerV8Settings::Default(); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // InProcessWorkerObjectProxyForTest::CountDeprecation. | 441 // InProcessWorkerObjectProxyForTest::CountDeprecation. |
444 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, GetWorkerThread()) | 442 TaskRunnerHelper::Get(TaskType::kUnspecedTimer, GetWorkerThread()) |
445 ->PostTask( | 443 ->PostTask( |
446 BLINK_FROM_HERE, | 444 BLINK_FROM_HERE, |
447 CrossThreadBind(&DedicatedWorkerThreadForTest::CountDeprecation, | 445 CrossThreadBind(&DedicatedWorkerThreadForTest::CountDeprecation, |
448 CrossThreadUnretained(GetWorkerThread()), kFeature2)); | 446 CrossThreadUnretained(GetWorkerThread()), kFeature2)); |
449 testing::EnterRunLoop(); | 447 testing::EnterRunLoop(); |
450 } | 448 } |
451 | 449 |
452 } // namespace blink | 450 } // namespace blink |
OLD | NEW |