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

Side by Side Diff: content/public/test/browser_test_base.cc

Issue 2876153002: Support Using ScopedFeatureList in BrowserTest (Closed)
Patch Set: fix for windows 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
« no previous file with comments | « chrome/test/base/in_process_browser_test.cc ('k') | 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/public/test/browser_test_base.h" 5 #include "content/public/test/browser_test_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 SetUpInProcessBrowserTestFixture(); 233 SetUpInProcessBrowserTestFixture();
234 234
235 // At this point, copy features to the command line, since BrowserMain will 235 // At this point, copy features to the command line, since BrowserMain will
236 // wipe out the current feature list. 236 // wipe out the current feature list.
237 std::string enabled_features; 237 std::string enabled_features;
238 std::string disabled_features; 238 std::string disabled_features;
239 if (base::FeatureList::GetInstance()) 239 if (base::FeatureList::GetInstance())
240 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features, 240 base::FeatureList::GetInstance()->GetFeatureOverrides(&enabled_features,
241 &disabled_features); 241 &disabled_features);
242 if (!enabled_features.empty()) 242 if (!enabled_features.empty())
243 command_line->AppendSwitchASCII(switches::kEnableFeatures, 243 command_line->ReplaceSwitchASCIIForTest(switches::kEnableFeatures,
244 enabled_features); 244 enabled_features);
Ilya Sherman 2017/05/16 06:43:32 Hmm, shouldn't we extend the switch, rather than r
245 if (!disabled_features.empty()) 245 if (!disabled_features.empty())
246 command_line->AppendSwitchASCII(switches::kDisableFeatures, 246 command_line->ReplaceSwitchASCIIForTest(switches::kDisableFeatures,
247 disabled_features); 247 disabled_features);
248 248
249 // Need to wipe feature list clean, since BrowserMain calls 249 // Need to wipe feature list clean, since BrowserMain calls
250 // FeatureList::SetInstance, which expects no instance to exist. 250 // FeatureList::SetInstance, which expects no instance to exist.
251 base::FeatureList::ClearInstanceForTesting(); 251 base::FeatureList::ClearInstanceForTesting();
252 252
253 base::Closure* ui_task = 253 base::Closure* ui_task =
254 new base::Closure( 254 new base::Closure(
255 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, 255 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop,
256 base::Unretained(this))); 256 base::Unretained(this)));
257 257
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 if (mojo_rules.empty()) 407 if (mojo_rules.empty())
408 return; 408 return;
409 409
410 mojom::NetworkServiceTestPtr network_service_test; 410 mojom::NetworkServiceTestPtr network_service_test;
411 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface( 411 ServiceManagerConnection::GetForProcess()->GetConnector()->BindInterface(
412 mojom::kNetworkServiceName, &network_service_test); 412 mojom::kNetworkServiceName, &network_service_test);
413 network_service_test->AddRules(std::move(mojo_rules)); 413 network_service_test->AddRules(std::move(mojo_rules));
414 } 414 }
415 415
416 } // namespace content 416 } // namespace content
OLDNEW
« no previous file with comments | « chrome/test/base/in_process_browser_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698