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

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

Issue 959803003: web-threads: Create a single instance of WebThread for each blink thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 9 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 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"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/renderer/scheduler/renderer_scheduler.h" 14 #include "content/renderer/scheduler/renderer_scheduler.h"
15 #include "content/renderer/scheduler/web_scheduler_impl.h" 15 #include "content/renderer/scheduler/web_scheduler_impl.h"
16 #include "content/renderer/scheduler/webthread_impl_for_scheduler.h"
16 #include "content/test/mock_webclipboard_impl.h" 17 #include "content/test/mock_webclipboard_impl.h"
17 #include "content/test/web_gesture_curve_mock.h" 18 #include "content/test/web_gesture_curve_mock.h"
18 #include "content/test/web_layer_tree_view_impl_for_testing.h" 19 #include "content/test/web_layer_tree_view_impl_for_testing.h"
19 #include "content/test/weburl_loader_mock_factory.h" 20 #include "content/test/weburl_loader_mock_factory.h"
20 #include "media/base/media.h" 21 #include "media/base/media.h"
21 #include "net/cookies/cookie_monster.h" 22 #include "net/cookies/cookie_monster.h"
22 #include "net/test/spawned_test_server/spawned_test_server.h" 23 #include "net/test/spawned_test_server/spawned_test_server.h"
23 #include "storage/browser/database/vfs_backend.h" 24 #include "storage/browser/database/vfs_backend.h"
24 #include "third_party/WebKit/public/platform/WebData.h" 25 #include "third_party/WebKit/public/platform/WebData.h"
25 #include "third_party/WebKit/public/platform/WebFileSystem.h" 26 #include "third_party/WebKit/public/platform/WebFileSystem.h"
(...skipping 27 matching lines...) Expand all
53 url_loader_factory_.reset(new WebURLLoaderMockFactory()); 54 url_loader_factory_.reset(new WebURLLoaderMockFactory());
54 mock_clipboard_.reset(new MockWebClipboardImpl()); 55 mock_clipboard_.reset(new MockWebClipboardImpl());
55 56
56 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 57 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
57 gin::IsolateHolder::LoadV8Snapshot(); 58 gin::IsolateHolder::LoadV8Snapshot();
58 #endif 59 #endif
59 60
60 if (base::MessageLoopProxy::current()) { 61 if (base::MessageLoopProxy::current()) {
61 renderer_scheduler_ = RendererScheduler::Create(); 62 renderer_scheduler_ = RendererScheduler::Create();
62 web_scheduler_.reset(new WebSchedulerImpl(renderer_scheduler_.get())); 63 web_scheduler_.reset(new WebSchedulerImpl(renderer_scheduler_.get()));
64 web_thread_.reset(new WebThreadImplForScheduler(renderer_scheduler_.get()));
63 } 65 }
64 66
65 blink::initialize(this); 67 blink::initialize(this);
66 blink::setLayoutTestMode(true); 68 blink::setLayoutTestMode(true);
67 blink::WebSecurityPolicy::registerURLSchemeAsLocal( 69 blink::WebSecurityPolicy::registerURLSchemeAsLocal(
68 blink::WebString::fromUTF8("test-shell-resource")); 70 blink::WebString::fromUTF8("test-shell-resource"));
69 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess( 71 blink::WebSecurityPolicy::registerURLSchemeAsNoAccess(
70 blink::WebString::fromUTF8("test-shell-resource")); 72 blink::WebString::fromUTF8("test-shell-resource"));
71 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated( 73 blink::WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(
72 blink::WebString::fromUTF8("test-shell-resource")); 74 blink::WebString::fromUTF8("test-shell-resource"));
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 bool TestBlinkWebUnitTestSupport::getBlobItems( 314 bool TestBlinkWebUnitTestSupport::getBlobItems(
313 const blink::WebString& uuid, 315 const blink::WebString& uuid,
314 blink::WebVector<blink::WebBlobData::Item*>* items) { 316 blink::WebVector<blink::WebBlobData::Item*>* items) {
315 return blob_registry_.GetBlobItems(uuid, items); 317 return blob_registry_.GetBlobItems(uuid, items);
316 } 318 }
317 319
318 blink::WebScheduler* TestBlinkWebUnitTestSupport::scheduler() { 320 blink::WebScheduler* TestBlinkWebUnitTestSupport::scheduler() {
319 return web_scheduler_.get(); 321 return web_scheduler_.get();
320 } 322 }
321 323
324 blink::WebThread* TestBlinkWebUnitTestSupport::currentThread() {
Sami 2015/03/02 11:40:02 I'm wondering if we should just register web_threa
sadrul 2015/03/02 16:53:21 From our earlier discussion (https://codereview.ch
Sami 2015/03/02 17:25:06 Interesting. Maybe that code should be migrated to
325 if (web_thread_ && web_thread_->isCurrentThread())
326 return web_thread_.get();
327 return BlinkPlatformImpl::currentThread();
328 }
329
322 } // namespace content 330 } // namespace content
OLDNEW
« content/child/blink_platform_impl.cc ('K') | « content/test/test_blink_web_unit_test_support.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698