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 21 matching lines...) Expand all Loading... |
32 #include "chrome/test/base/testing_browser_process.h" | 32 #include "chrome/test/base/testing_browser_process.h" |
33 #include "chrome/test/base/ui_test_utils.h" | 33 #include "chrome/test/base/ui_test_utils.h" |
34 #include "content/public/browser/notification_service.h" | 34 #include "content/public/browser/notification_service.h" |
35 #include "content/public/browser/notification_types.h" | 35 #include "content/public/browser/notification_types.h" |
36 #include "content/public/browser/render_process_host.h" | 36 #include "content/public/browser/render_process_host.h" |
37 #include "content/renderer/mock_content_renderer_client.h" | 37 #include "content/renderer/mock_content_renderer_client.h" |
38 #include "content/test/test_browser_thread.h" | 38 #include "content/test/test_browser_thread.h" |
39 #include "content/test/test_launcher.h" | 39 #include "content/test/test_launcher.h" |
40 #include "net/base/mock_host_resolver.h" | 40 #include "net/base/mock_host_resolver.h" |
41 #include "net/test/test_server.h" | 41 #include "net/test/test_server.h" |
| 42 #include "ui/gfx/compositor/compositor_switches.h" |
42 | 43 |
43 #if defined(OS_CHROMEOS) | 44 #if defined(OS_CHROMEOS) |
44 #include "chrome/browser/chromeos/audio/audio_handler.h" | 45 #include "chrome/browser/chromeos/audio/audio_handler.h" |
45 #elif defined(OS_MACOSX) | 46 #elif defined(OS_MACOSX) |
46 #include "base/mac/scoped_nsautorelease_pool.h" | 47 #include "base/mac/scoped_nsautorelease_pool.h" |
47 #endif | 48 #endif |
48 | 49 |
49 namespace { | 50 namespace { |
50 | 51 |
51 // Passed as value of kTestType. | 52 // Passed as value of kTestType. |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 281 } |
281 | 282 |
282 #if !defined(OS_MACOSX) | 283 #if !defined(OS_MACOSX) |
283 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { | 284 CommandLine InProcessBrowserTest::GetCommandLineForRelaunch() { |
284 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); | 285 CommandLine new_command_line(CommandLine::ForCurrentProcess()->GetProgram()); |
285 CommandLine::SwitchMap switches = | 286 CommandLine::SwitchMap switches = |
286 CommandLine::ForCurrentProcess()->GetSwitches(); | 287 CommandLine::ForCurrentProcess()->GetSwitches(); |
287 switches.erase(switches::kUserDataDir); | 288 switches.erase(switches::kUserDataDir); |
288 switches.erase(test_launcher::kSingleProcessTestsFlag); | 289 switches.erase(test_launcher::kSingleProcessTestsFlag); |
289 switches.erase(test_launcher::kSingleProcessTestsAndChromeFlag); | 290 switches.erase(test_launcher::kSingleProcessTestsAndChromeFlag); |
290 switches.erase(test_launcher::kSingleProcessTestsFlag); | |
291 new_command_line.AppendSwitch(ChromeTestSuite::kLaunchAsBrowser); | 291 new_command_line.AppendSwitch(ChromeTestSuite::kLaunchAsBrowser); |
292 | 292 |
| 293 #if defined(USE_AURA) |
| 294 // Copy what UITestBase::SetLaunchSwitches() does, and also what |
| 295 // ChromeTestSuite does if the process had went into the test path. Otherwise |
| 296 // tests will fail on bots. |
| 297 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 298 switches::kDisableTestCompositor)) { |
| 299 new_command_line.AppendSwitch(switches::kTestCompositor); |
| 300 } |
| 301 #endif |
| 302 |
293 FilePath user_data_dir; | 303 FilePath user_data_dir; |
294 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); | 304 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); |
295 new_command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); | 305 new_command_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); |
296 | 306 |
297 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); | 307 for (CommandLine::SwitchMap::const_iterator iter = switches.begin(); |
298 iter != switches.end(); ++iter) { | 308 iter != switches.end(); ++iter) { |
299 new_command_line.AppendSwitchNative((*iter).first, (*iter).second); | 309 new_command_line.AppendSwitchNative((*iter).first, (*iter).second); |
300 } | 310 } |
301 return new_command_line; | 311 return new_command_line; |
302 } | 312 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 if (BrowserList::size() == 0) | 387 if (BrowserList::size() == 0) |
378 return; | 388 return; |
379 | 389 |
380 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 390 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
381 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 391 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
382 // shut down properly. | 392 // shut down properly. |
383 MessageLoopForUI::current()->PostTask(FROM_HERE, | 393 MessageLoopForUI::current()->PostTask(FROM_HERE, |
384 base::Bind(&BrowserList::AttemptExit)); | 394 base::Bind(&BrowserList::AttemptExit)); |
385 ui_test_utils::RunMessageLoop(); | 395 ui_test_utils::RunMessageLoop(); |
386 } | 396 } |
OLD | NEW |