| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "chrome/browser/ui/browser_navigator.h" | 22 #include "chrome/browser/ui/browser_navigator.h" |
| 23 #include "chrome/browser/ui/browser_window.h" | 23 #include "chrome/browser/ui/browser_window.h" |
| 24 #include "chrome/common/chrome_constants.h" | 24 #include "chrome/common/chrome_constants.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
| 27 #include "chrome/common/logging_chrome.h" | 27 #include "chrome/common/logging_chrome.h" |
| 28 #include "chrome/common/url_constants.h" | 28 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/test/base/test_launcher_utils.h" | 29 #include "chrome/test/base/test_launcher_utils.h" |
| 30 #include "chrome/test/base/testing_browser_process.h" | 30 #include "chrome/test/base/testing_browser_process.h" |
| 31 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
| 32 #include "content/browser/renderer_host/render_process_host.h" | |
| 33 #include "content/browser/tab_contents/tab_contents.h" | 32 #include "content/browser/tab_contents/tab_contents.h" |
| 34 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
| 35 #include "content/public/browser/render_process_host.h" |
| 36 #include "content/renderer/mock_content_renderer_client.h" | 36 #include "content/renderer/mock_content_renderer_client.h" |
| 37 #include "content/test/test_browser_thread.h" | 37 #include "content/test/test_browser_thread.h" |
| 38 #include "net/base/mock_host_resolver.h" | 38 #include "net/base/mock_host_resolver.h" |
| 39 #include "net/test/test_server.h" | 39 #include "net/test/test_server.h" |
| 40 | 40 |
| 41 #if defined(OS_CHROMEOS) | 41 #if defined(OS_CHROMEOS) |
| 42 #include "chrome/browser/chromeos/audio_handler.h" | 42 #include "chrome/browser/chromeos/audio_handler.h" |
| 43 #elif defined(OS_MACOSX) | 43 #elif defined(OS_MACOSX) |
| 44 #include "base/mac/scoped_nsautorelease_pool.h" | 44 #include "base/mac/scoped_nsautorelease_pool.h" |
| 45 #endif | 45 #endif |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 100 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 101 // Allow subclasses to change the command line before running any tests. | 101 // Allow subclasses to change the command line before running any tests. |
| 102 SetUpCommandLine(command_line); | 102 SetUpCommandLine(command_line); |
| 103 // Add command line arguments that are used by all InProcessBrowserTests. | 103 // Add command line arguments that are used by all InProcessBrowserTests. |
| 104 PrepareTestCommandLine(command_line); | 104 PrepareTestCommandLine(command_line); |
| 105 | 105 |
| 106 // Single-process mode is not set in BrowserMain, so process it explicitly, | 106 // Single-process mode is not set in BrowserMain, so process it explicitly, |
| 107 // and set up renderer. | 107 // and set up renderer. |
| 108 if (command_line->HasSwitch(switches::kSingleProcess)) { | 108 if (command_line->HasSwitch(switches::kSingleProcess)) { |
| 109 RenderProcessHost::set_run_renderer_in_process(true); | 109 content::RenderProcessHost::set_run_renderer_in_process(true); |
| 110 single_process_renderer_client_.reset( | 110 single_process_renderer_client_.reset( |
| 111 new content::MockContentRendererClient); | 111 new content::MockContentRendererClient); |
| 112 content::GetContentClient()->set_renderer( | 112 content::GetContentClient()->set_renderer( |
| 113 single_process_renderer_client_.get()); | 113 single_process_renderer_client_.get()); |
| 114 } | 114 } |
| 115 | 115 |
| 116 #if defined(OS_CHROMEOS) | 116 #if defined(OS_CHROMEOS) |
| 117 // Make sure that the log directory exists. | 117 // Make sure that the log directory exists. |
| 118 FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); | 118 FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); |
| 119 file_util::CreateDirectory(log_dir); | 119 file_util::CreateDirectory(log_dir); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 if (BrowserList::size() == 0) | 324 if (BrowserList::size() == 0) |
| 325 return; | 325 return; |
| 326 | 326 |
| 327 // Invoke CloseAllBrowsersAndMayExit on a running message loop. | 327 // Invoke CloseAllBrowsersAndMayExit on a running message loop. |
| 328 // CloseAllBrowsersAndMayExit exits the message loop after everything has been | 328 // CloseAllBrowsersAndMayExit exits the message loop after everything has been |
| 329 // shut down properly. | 329 // shut down properly. |
| 330 MessageLoopForUI::current()->PostTask(FROM_HERE, | 330 MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 331 base::Bind(&BrowserList::AttemptExit)); | 331 base::Bind(&BrowserList::AttemptExit)); |
| 332 ui_test_utils::RunMessageLoop(); | 332 ui_test_utils::RunMessageLoop(); |
| 333 } | 333 } |
| OLD | NEW |