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

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

Issue 1848523002: Changes to support using base/feature_list.h from gin/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 8 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 | « content/ppapi_plugin/ppapi_plugin_main.cc ('k') | content/utility/utility_main.cc » ('j') | 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/feature_list.h"
7 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "base/path_service.h" 12 #include "base/path_service.h"
12 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "base/thread_task_runner_handle.h" 15 #include "base/thread_task_runner_handle.h"
15 #include "base/threading/platform_thread.h" 16 #include "base/threading/platform_thread.h"
16 #include "build/build_config.h" 17 #include "build/build_config.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // create their own thread bundles or message loops, and doing the same in 111 // create their own thread bundles or message loops, and doing the same in
111 // TestBlinkWebUnitTestSupport would introduce a conflict. 112 // TestBlinkWebUnitTestSupport would introduce a conflict.
112 dummy_task_runner = make_scoped_refptr(new DummyTaskRunner()); 113 dummy_task_runner = make_scoped_refptr(new DummyTaskRunner());
113 dummy_task_runner_handle.reset( 114 dummy_task_runner_handle.reset(
114 new base::ThreadTaskRunnerHandle(dummy_task_runner)); 115 new base::ThreadTaskRunnerHandle(dummy_task_runner));
115 } 116 }
116 renderer_scheduler_ = make_scoped_ptr(new scheduler::RendererSchedulerImpl( 117 renderer_scheduler_ = make_scoped_ptr(new scheduler::RendererSchedulerImpl(
117 scheduler::LazySchedulerMessageLoopDelegateForTests::Create())); 118 scheduler::LazySchedulerMessageLoopDelegateForTests::Create()));
118 web_thread_ = renderer_scheduler_->CreateMainThread(); 119 web_thread_ = renderer_scheduler_->CreateMainThread();
119 120
121 // Set up a FeatureList instance, so that code using that API will not hit a
122 // an error that it's not set. Cleared by ClearInstanceForTesting() below.
123 base::FeatureList::SetInstance(make_scoped_ptr(new base::FeatureList));
124
120 blink::initialize(this); 125 blink::initialize(this);
121 blink::setLayoutTestMode(true); 126 blink::setLayoutTestMode(true);
122 blink::WebRuntimeFeatures::enableApplicationCache(true); 127 blink::WebRuntimeFeatures::enableApplicationCache(true);
123 blink::WebRuntimeFeatures::enableDatabase(true); 128 blink::WebRuntimeFeatures::enableDatabase(true);
124 blink::WebRuntimeFeatures::enableNotifications(true); 129 blink::WebRuntimeFeatures::enableNotifications(true);
125 blink::WebRuntimeFeatures::enableTouch(true); 130 blink::WebRuntimeFeatures::enableTouch(true);
126 131
127 // Initialize NetworkStateNotifier. 132 // Initialize NetworkStateNotifier.
128 blink::WebNetworkStateNotifier::setWebConnection( 133 blink::WebNetworkStateNotifier::setWebConnection(
129 blink::WebConnectionType::WebConnectionTypeUnknown, 134 blink::WebConnectionType::WebConnectionTypeUnknown,
(...skipping 19 matching lines...) Expand all
149 std::string flags("--expose-gc"); 154 std::string flags("--expose-gc");
150 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 155 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
151 } 156 }
152 157
153 TestBlinkWebUnitTestSupport::~TestBlinkWebUnitTestSupport() { 158 TestBlinkWebUnitTestSupport::~TestBlinkWebUnitTestSupport() {
154 url_loader_factory_.reset(); 159 url_loader_factory_.reset();
155 mock_clipboard_.reset(); 160 mock_clipboard_.reset();
156 if (renderer_scheduler_) 161 if (renderer_scheduler_)
157 renderer_scheduler_->Shutdown(); 162 renderer_scheduler_->Shutdown();
158 blink::shutdown(); 163 blink::shutdown();
164
165 // Clear the FeatureList that was registered in the constructor.
166 base::FeatureList::ClearInstanceForTesting();
159 } 167 }
160 168
161 blink::WebBlobRegistry* TestBlinkWebUnitTestSupport::blobRegistry() { 169 blink::WebBlobRegistry* TestBlinkWebUnitTestSupport::blobRegistry() {
162 return &blob_registry_; 170 return &blob_registry_;
163 } 171 }
164 172
165 blink::WebClipboard* TestBlinkWebUnitTestSupport::clipboard() { 173 blink::WebClipboard* TestBlinkWebUnitTestSupport::clipboard() {
166 // Mock out clipboard calls so that tests don't mess 174 // Mock out clipboard calls so that tests don't mess
167 // with each other's copies/pastes when running in parallel. 175 // with each other's copies/pastes when running in parallel.
168 return mock_clipboard_.get(); 176 return mock_clipboard_.get();
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 return BlinkPlatformImpl::currentThread(); 342 return BlinkPlatformImpl::currentThread();
335 } 343 }
336 344
337 void TestBlinkWebUnitTestSupport::getPluginList( 345 void TestBlinkWebUnitTestSupport::getPluginList(
338 bool refresh, blink::WebPluginListBuilder* builder) { 346 bool refresh, blink::WebPluginListBuilder* builder) {
339 builder->addPlugin("pdf", "pdf", "pdf-files"); 347 builder->addPlugin("pdf", "pdf", "pdf-files");
340 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); 348 builder->addMediaTypeToLastPlugin("application/pdf", "pdf");
341 } 349 }
342 350
343 } // namespace content 351 } // namespace content
OLDNEW
« no previous file with comments | « content/ppapi_plugin/ppapi_plugin_main.cc ('k') | content/utility/utility_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698