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

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

Issue 2159123002: Shutdown renderer main message loop before blink::shutdown() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 4 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/renderer/render_thread_impl.cc ('k') | media/blink/run_all_unittests.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/feature_list.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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 new base::ThreadTaskRunnerHandle(dummy_task_runner)); 112 new base::ThreadTaskRunnerHandle(dummy_task_runner));
113 } 113 }
114 renderer_scheduler_ = base::WrapUnique(new scheduler::RendererSchedulerImpl( 114 renderer_scheduler_ = base::WrapUnique(new scheduler::RendererSchedulerImpl(
115 scheduler::LazySchedulerMessageLoopDelegateForTests::Create())); 115 scheduler::LazySchedulerMessageLoopDelegateForTests::Create()));
116 web_thread_ = renderer_scheduler_->CreateMainThread(); 116 web_thread_ = renderer_scheduler_->CreateMainThread();
117 117
118 // Set up a FeatureList instance, so that code using that API will not hit a 118 // Set up a FeatureList instance, so that code using that API will not hit a
119 // an error that it's not set. Cleared by ClearInstanceForTesting() below. 119 // an error that it's not set. Cleared by ClearInstanceForTesting() below.
120 base::FeatureList::SetInstance(base::WrapUnique(new base::FeatureList)); 120 base::FeatureList::SetInstance(base::WrapUnique(new base::FeatureList));
121 121
122 blink::initialize(this); 122 blink::Platform::initialize(this);
123 blink::initialize();
123 blink::setLayoutTestMode(true); 124 blink::setLayoutTestMode(true);
124 blink::WebRuntimeFeatures::enableDatabase(true); 125 blink::WebRuntimeFeatures::enableDatabase(true);
125 blink::WebRuntimeFeatures::enableNotifications(true); 126 blink::WebRuntimeFeatures::enableNotifications(true);
126 blink::WebRuntimeFeatures::enableTouch(true); 127 blink::WebRuntimeFeatures::enableTouch(true);
127 128
128 // Initialize NetworkStateNotifier. 129 // Initialize NetworkStateNotifier.
129 blink::WebNetworkStateNotifier::setWebConnection( 130 blink::WebNetworkStateNotifier::setWebConnection(
130 blink::WebConnectionType::WebConnectionTypeUnknown, 131 blink::WebConnectionType::WebConnectionTypeUnknown,
131 std::numeric_limits<double>::infinity()); 132 std::numeric_limits<double>::infinity());
132 133
(...skipping 17 matching lines...) Expand all
150 std::string flags("--expose-gc"); 151 std::string flags("--expose-gc");
151 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size())); 152 v8::V8::SetFlagsFromString(flags.c_str(), static_cast<int>(flags.size()));
152 } 153 }
153 154
154 TestBlinkWebUnitTestSupport::~TestBlinkWebUnitTestSupport() { 155 TestBlinkWebUnitTestSupport::~TestBlinkWebUnitTestSupport() {
155 url_loader_factory_.reset(); 156 url_loader_factory_.reset();
156 mock_clipboard_.reset(); 157 mock_clipboard_.reset();
157 if (renderer_scheduler_) 158 if (renderer_scheduler_)
158 renderer_scheduler_->Shutdown(); 159 renderer_scheduler_->Shutdown();
159 blink::shutdown(); 160 blink::shutdown();
161 blink::Platform::shutdown();
160 162
161 // Clear the FeatureList that was registered in the constructor. 163 // Clear the FeatureList that was registered in the constructor.
162 base::FeatureList::ClearInstanceForTesting(); 164 base::FeatureList::ClearInstanceForTesting();
163 } 165 }
164 166
165 blink::WebBlobRegistry* TestBlinkWebUnitTestSupport::blobRegistry() { 167 blink::WebBlobRegistry* TestBlinkWebUnitTestSupport::blobRegistry() {
166 return &blob_registry_; 168 return &blob_registry_;
167 } 169 }
168 170
169 blink::WebClipboard* TestBlinkWebUnitTestSupport::clipboard() { 171 blink::WebClipboard* TestBlinkWebUnitTestSupport::clipboard() {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 return BlinkPlatformImpl::currentThread(); 293 return BlinkPlatformImpl::currentThread();
292 } 294 }
293 295
294 void TestBlinkWebUnitTestSupport::getPluginList( 296 void TestBlinkWebUnitTestSupport::getPluginList(
295 bool refresh, blink::WebPluginListBuilder* builder) { 297 bool refresh, blink::WebPluginListBuilder* builder) {
296 builder->addPlugin("pdf", "pdf", "pdf-files"); 298 builder->addPlugin("pdf", "pdf", "pdf-files");
297 builder->addMediaTypeToLastPlugin("application/pdf", "pdf"); 299 builder->addMediaTypeToLastPlugin("application/pdf", "pdf");
298 } 300 }
299 301
300 } // namespace content 302 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | media/blink/run_all_unittests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698