| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 180 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 181 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); | 181 Profile* profile = profile_manager->GetDefaultProfile(user_data_dir); |
| 182 if (!profile) { | 182 if (!profile) { |
| 183 // We should only be able to get here if the profile already exists and | 183 // We should only be able to get here if the profile already exists and |
| 184 // has been created. | 184 // has been created. |
| 185 NOTREACHED(); | 185 NOTREACHED(); |
| 186 MessageLoopForUI::current()->Quit(); | 186 MessageLoopForUI::current()->Quit(); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 | 189 |
| 190 |
| 191 // Before we run the browser, we have to hack the path to the exe to match |
| 192 // what it would be if Chrome was running, because it is used to fork renderer |
| 193 // processes, on Linux at least (failure to do so will cause a browser_test to |
| 194 // be run instead of a renderer). |
| 195 FilePath chrome_path; |
| 196 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
| 197 chrome_path = chrome_path.DirName(); |
| 198 #if defined(OS_WIN) |
| 199 chrome_path = chrome_path.Append(chrome::kBrowserProcessExecutablePath); |
| 200 #elif defined(OS_POSIX) |
| 201 chrome_path = chrome_path.Append( |
| 202 WideToASCII(chrome::kBrowserProcessExecutablePath)); |
| 203 #endif |
| 204 CHECK(PathService::Override(base::FILE_EXE, chrome_path)); |
| 205 |
| 190 browser_ = CreateBrowser(profile); | 206 browser_ = CreateBrowser(profile); |
| 191 | 207 |
| 192 RunTestOnMainThread(); | 208 RunTestOnMainThread(); |
| 193 | 209 |
| 194 BrowserList::const_reverse_iterator browser = | 210 BrowserList::const_iterator browser = BrowserList::begin(); |
| 195 BrowserList::begin_last_active(); | 211 for (; browser != BrowserList::end(); ++browser) |
| 196 for (; browser != BrowserList::end_last_active(); ++browser) | |
| 197 (*browser)->CloseAllTabs(); | 212 (*browser)->CloseAllTabs(); |
| 198 | 213 |
| 199 // Stop the HTTP server. | 214 // Stop the HTTP server. |
| 200 http_server_ = NULL; | 215 http_server_ = NULL; |
| 201 | 216 |
| 202 MessageLoopForUI::current()->Quit(); | 217 MessageLoopForUI::current()->Quit(); |
| 203 } | 218 } |
| 204 | 219 |
| 205 void InProcessBrowserTest::ConfigureHostMapper( | 220 void InProcessBrowserTest::ConfigureHostMapper( |
| 206 net::RuleBasedHostMapper* host_mapper) { | 221 net::RuleBasedHostMapper* host_mapper) { |
| 207 host_mapper->AllowDirectLookup("*.google.com"); | 222 host_mapper->AllowDirectLookup("*.google.com"); |
| 208 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol | 223 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol |
| 209 // We don't want the test code to use it. | 224 // We don't want the test code to use it. |
| 210 host_mapper->AddSimulatedFailure("wpad"); | 225 host_mapper->AddSimulatedFailure("wpad"); |
| 211 } | 226 } |
| OLD | NEW |