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

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

Issue 21150006: Introduce --cancel-first-run and reduce the strength of --no-first-run. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace hardcoded --no-first-run in scripts Created 7 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 | Annotate | Revision Log
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // TODO(mattm): maybe stuff should be refactored to use 60 // TODO(mattm): maybe stuff should be refactored to use
61 // UITest::LaunchBrowserHelper somehow? 61 // UITest::LaunchBrowserHelper somehow?
62 base::FilePath program; 62 base::FilePath program;
63 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program)); 63 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program));
64 CommandLine command_line(program); 64 CommandLine command_line(program);
65 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_); 65 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_);
66 66
67 if (first_run) 67 if (first_run)
68 command_line.AppendSwitch(switches::kForceFirstRun); 68 command_line.AppendSwitch(switches::kForceFirstRun);
69 else 69 else
70 command_line.AppendSwitch(switches::kNoFirstRun); 70 command_line.AppendSwitch(switches::kSkipFirstRun);
71 71
72 // Add the normal test-mode switches, except for the ones we're adding 72 // Add the normal test-mode switches, except for the ones we're adding
73 // ourselves. 73 // ourselves.
74 CommandLine standard_switches(CommandLine::NO_PROGRAM); 74 CommandLine standard_switches(CommandLine::NO_PROGRAM);
75 test_launcher_utils::PrepareBrowserCommandLineForTests(&standard_switches); 75 test_launcher_utils::PrepareBrowserCommandLineForTests(&standard_switches);
76 const CommandLine::SwitchMap& switch_map = standard_switches.GetSwitches(); 76 const CommandLine::SwitchMap& switch_map = standard_switches.GetSwitches();
77 for (CommandLine::SwitchMap::const_iterator i = switch_map.begin(); 77 for (CommandLine::SwitchMap::const_iterator i = switch_map.begin();
78 i != switch_map.end(); ++i) { 78 i != switch_map.end(); ++i) {
79 const std::string& switch_name = i->first; 79 const std::string& switch_name = i->first;
80 if (switch_name == switches::kUserDataDir || 80 if (switch_name == switches::kUserDataDir ||
81 switch_name == switches::kForceFirstRun || 81 switch_name == switches::kForceFirstRun ||
82 switch_name == switches::kNoFirstRun) 82 switch_name == switches::kSkipFirstRun)
83 continue; 83 continue;
84 84
85 command_line.AppendSwitchNative(switch_name, i->second); 85 command_line.AppendSwitchNative(switch_name, i->second);
86 } 86 }
87 87
88 // Try to get all threads to launch the app at the same time. 88 // Try to get all threads to launch the app at the same time.
89 // So let the test know we are ready. 89 // So let the test know we are ready.
90 ready_event_.Signal(); 90 ready_event_.Signal();
91 // And then wait for the test to tell us to GO! 91 // And then wait for the test to tell us to GO!
92 ASSERT_NE(static_cast<base::WaitableEvent*>(NULL), start_event); 92 ASSERT_NE(static_cast<base::WaitableEvent*>(NULL), start_event);
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); 317 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size());
318 size_t last_index = pending_starters.front(); 318 size_t last_index = pending_starters.front();
319 pending_starters.clear(); 319 pending_starters.clear();
320 if (chrome_starters_[last_index]->process_handle_ != 320 if (chrome_starters_[last_index]->process_handle_ !=
321 base::kNullProcessHandle) { 321 base::kNullProcessHandle) {
322 KillProcessTree(chrome_starters_[last_index]->process_handle_); 322 KillProcessTree(chrome_starters_[last_index]->process_handle_);
323 chrome_starters_[last_index]->done_event_.Wait(); 323 chrome_starters_[last_index]->done_event_.Wait();
324 } 324 }
325 } 325 }
326 } 326 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698