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

Side by Side Diff: content/test/test_blink_web_unit_test_support.cc

Issue 890333003: TestBlinkWebUnitTestSupport to create the scheduler on the main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/test/test_blink_web_unit_test_support.h" 5 #include "content/test/test_blink_web_unit_test_support.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Create an anonymous stats table since we don't need to share between 57 // Create an anonymous stats table since we don't need to share between
58 // processes. 58 // processes.
59 stats_table_.reset( 59 stats_table_.reset(
60 new base::StatsTable(base::StatsTable::TableIdentifier(), 20, 200)); 60 new base::StatsTable(base::StatsTable::TableIdentifier(), 20, 200));
61 base::StatsTable::set_current(stats_table_.get()); 61 base::StatsTable::set_current(stats_table_.get());
62 62
63 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 63 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
64 gin::IsolateHolder::LoadV8Snapshot(); 64 gin::IsolateHolder::LoadV8Snapshot();
65 #endif 65 #endif
66 66
67 if (base::MessageLoopProxy::current()) {
Sami 2015/02/02 14:28:33 Is this ever going to be false?
alex clarke (OOO till 29th) 2015/02/02 14:30:06 Yes. The UnitTestTestSuite uses this but (unlike b
68 renderer_scheduler_ = RendererScheduler::Create();
69 web_scheduler_.reset(new WebSchedulerImpl(renderer_scheduler_.get()));
70 }
71
67 blink::initialize(this); 72 blink::initialize(this);
68 blink::mainThreadIsolate()->SetCounterFunction( 73 blink::mainThreadIsolate()->SetCounterFunction(
69 base::StatsTable::FindLocation); 74 base::StatsTable::FindLocation);
70 blink::setLayoutTestMode(true); 75 blink::setLayoutTestMode(true);
71 blink::WebSecurityPolicy::registerURLSchemeAsLocal( 76 blink::WebSecurityPolicy::registerURLSchemeAsLocal(
72 blink::WebString::fromUTF8("test-shell-resource")); 77 blink::WebString::fromUTF8("test-shell-resource"));
73 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess( 78 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess(
74 blink::WebString::fromUTF8("test-shell-resource")); 79 blink::WebString::fromUTF8("test-shell-resource"));
75 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( 80 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(
76 blink::WebString::fromUTF8("test-shell-resource")); 81 blink::WebString::fromUTF8("test-shell-resource"));
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 return blink::WebData(buffer.data(), buffer.size()); 320 return blink::WebData(buffer.data(), buffer.size());
316 } 321 }
317 322
318 bool TestBlinkWebUnitTestSupport::getBlobItems( 323 bool TestBlinkWebUnitTestSupport::getBlobItems(
319 const blink::WebString& uuid, 324 const blink::WebString& uuid,
320 blink::WebVector<blink::WebBlobData::Item*>* items) { 325 blink::WebVector<blink::WebBlobData::Item*>* items) {
321 return blob_registry_.GetBlobItems(uuid, items); 326 return blob_registry_.GetBlobItems(uuid, items);
322 } 327 }
323 328
324 blink::WebScheduler* TestBlinkWebUnitTestSupport::scheduler() { 329 blink::WebScheduler* TestBlinkWebUnitTestSupport::scheduler() {
325 // Lazily create the WebSchedulerImpl and RendererScheduler if needed.
326 if (!web_scheduler_) {
327 if (!renderer_scheduler_)
328 renderer_scheduler_ = RendererScheduler::Create();
329 web_scheduler_.reset(new WebSchedulerImpl(renderer_scheduler_.get()));
330 }
331 return web_scheduler_.get(); 330 return web_scheduler_.get();
332 } 331 }
333 332
334 } // namespace content 333 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698