| 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/file_path.h" | 10 #include "base/file_path.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Before we run the browser, we have to hack the path to the exe to match | 72 // Before we run the browser, we have to hack the path to the exe to match |
| 73 // what it would be if Chrome was running, because it is used to fork renderer | 73 // what it would be if Chrome was running, because it is used to fork renderer |
| 74 // processes, on Linux at least (failure to do so will cause a browser_test to | 74 // processes, on Linux at least (failure to do so will cause a browser_test to |
| 75 // be run instead of a renderer). | 75 // be run instead of a renderer). |
| 76 FilePath chrome_path; | 76 FilePath chrome_path; |
| 77 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 77 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
| 78 chrome_path = chrome_path.DirName(); | 78 chrome_path = chrome_path.DirName(); |
| 79 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 79 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); |
| 80 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); | 80 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); |
| 81 #endif // defined(OS_MACOSX) | 81 #endif // defined(OS_MACOSX) |
| 82 CreateTestServer("chrome/test/data"); | 82 CreateTestServer(FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 83 } | 83 } |
| 84 | 84 |
| 85 InProcessBrowserTest::~InProcessBrowserTest() { | 85 InProcessBrowserTest::~InProcessBrowserTest() { |
| 86 } | 86 } |
| 87 | 87 |
| 88 void InProcessBrowserTest::SetUp() { | 88 void InProcessBrowserTest::SetUp() { |
| 89 // Undo TestingBrowserProcess creation in ChromeTestSuite. | 89 // Undo TestingBrowserProcess creation in ChromeTestSuite. |
| 90 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. | 90 // TODO(phajdan.jr): Extract a smaller test suite so we don't need this. |
| 91 DCHECK(g_browser_process); | 91 DCHECK(g_browser_process); |
| 92 delete g_browser_process; | 92 delete g_browser_process; |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 // On the Mac, this eventually reaches | 371 // On the Mac, this eventually reaches |
| 372 // -[BrowserWindowController windowWillClose:], which will post a deferred | 372 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 373 // -autorelease on itself to ultimately destroy the Browser object. The line | 373 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 374 // below is necessary to pump these pending messages to ensure all Browsers | 374 // below is necessary to pump these pending messages to ensure all Browsers |
| 375 // get deleted. | 375 // get deleted. |
| 376 content::RunAllPendingInMessageLoop(); | 376 content::RunAllPendingInMessageLoop(); |
| 377 delete autorelease_pool_; | 377 delete autorelease_pool_; |
| 378 autorelease_pool_ = NULL; | 378 autorelease_pool_ = NULL; |
| 379 #endif | 379 #endif |
| 380 } | 380 } |
| OLD | NEW |