| 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/in_process_browser_test.h" | 5 #include "chrome/test/in_process_browser_test.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "chrome/common/logging_chrome.h" | 29 #include "chrome/common/logging_chrome.h" |
| 30 #include "chrome/common/url_constants.h" | 30 #include "chrome/common/url_constants.h" |
| 31 #include "chrome/test/test_launcher_utils.h" | 31 #include "chrome/test/test_launcher_utils.h" |
| 32 #include "chrome/test/testing_browser_process.h" | 32 #include "chrome/test/testing_browser_process.h" |
| 33 #include "chrome/test/ui_test_utils.h" | 33 #include "chrome/test/ui_test_utils.h" |
| 34 #include "content/browser/browser_thread.h" | 34 #include "content/browser/browser_thread.h" |
| 35 #include "content/browser/renderer_host/render_process_host.h" | 35 #include "content/browser/renderer_host/render_process_host.h" |
| 36 #include "content/browser/tab_contents/tab_contents.h" | 36 #include "content/browser/tab_contents/tab_contents.h" |
| 37 #include "content/common/main_function_params.h" | 37 #include "content/common/main_function_params.h" |
| 38 #include "content/common/notification_type.h" | 38 #include "content/common/notification_type.h" |
| 39 #include "content/renderer/content_renderer_client.h" | 39 #include "content/renderer/mock_content_renderer_client.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 "sandbox/src/dep.h" | 42 #include "sandbox/src/dep.h" |
| 43 | 43 |
| 44 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
| 45 #include "base/mac/mac_util.h" | 45 #include "base/mac/mac_util.h" |
| 46 #endif | 46 #endif |
| 47 | 47 |
| 48 #if defined(OS_WIN) | 48 #if defined(OS_WIN) |
| 49 #include "chrome/browser/ui/views/frame/browser_frame_win.h" | 49 #include "chrome/browser/ui/views/frame/browser_frame_win.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 125 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 126 // Allow subclasses to change the command line before running any tests. | 126 // Allow subclasses to change the command line before running any tests. |
| 127 SetUpCommandLine(command_line); | 127 SetUpCommandLine(command_line); |
| 128 // Add command line arguments that are used by all InProcessBrowserTests. | 128 // Add command line arguments that are used by all InProcessBrowserTests. |
| 129 PrepareTestCommandLine(command_line); | 129 PrepareTestCommandLine(command_line); |
| 130 | 130 |
| 131 // Single-process mode is not set in BrowserMain, so process it explicitly, | 131 // Single-process mode is not set in BrowserMain, so process it explicitly, |
| 132 // and set up renderer. | 132 // and set up renderer. |
| 133 if (command_line->HasSwitch(switches::kSingleProcess)) { | 133 if (command_line->HasSwitch(switches::kSingleProcess)) { |
| 134 RenderProcessHost::set_run_renderer_in_process(true); | 134 RenderProcessHost::set_run_renderer_in_process(true); |
| 135 single_process_renderer_client_.reset(new content::ContentRendererClient); | 135 single_process_renderer_client_.reset( |
| 136 new content::MockContentRendererClient); |
| 136 content::GetContentClient()->set_renderer( | 137 content::GetContentClient()->set_renderer( |
| 137 single_process_renderer_client_.get()); | 138 single_process_renderer_client_.get()); |
| 138 } | 139 } |
| 139 | 140 |
| 140 #if defined(OS_CHROMEOS) | 141 #if defined(OS_CHROMEOS) |
| 141 // Make sure that the log directory exists. | 142 // Make sure that the log directory exists. |
| 142 FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); | 143 FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); |
| 143 file_util::CreateDirectory(log_dir); | 144 file_util::CreateDirectory(log_dir); |
| 144 | 145 |
| 145 // Disable audio mixer as it can cause hang. | 146 // Disable audio mixer as it can cause hang. |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 return; | 351 return; |
| 351 | 352 |
| 352 // Invoke CloseAllBrowsersAndExit on a running message loop. | 353 // Invoke CloseAllBrowsersAndExit on a running message loop. |
| 353 // CloseAllBrowsersAndExit exits the message loop after everything has been | 354 // CloseAllBrowsersAndExit exits the message loop after everything has been |
| 354 // shut down properly. | 355 // shut down properly. |
| 355 MessageLoopForUI::current()->PostTask( | 356 MessageLoopForUI::current()->PostTask( |
| 356 FROM_HERE, | 357 FROM_HERE, |
| 357 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); | 358 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); |
| 358 ui_test_utils::RunMessageLoop(); | 359 ui_test_utils::RunMessageLoop(); |
| 359 } | 360 } |
| OLD | NEW |