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

Side by Side Diff: chrome/browser/process_singleton_browsertest.cc

Issue 2876153002: Support Using ScopedFeatureList in BrowserTest (Closed)
Patch Set: Ilya comment addressed Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This test validates that the ProcessSingleton class properly makes sure 5 // This test validates that the ProcessSingleton class properly makes sure
6 // that there is only one main browser process. 6 // that there is only one main browser process.
7 // 7 //
8 // It is currently compiled and run on Windows and Posix(non-Mac) platforms. 8 // It is currently compiled and run on Windows and Posix(non-Mac) platforms.
9 // Mac uses system services and ProcessSingletonMac is a noop. (Maybe it still 9 // Mac uses system services and ProcessSingletonMac is a noop. (Maybe it still
10 // makes sense to test that the system services are giving the behavior we 10 // makes sense to test that the system services are giving the behavior we
(...skipping 17 matching lines...) Expand all
28 #include "base/single_thread_task_runner.h" 28 #include "base/single_thread_task_runner.h"
29 #include "base/synchronization/waitable_event.h" 29 #include "base/synchronization/waitable_event.h"
30 #include "base/test/test_timeouts.h" 30 #include "base/test/test_timeouts.h"
31 #include "base/threading/thread.h" 31 #include "base/threading/thread.h"
32 #include "build/build_config.h" 32 #include "build/build_config.h"
33 #include "chrome/common/chrome_constants.h" 33 #include "chrome/common/chrome_constants.h"
34 #include "chrome/common/chrome_paths.h" 34 #include "chrome/common/chrome_paths.h"
35 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
36 #include "chrome/test/base/in_process_browser_test.h" 36 #include "chrome/test/base/in_process_browser_test.h"
37 #include "chrome/test/base/test_launcher_utils.h" 37 #include "chrome/test/base/test_launcher_utils.h"
38 #include "content/public/common/content_switches.h"
38 39
39 namespace { 40 namespace {
40 41
41 // This is for the code that is to be ran in multiple threads at once, 42 // This is for the code that is to be ran in multiple threads at once,
42 // to stress a race condition on first process start. 43 // to stress a race condition on first process start.
43 // We use the thread safe ref counted base class so that we can use the 44 // We use the thread safe ref counted base class so that we can use the
44 // base::Bind to run the StartChrome methods in many threads. 45 // base::Bind to run the StartChrome methods in many threads.
45 class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> { 46 class ChromeStarter : public base::RefCountedThreadSafe<ChromeStarter> {
46 public: 47 public:
47 ChromeStarter(base::TimeDelta timeout, const base::FilePath& user_data_dir) 48 ChromeStarter(base::TimeDelta timeout, const base::FilePath& user_data_dir)
(...skipping 24 matching lines...) Expand all
72 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_); 73 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_);
73 74
74 if (first_run) 75 if (first_run)
75 command_line.AppendSwitch(switches::kForceFirstRun); 76 command_line.AppendSwitch(switches::kForceFirstRun);
76 else 77 else
77 command_line.AppendSwitch(switches::kNoFirstRun); 78 command_line.AppendSwitch(switches::kNoFirstRun);
78 79
79 // Add the normal test-mode switches, except for the ones we're adding 80 // Add the normal test-mode switches, except for the ones we're adding
80 // ourselves. 81 // ourselves.
81 base::CommandLine standard_switches(base::CommandLine::NO_PROGRAM); 82 base::CommandLine standard_switches(base::CommandLine::NO_PROGRAM);
83
84 // Turn off preconnects because they break the brittle python webserver;
85 // see http://crbug.com/60035.
86 command_line.AppendSwitchASCII(switches::kDisableFeatures,
87 "NetworkPrediction");
Ilya Sherman 2017/06/09 20:19:28 Is this actually necessary? I don't think this te
88
82 test_launcher_utils::PrepareBrowserCommandLineForTests(&standard_switches); 89 test_launcher_utils::PrepareBrowserCommandLineForTests(&standard_switches);
83 const base::CommandLine::SwitchMap& switch_map = 90 const base::CommandLine::SwitchMap& switch_map =
84 standard_switches.GetSwitches(); 91 standard_switches.GetSwitches();
85 for (base::CommandLine::SwitchMap::const_iterator i = switch_map.begin(); 92 for (base::CommandLine::SwitchMap::const_iterator i = switch_map.begin();
86 i != switch_map.end(); ++i) { 93 i != switch_map.end(); ++i) {
87 const std::string& switch_name = i->first; 94 const std::string& switch_name = i->first;
88 if (switch_name == switches::kUserDataDir || 95 if (switch_name == switches::kUserDataDir ||
89 switch_name == switches::kForceFirstRun || 96 switch_name == switches::kForceFirstRun ||
90 switch_name == switches::kNoFirstRun) 97 switch_name == switches::kNoFirstRun)
91 continue; 98 continue;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 // "There can be only one!" :-) 324 // "There can be only one!" :-)
318 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); 325 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size());
319 size_t last_index = pending_starters.front(); 326 size_t last_index = pending_starters.front();
320 pending_starters.clear(); 327 pending_starters.clear();
321 if (chrome_starters_[last_index]->process_.IsValid()) { 328 if (chrome_starters_[last_index]->process_.IsValid()) {
322 KillProcessTree(chrome_starters_[last_index]->process_); 329 KillProcessTree(chrome_starters_[last_index]->process_);
323 chrome_starters_[last_index]->done_event_.Wait(); 330 chrome_starters_[last_index]->done_event_.Wait();
324 } 331 }
325 } 332 }
326 } 333 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698