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

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

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Fix tests and introduce RuntimeEnabled flag Created 3 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 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/callback.h" 7 #include "base/callback.h"
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/platform_thread.h" 17 #include "base/threading/platform_thread.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #include "build/build_config.h" 19 #include "build/build_config.h"
20 #include "cc/blink/web_layer_impl.h" 20 #include "cc/blink/web_layer_impl.h"
21 #include "cc/test/test_shared_bitmap_manager.h" 21 #include "cc/test/test_shared_bitmap_manager.h"
22 #include "cc/trees/layer_tree_settings.h" 22 #include "cc/trees/layer_tree_settings.h"
23 #include "content/app/mojo/mojo_init.h" 23 #include "content/app/mojo/mojo_init.h"
24 #include "content/child/web_url_loader_impl.h" 24 #include "content/child/web_url_loader_impl.h"
25 #include "content/test/mock_webclipboard_impl.h" 25 #include "content/test/mock_webclipboard_impl.h"
26 #include "content/test/web_gesture_curve_mock.h" 26 #include "content/test/web_gesture_curve_mock.h"
27 #include "gin/v8_initializer.h" // nogncheck
27 #include "media/base/media.h" 28 #include "media/base/media.h"
28 #include "media/media_features.h" 29 #include "media/media_features.h"
29 #include "net/cookies/cookie_monster.h" 30 #include "net/cookies/cookie_monster.h"
30 #include "third_party/WebKit/public/platform/WebConnectionType.h" 31 #include "third_party/WebKit/public/platform/WebConnectionType.h"
31 #include "third_party/WebKit/public/platform/WebData.h" 32 #include "third_party/WebKit/public/platform/WebData.h"
32 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h" 33 #include "third_party/WebKit/public/platform/WebNetworkStateNotifier.h"
33 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h" 34 #include "third_party/WebKit/public/platform/WebPluginListBuilder.h"
34 #include "third_party/WebKit/public/platform/WebString.h" 35 #include "third_party/WebKit/public/platform/WebString.h"
35 #include "third_party/WebKit/public/platform/WebThread.h" 36 #include "third_party/WebKit/public/platform/WebThread.h"
36 #include "third_party/WebKit/public/platform/WebURL.h" 37 #include "third_party/WebKit/public/platform/WebURL.h"
37 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h" 38 #include "third_party/WebKit/public/platform/scheduler/renderer/renderer_schedul er.h"
38 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t est_support.h" 39 #include "third_party/WebKit/public/platform/scheduler/test/renderer_scheduler_t est_support.h"
39 #include "third_party/WebKit/public/web/WebKit.h" 40 #include "third_party/WebKit/public/web/WebKit.h"
40 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" 41 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h"
41 #include "v8/include/v8.h" 42 #include "v8/include/v8.h"
42 43
43 #if defined(OS_MACOSX) 44 #if defined(OS_MACOSX)
44 #include "base/mac/foundation_util.h" 45 #include "base/mac/foundation_util.h"
45 #include "base/mac/scoped_nsautorelease_pool.h" 46 #include "base/mac/scoped_nsautorelease_pool.h"
46 #endif 47 #endif
47 48
48 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
49 #include "gin/v8_initializer.h" // nogncheck
50 #endif
51 49
52 #if BUILDFLAG(ENABLE_WEBRTC) 50 #if BUILDFLAG(ENABLE_WEBRTC)
53 #include "content/renderer/media/rtc_certificate.h" 51 #include "content/renderer/media/rtc_certificate.h"
54 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" 52 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h"
55 #include "third_party/webrtc/base/rtccertificate.h" // nogncheck 53 #include "third_party/webrtc/base/rtccertificate.h" // nogncheck
56 #endif 54 #endif
57 55
58 using blink::WebString; 56 using blink::WebString;
59 57
60 namespace { 58 namespace {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 base::mac::ScopedNSAutoreleasePool autorelease_pool; 96 base::mac::ScopedNSAutoreleasePool autorelease_pool;
99 #endif 97 #endif
100 98
101 url_loader_factory_ = blink::WebURLLoaderMockFactory::Create(); 99 url_loader_factory_ = blink::WebURLLoaderMockFactory::Create();
102 mock_clipboard_.reset(new MockWebClipboardImpl()); 100 mock_clipboard_.reset(new MockWebClipboardImpl());
103 101
104 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 102 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
105 gin::V8Initializer::LoadV8Snapshot(); 103 gin::V8Initializer::LoadV8Snapshot();
106 gin::V8Initializer::LoadV8Natives(); 104 gin::V8Initializer::LoadV8Natives();
107 #endif 105 #endif
106 gin::V8Initializer::LoadV8Context();
108 107
109 scoped_refptr<base::SingleThreadTaskRunner> dummy_task_runner; 108 scoped_refptr<base::SingleThreadTaskRunner> dummy_task_runner;
110 std::unique_ptr<base::ThreadTaskRunnerHandle> dummy_task_runner_handle; 109 std::unique_ptr<base::ThreadTaskRunnerHandle> dummy_task_runner_handle;
111 if (!base::ThreadTaskRunnerHandle::IsSet()) { 110 if (!base::ThreadTaskRunnerHandle::IsSet()) {
112 // Dummy task runner is initialized here because the blink::initialize 111 // Dummy task runner is initialized here because the blink::initialize
113 // creates IsolateHolder which needs the current task runner handle. There 112 // creates IsolateHolder which needs the current task runner handle. There
114 // should be no task posted to this task runner. The message loop is not 113 // should be no task posted to this task runner. The message loop is not
115 // created before this initialization because some tests need specific kinds 114 // created before this initialization because some tests need specific kinds
116 // of message loops, and their types are not known upfront. Some tests also 115 // of message loops, and their types are not known upfront. Some tests also
117 // create their own thread bundles or message loops, and doing the same in 116 // create their own thread bundles or message loops, and doing the same in
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 blink::WebRTCCertificateGenerator* 331 blink::WebRTCCertificateGenerator*
333 TestBlinkWebUnitTestSupport::CreateRTCCertificateGenerator() { 332 TestBlinkWebUnitTestSupport::CreateRTCCertificateGenerator() {
334 #if BUILDFLAG(ENABLE_WEBRTC) 333 #if BUILDFLAG(ENABLE_WEBRTC)
335 return new TestWebRTCCertificateGenerator(); 334 return new TestWebRTCCertificateGenerator();
336 #else 335 #else
337 return nullptr; 336 return nullptr;
338 #endif 337 #endif
339 } 338 }
340 339
341 } // namespace content 340 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698