| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 mac_util::SetOverrideAmIBundled(true); | 81 mac_util::SetOverrideAmIBundled(true); |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 // Before we run the browser, we have to hack the path to the exe to match | 84 // Before we run the browser, we have to hack the path to the exe to match |
| 85 // what it would be if Chrome was running, because it is used to fork renderer | 85 // what it would be if Chrome was running, because it is used to fork renderer |
| 86 // processes, on Linux at least (failure to do so will cause a browser_test to | 86 // processes, on Linux at least (failure to do so will cause a browser_test to |
| 87 // be run instead of a renderer). | 87 // be run instead of a renderer). |
| 88 FilePath chrome_path; | 88 FilePath chrome_path; |
| 89 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 89 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
| 90 chrome_path = chrome_path.DirName(); | 90 chrome_path = chrome_path.DirName(); |
| 91 #if defined(OS_WIN) | |
| 92 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 91 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); |
| 93 #elif defined(OS_POSIX) | |
| 94 chrome_path = chrome_path.Append( | |
| 95 WideToASCII(chrome::kBrowserProcessExecutablePath)); | |
| 96 #endif | |
| 97 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); | 92 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); |
| 98 | 93 |
| 99 test_server_.reset(new net::TestServer( | 94 test_server_.reset(new net::TestServer( |
| 100 net::TestServer::TYPE_HTTP, | 95 net::TestServer::TYPE_HTTP, |
| 101 FilePath(FILE_PATH_LITERAL("chrome/test/data")))); | 96 FilePath(FILE_PATH_LITERAL("chrome/test/data")))); |
| 102 } | 97 } |
| 103 | 98 |
| 104 InProcessBrowserTest::~InProcessBrowserTest() { | 99 InProcessBrowserTest::~InProcessBrowserTest() { |
| 105 } | 100 } |
| 106 | 101 |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 return; | 338 return; |
| 344 | 339 |
| 345 // Invoke CloseAllBrowsersAndExit on a running message loop. | 340 // Invoke CloseAllBrowsersAndExit on a running message loop. |
| 346 // CloseAllBrowsersAndExit exits the message loop after everything has been | 341 // CloseAllBrowsersAndExit exits the message loop after everything has been |
| 347 // shut down properly. | 342 // shut down properly. |
| 348 MessageLoopForUI::current()->PostTask( | 343 MessageLoopForUI::current()->PostTask( |
| 349 FROM_HERE, | 344 FROM_HERE, |
| 350 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); | 345 NewRunnableFunction(&BrowserList::CloseAllBrowsersAndExit)); |
| 351 ui_test_utils::RunMessageLoop(); | 346 ui_test_utils::RunMessageLoop(); |
| 352 } | 347 } |
| OLD | NEW |