Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp

Issue 1956893003: compositor-worker: Add CompositorProxyClient worker client of CompositorWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use local root frame and remove unneeded includes. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "modules/compositorworker/CompositorWorkerThread.h" 5 #include "modules/compositorworker/CompositorWorkerThread.h"
6 6
7 #include "bindings/core/v8/ScriptSourceCode.h" 7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/V8GCController.h" 8 #include "bindings/core/v8/V8GCController.h"
9 #include "core/dom/CompositorProxyClient.h"
9 #include "core/inspector/ConsoleMessage.h" 10 #include "core/inspector/ConsoleMessage.h"
10 #include "core/testing/DummyPageHolder.h" 11 #include "core/testing/DummyPageHolder.h"
11 #include "core/workers/InProcessWorkerObjectProxy.h" 12 #include "core/workers/InProcessWorkerObjectProxy.h"
12 #include "core/workers/WorkerBackingThread.h" 13 #include "core/workers/WorkerBackingThread.h"
13 #include "core/workers/WorkerLoaderProxy.h" 14 #include "core/workers/WorkerLoaderProxy.h"
14 #include "core/workers/WorkerThreadStartupData.h" 15 #include "core/workers/WorkerThreadStartupData.h"
15 #include "platform/ThreadSafeFunctional.h" 16 #include "platform/ThreadSafeFunctional.h"
16 #include "platform/WaitableEvent.h" 17 #include "platform/WaitableEvent.h"
17 #include "platform/WebThreadSupportingGC.h" 18 #include "platform/WebThreadSupportingGC.h"
18 #include "platform/heap/Handle.h" 19 #include "platform/heap/Handle.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 private: 51 private:
51 TestCompositorWorkerObjectProxy(ExecutionContext* context) 52 TestCompositorWorkerObjectProxy(ExecutionContext* context)
52 : InProcessWorkerObjectProxy(nullptr) 53 : InProcessWorkerObjectProxy(nullptr)
53 , m_executionContext(context) 54 , m_executionContext(context)
54 { 55 {
55 } 56 }
56 57
57 Persistent<ExecutionContext> m_executionContext; 58 Persistent<ExecutionContext> m_executionContext;
58 }; 59 };
59 60
61 class TestCompositorProxyClient
62 : public GarbageCollected<TestCompositorProxyClient>
63 , public CompositorProxyClient {
64 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorProxyClient);
65 public:
66 TestCompositorProxyClient() {}
67
68 void setGlobalScope(WorkerGlobalScope*) override {}
69 void runAnimationFrameCallbacks() override {}
70 };
71
60 class CompositorWorkerTestPlatform : public TestingPlatformSupport { 72 class CompositorWorkerTestPlatform : public TestingPlatformSupport {
61 public: 73 public:
62 CompositorWorkerTestPlatform() 74 CompositorWorkerTestPlatform()
63 : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor"))) 75 : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor")))
64 { 76 {
65 } 77 }
66 78
67 WebThread* compositorThread() const override 79 WebThread* compositorThread() const override
68 { 80 {
69 return m_thread.get(); 81 return m_thread.get();
(...skipping 20 matching lines...) Expand all
90 102
91 void TearDown() override 103 void TearDown() override
92 { 104 {
93 m_page.clear(); 105 m_page.clear();
94 CompositorWorkerThread::resetSharedBackingThreadForTest(); 106 CompositorWorkerThread::resetSharedBackingThreadForTest();
95 } 107 }
96 108
97 PassOwnPtr<CompositorWorkerThread> createCompositorWorker() 109 PassOwnPtr<CompositorWorkerThread> createCompositorWorker()
98 { 110 {
99 OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::cr eate(nullptr, *m_objectProxy, 0); 111 OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::cr eate(nullptr, *m_objectProxy, 0);
100 WorkerClients* clients = nullptr; 112 WorkerClients* clients = WorkerClients::create();
113 provideCompositorProxyClientTo(clients, new TestCompositorProxyClient);
101 workerThread->start(WorkerThreadStartupData::create( 114 workerThread->start(WorkerThreadStartupData::create(
102 KURL(ParsedURLString, "http://fake.url/"), 115 KURL(ParsedURLString, "http://fake.url/"),
103 "fake user agent", 116 "fake user agent",
104 "//fake source code", 117 "//fake source code",
105 nullptr, 118 nullptr,
106 DontPauseWorkerGlobalScopeOnStart, 119 DontPauseWorkerGlobalScopeOnStart,
107 nullptr, 120 nullptr,
108 m_securityOrigin.get(), 121 m_securityOrigin.get(),
109 clients, 122 clients,
110 WebAddressSpaceLocal, 123 WebAddressSpaceLocal,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 v8::Isolate* secondIsolate = secondWorker->isolate(); 232 v8::Isolate* secondIsolate = secondWorker->isolate();
220 ASSERT_TRUE(secondIsolate); 233 ASSERT_TRUE(secondIsolate);
221 EXPECT_EQ(firstIsolate, secondIsolate); 234 EXPECT_EQ(firstIsolate, secondIsolate);
222 235
223 // Verify that the isolate can run some scripts correctly in the second work er. 236 // Verify that the isolate can run some scripts correctly in the second work er.
224 checkWorkerCanExecuteScript(secondWorker.get()); 237 checkWorkerCanExecuteScript(secondWorker.get());
225 secondWorker->terminateAndWait(); 238 secondWorker->terminateAndWait();
226 } 239 }
227 240
228 } // namespace blink 241 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698