OLD | NEW |
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 void StartChrome(base::WaitableEvent* start_event, bool first_run) { | 58 void StartChrome(base::WaitableEvent* start_event, bool first_run) { |
59 // TODO(mattm): maybe stuff should be refactored to use | 59 // TODO(mattm): maybe stuff should be refactored to use |
60 // UITest::LaunchBrowserHelper somehow? | 60 // UITest::LaunchBrowserHelper somehow? |
61 FilePath program; | 61 FilePath program; |
62 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program)); | 62 ASSERT_TRUE(PathService::Get(base::FILE_EXE, &program)); |
63 CommandLine command_line(program); | 63 CommandLine command_line(program); |
64 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_); | 64 command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir_); |
65 | 65 |
66 if (first_run) | 66 if (first_run) |
67 command_line.AppendSwitch(switches::kFirstRun); | 67 command_line.AppendSwitch(switches::kForceFirstRun); |
68 else | 68 else |
69 command_line.AppendSwitch(switches::kNoFirstRun); | 69 command_line.AppendSwitch(switches::kNoFirstRun); |
70 | 70 |
71 // Add the normal test-mode switches, except for the ones we're adding | 71 // Add the normal test-mode switches, except for the ones we're adding |
72 // ourselves. | 72 // ourselves. |
73 CommandLine standard_switches(CommandLine::NO_PROGRAM); | 73 CommandLine standard_switches(CommandLine::NO_PROGRAM); |
74 test_launcher_utils::PrepareBrowserCommandLineForTests(&standard_switches); | 74 test_launcher_utils::PrepareBrowserCommandLineForTests(&standard_switches); |
75 const CommandLine::SwitchMap& switch_map = standard_switches.GetSwitches(); | 75 const CommandLine::SwitchMap& switch_map = standard_switches.GetSwitches(); |
76 for (CommandLine::SwitchMap::const_iterator i = switch_map.begin(); | 76 for (CommandLine::SwitchMap::const_iterator i = switch_map.begin(); |
77 i != switch_map.end(); ++i) { | 77 i != switch_map.end(); ++i) { |
78 const std::string& switch_name = i->first; | 78 const std::string& switch_name = i->first; |
79 if (switch_name == switches::kUserDataDir || | 79 if (switch_name == switches::kUserDataDir || |
80 switch_name == switches::kFirstRun || | 80 switch_name == switches::kForceFirstRun || |
81 switch_name == switches::kNoFirstRun) | 81 switch_name == switches::kNoFirstRun) |
82 continue; | 82 continue; |
83 | 83 |
84 command_line.AppendSwitchNative(switch_name, i->second); | 84 command_line.AppendSwitchNative(switch_name, i->second); |
85 } | 85 } |
86 | 86 |
87 // Try to get all threads to launch the app at the same time. | 87 // Try to get all threads to launch the app at the same time. |
88 // So let the test know we are ready. | 88 // So let the test know we are ready. |
89 ready_event_.Signal(); | 89 ready_event_.Signal(); |
90 // And then wait for the test to tell us to GO! | 90 // And then wait for the test to tell us to GO! |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); | 316 ASSERT_EQ(static_cast<size_t>(1), pending_starters.size()); |
317 size_t last_index = pending_starters.front(); | 317 size_t last_index = pending_starters.front(); |
318 pending_starters.clear(); | 318 pending_starters.clear(); |
319 if (chrome_starters_[last_index]->process_handle_ != | 319 if (chrome_starters_[last_index]->process_handle_ != |
320 base::kNullProcessHandle) { | 320 base::kNullProcessHandle) { |
321 KillProcessTree(chrome_starters_[last_index]->process_handle_); | 321 KillProcessTree(chrome_starters_[last_index]->process_handle_); |
322 chrome_starters_[last_index]->done_event_.Wait(); | 322 chrome_starters_[last_index]->done_event_.Wait(); |
323 } | 323 } |
324 } | 324 } |
325 } | 325 } |
OLD | NEW |