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

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

Issue 1828063002: Add support for origin trials in workers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@trial-token-in-header-blink-document
Patch Set: address comments Created 4 years, 7 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/inspector/ConsoleMessage.h" 9 #include "core/inspector/ConsoleMessage.h"
10 #include "core/testing/DummyPageHolder.h" 10 #include "core/testing/DummyPageHolder.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 PassOwnPtr<CompositorWorkerThread> createCompositorWorker() 96 PassOwnPtr<CompositorWorkerThread> createCompositorWorker()
97 { 97 {
98 OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::cr eate(nullptr, *m_objectProxy, 0); 98 OwnPtr<CompositorWorkerThread> workerThread = CompositorWorkerThread::cr eate(nullptr, *m_objectProxy, 0);
99 WorkerClients* clients = nullptr; 99 WorkerClients* clients = nullptr;
100 workerThread->start(WorkerThreadStartupData::create( 100 workerThread->start(WorkerThreadStartupData::create(
101 KURL(ParsedURLString, "http://fake.url/"), 101 KURL(ParsedURLString, "http://fake.url/"),
102 "fake user agent", 102 "fake user agent",
103 "//fake source code", 103 "//fake source code",
104 nullptr, 104 nullptr,
105 DontPauseWorkerGlobalScopeOnStart, 105 DontPauseWorkerGlobalScopeOnStart,
106 adoptPtr(new Vector<CSPHeaderAndType>()), 106 nullptr,
107 m_securityOrigin.get(), 107 m_securityOrigin.get(),
108 clients, 108 clients,
109 WebAddressSpaceLocal, 109 WebAddressSpaceLocal,
110 nullptr,
110 V8CacheOptionsDefault)); 111 V8CacheOptionsDefault));
111 return workerThread.release(); 112 return workerThread.release();
112 } 113 }
113 114
114 // Attempts to run some simple script for |worker|. 115 // Attempts to run some simple script for |worker|.
115 void checkWorkerCanExecuteScript(WorkerThread* worker) 116 void checkWorkerCanExecuteScript(WorkerThread* worker)
116 { 117 {
117 OwnPtr<WaitableEvent> waitEvent = adoptPtr(new WaitableEvent()); 118 OwnPtr<WaitableEvent> waitEvent = adoptPtr(new WaitableEvent());
118 worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, AllowCrossThr eadAccess(this), 119 worker->workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, AllowCrossThr eadAccess(this),
119 AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get ()))); 120 AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get ())));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 v8::Isolate* secondIsolate = secondWorker->isolate(); 218 v8::Isolate* secondIsolate = secondWorker->isolate();
218 ASSERT_TRUE(secondIsolate); 219 ASSERT_TRUE(secondIsolate);
219 EXPECT_EQ(firstIsolate, secondIsolate); 220 EXPECT_EQ(firstIsolate, secondIsolate);
220 221
221 // Verify that the isolate can run some scripts correctly in the second work er. 222 // Verify that the isolate can run some scripts correctly in the second work er.
222 checkWorkerCanExecuteScript(secondWorker.get()); 223 checkWorkerCanExecuteScript(secondWorker.get());
223 secondWorker->terminateAndWait(); 224 secondWorker->terminateAndWait();
224 } 225 }
225 226
226 } // namespace blink 227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698