| 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 "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 #include "components/google/core/browser/google_util.h" | 52 #include "components/google/core/browser/google_util.h" |
| 53 #include "components/os_crypt/os_crypt.h" | 53 #include "components/os_crypt/os_crypt.h" |
| 54 #include "content/public/browser/devtools_agent_host.h" | 54 #include "content/public/browser/devtools_agent_host.h" |
| 55 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
| 56 #include "content/public/browser/notification_types.h" | 56 #include "content/public/browser/notification_types.h" |
| 57 #include "content/public/common/content_switches.h" | 57 #include "content/public/common/content_switches.h" |
| 58 #include "content/public/test/browser_test_utils.h" | 58 #include "content/public/test/browser_test_utils.h" |
| 59 #include "content/public/test/test_launcher.h" | 59 #include "content/public/test/test_launcher.h" |
| 60 #include "content/public/test/test_navigation_observer.h" | 60 #include "content/public/test/test_navigation_observer.h" |
| 61 #include "net/test/embedded_test_server/embedded_test_server.h" | 61 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 62 #include "net/test/spawned_test_server/spawned_test_server.h" | |
| 63 | 62 |
| 64 #if defined(OS_MACOSX) | 63 #if defined(OS_MACOSX) |
| 65 #include "base/mac/scoped_nsautorelease_pool.h" | 64 #include "base/mac/scoped_nsautorelease_pool.h" |
| 66 #include "chrome/test/base/scoped_bundle_swizzler_mac.h" | 65 #include "chrome/test/base/scoped_bundle_swizzler_mac.h" |
| 67 #endif | 66 #endif |
| 68 | 67 |
| 69 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
| 70 #include "base/win/scoped_com_initializer.h" | 69 #include "base/win/scoped_com_initializer.h" |
| 71 #include "base/win/windows_version.h" | 70 #include "base/win/windows_version.h" |
| 72 #include "ui/base/win/atl_module.h" | 71 #include "ui/base/win/atl_module.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 base::FilePath chrome_path; | 179 base::FilePath chrome_path; |
| 181 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 180 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
| 182 chrome_path = chrome_path.DirName(); | 181 chrome_path = chrome_path.DirName(); |
| 183 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); | 182 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); |
| 184 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); | 183 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); |
| 185 #endif // defined(OS_MACOSX) | 184 #endif // defined(OS_MACOSX) |
| 186 | 185 |
| 187 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | 186 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("chrome/test/data"))); |
| 188 base::FilePath src_dir; | 187 base::FilePath src_dir; |
| 189 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); | 188 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)); |
| 190 base::FilePath test_data_dir = src_dir.AppendASCII("chrome/test/data"); | |
| 191 | 189 |
| 192 // chrome::DIR_TEST_DATA isn't going to be setup until after we call | 190 // chrome::DIR_TEST_DATA isn't going to be setup until after we call |
| 193 // ContentMain. However that is after tests' constructors or SetUp methods, | 191 // ContentMain. However that is after tests' constructors or SetUp methods, |
| 194 // which sometimes need it. So just override it. | 192 // which sometimes need it. So just override it. |
| 195 CHECK(PathService::Override(chrome::DIR_TEST_DATA, test_data_dir)); | 193 CHECK(PathService::Override(chrome::DIR_TEST_DATA, |
| 194 src_dir.AppendASCII("chrome/test/data"))); |
| 196 | 195 |
| 197 #if defined(OS_MACOSX) | 196 #if defined(OS_MACOSX) |
| 198 bundle_swizzler_.reset(new ScopedBundleSwizzlerMac); | 197 bundle_swizzler_.reset(new ScopedBundleSwizzlerMac); |
| 199 #endif | 198 #endif |
| 200 } | 199 } |
| 201 | 200 |
| 202 InProcessBrowserTest::~InProcessBrowserTest() { | 201 InProcessBrowserTest::~InProcessBrowserTest() { |
| 203 } | 202 } |
| 204 | 203 |
| 205 void InProcessBrowserTest::SetUp() { | 204 void InProcessBrowserTest::SetUp() { |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 // On the Mac, this eventually reaches | 648 // On the Mac, this eventually reaches |
| 650 // -[BrowserWindowController windowWillClose:], which will post a deferred | 649 // -[BrowserWindowController windowWillClose:], which will post a deferred |
| 651 // -autorelease on itself to ultimately destroy the Browser object. The line | 650 // -autorelease on itself to ultimately destroy the Browser object. The line |
| 652 // below is necessary to pump these pending messages to ensure all Browsers | 651 // below is necessary to pump these pending messages to ensure all Browsers |
| 653 // get deleted. | 652 // get deleted. |
| 654 content::RunAllPendingInMessageLoop(); | 653 content::RunAllPendingInMessageLoop(); |
| 655 delete autorelease_pool_; | 654 delete autorelease_pool_; |
| 656 autorelease_pool_ = NULL; | 655 autorelease_pool_ = NULL; |
| 657 #endif | 656 #endif |
| 658 } | 657 } |
| OLD | NEW |