Index: content/test/browser_test_base.cc |
=================================================================== |
--- content/test/browser_test_base.cc (revision 0) |
+++ content/test/browser_test_base.cc (revision 0) |
@@ -0,0 +1,60 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/test/browser_test_base.h" |
+ |
+#include "base/command_line.h" |
+#include "content/common/main_function_params.h" |
+#include "net/base/mock_host_resolver.h" |
+#include "sandbox/src/dep.h" |
+ |
+#if defined(OS_MACOSX) |
+#include "base/mac/mac_util.h" |
+#include "base/system_monitor/system_monitor.h" |
+#endif |
+ |
+extern int BrowserMain(const MainFunctionParams&); |
+ |
+BrowserTestBase::BrowserTestBase() { |
+#if defined(OS_MACOSX) |
+ base::mac::SetOverrideAmIBundled(true); |
+ base::SystemMonitor::AllocateSystemIOPorts(); |
+#endif |
+} |
+ |
+BrowserTestBase::~BrowserTestBase() { |
+} |
+ |
+void BrowserTestBase::SetUp() { |
+ host_resolver_ = new net::RuleBasedHostResolverProc(NULL); |
+ |
+ // Something inside the browser does this lookup implicitly. Make it fail |
+ // to avoid external dependency. It won't break the tests. |
+ host_resolver_->AddSimulatedFailure("*.google.com"); |
jam
2011/09/29 21:21:37
do we need this in the core content code or can we
Paweł Hajdan Jr.
2011/09/29 22:55:30
Done.
|
+ |
+ // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol |
+ // We don't want the test code to use it. |
+ host_resolver_->AddSimulatedFailure("wpad"); |
+ |
+ net::ScopedDefaultHostResolverProc scoped_host_resolver_proc( |
+ host_resolver_.get()); |
+ |
+ SandboxInitWrapper sandbox_wrapper; |
+ MainFunctionParams params(*CommandLine::ForCurrentProcess(), |
+ sandbox_wrapper, |
+ NULL); |
+ params.ui_task = |
+ NewRunnableMethod(this, &BrowserTestBase::ProxyRunTestOnMainThreadLoop); |
+ |
+ SetUpInProcessBrowserTestFixture(); |
+ BrowserMain(params); |
+ TearDownInProcessBrowserTestFixture(); |
+} |
+ |
+void BrowserTestBase::TearDown() { |
+} |
+ |
+void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { |
+ RunTestOnMainThreadLoop(); |
+} |
Property changes on: content\test\browser_test_base.cc |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |