| 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 #include "chrome/test/base/in_process_browser_test.h" | 5 #include "chrome/test/base/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, | 169 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, |
| 170 subprocess_path); | 170 subprocess_path); |
| 171 #endif | 171 #endif |
| 172 | 172 |
| 173 // If neccessary, disable TabCloseableStateWatcher. | 173 // If neccessary, disable TabCloseableStateWatcher. |
| 174 if (!tab_closeable_state_watcher_enabled_) | 174 if (!tab_closeable_state_watcher_enabled_) |
| 175 command_line->AppendSwitch(switches::kDisableTabCloseableStateWatcher); | 175 command_line->AppendSwitch(switches::kDisableTabCloseableStateWatcher); |
| 176 | 176 |
| 177 // TODO(pkotwicz): Investigate if we can remove this switch. | 177 // TODO(pkotwicz): Investigate if we can remove this switch. |
| 178 command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests); | 178 command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests); |
| 179 |
| 180 #if defined(OS_CHROMEOS) |
| 181 // Setup a bogus device management URL, so that the cloud policy providers |
| 182 // are created. This doesn't have to be a real server. |
| 183 command_line->AppendSwitchASCII(switches::kDeviceManagementUrl, |
| 184 "http://localhost:8080/device_management"); |
| 185 command_line->AppendSwitch(switches::kEnableDevicePolicy); |
| 186 #endif |
| 179 } | 187 } |
| 180 | 188 |
| 181 bool InProcessBrowserTest::CreateUserDataDirectory() { | 189 bool InProcessBrowserTest::CreateUserDataDirectory() { |
| 182 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 190 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 183 FilePath user_data_dir = | 191 FilePath user_data_dir = |
| 184 command_line->GetSwitchValuePath(switches::kUserDataDir); | 192 command_line->GetSwitchValuePath(switches::kUserDataDir); |
| 185 if (user_data_dir.empty()) { | 193 if (user_data_dir.empty()) { |
| 186 if (temp_user_data_dir_.CreateUniqueTempDir() && | 194 if (temp_user_data_dir_.CreateUniqueTempDir() && |
| 187 temp_user_data_dir_.IsValid()) { | 195 temp_user_data_dir_.IsValid()) { |
| 188 user_data_dir = temp_user_data_dir_.path(); | 196 user_data_dir = temp_user_data_dir_.path(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 if (BrowserList::size() == 0) | 353 if (BrowserList::size() == 0) |
| 346 return; | 354 return; |
| 347 | 355 |
| 348 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 356 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 349 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 357 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 350 // shut down properly. | 358 // shut down properly. |
| 351 MessageLoopForUI::current()->PostTask(FROM_HERE, | 359 MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 352 base::Bind(&BrowserList::AttemptExit)); | 360 base::Bind(&BrowserList::AttemptExit)); |
| 353 ui_test_utils::RunMessageLoop(); | 361 ui_test_utils::RunMessageLoop(); |
| 354 } | 362 } |
| OLD | NEW |