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_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/browser/browser.h" | 10 #include "chrome/browser/browser.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 command_line->AppendSwitchWithValue(switches::kRendererPath, renderer_path); | 118 command_line->AppendSwitchWithValue(switches::kRendererPath, renderer_path); |
119 | 119 |
120 sandbox::SandboxInterfaceInfo sandbox_info = {0}; | 120 sandbox::SandboxInterfaceInfo sandbox_info = {0}; |
121 SandboxInitWrapper sandbox_wrapper; | 121 SandboxInitWrapper sandbox_wrapper; |
122 MainFunctionParams params(*command_line, sandbox_wrapper, NULL); | 122 MainFunctionParams params(*command_line, sandbox_wrapper, NULL); |
123 params.ui_task = | 123 params.ui_task = |
124 NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop); | 124 NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop); |
125 | 125 |
126 scoped_refptr<net::RuleBasedHostMapper> host_mapper( | 126 scoped_refptr<net::RuleBasedHostMapper> host_mapper( |
127 new net::RuleBasedHostMapper()); | 127 new net::RuleBasedHostMapper()); |
128 // TODO(sky): Don't make a real dns lookup here or simulate a failing | 128 ConfigureHostMapper(host_mapper.get()); |
129 // lookup. | |
130 host_mapper->AllowDirectLookup("*.google.com"); | |
131 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol | |
132 // We don't want the test code to use it. | |
133 host_mapper->AddSimulatedFailure("wpad"); | |
134 net::ScopedHostMapper scoped_host_mapper(host_mapper.get()); | 129 net::ScopedHostMapper scoped_host_mapper(host_mapper.get()); |
135 BrowserMain(params); | 130 BrowserMain(params); |
136 } | 131 } |
137 | 132 |
138 void InProcessBrowserTest::TearDown() { | 133 void InProcessBrowserTest::TearDown() { |
139 // Reinstall testing browser process. | 134 // Reinstall testing browser process. |
140 delete g_browser_process; | 135 delete g_browser_process; |
141 g_browser_process = new TestingBrowserProcess(); | 136 g_browser_process = new TestingBrowserProcess(); |
142 | 137 |
143 browser_shutdown::delete_resources_on_shutdown = true; | 138 browser_shutdown::delete_resources_on_shutdown = true; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 209 |
215 // Remove all registered notifications, otherwise by the time the | 210 // Remove all registered notifications, otherwise by the time the |
216 // destructor is run the NotificationService is dead. | 211 // destructor is run the NotificationService is dead. |
217 registrar_.RemoveAll(); | 212 registrar_.RemoveAll(); |
218 | 213 |
219 // Stop the HTTP server. | 214 // Stop the HTTP server. |
220 http_server_ = NULL; | 215 http_server_ = NULL; |
221 | 216 |
222 MessageLoopForUI::current()->Quit(); | 217 MessageLoopForUI::current()->Quit(); |
223 } | 218 } |
| 219 |
| 220 void InProcessBrowserTest::ConfigureHostMapper( |
| 221 net::RuleBasedHostMapper* host_mapper) { |
| 222 host_mapper->AllowDirectLookup("*.google.com"); |
| 223 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol |
| 224 // We don't want the test code to use it. |
| 225 host_mapper->AddSimulatedFailure("wpad"); |
| 226 } |
OLD | NEW |