Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: content/test/browser_test_base.cc

Issue 8036044: Add (not yet working) content_browsertests target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/test/browser_test_base.h"
6
7 #include "base/command_line.h"
8 #include "content/common/main_function_params.h"
9 #include "net/base/mock_host_resolver.h"
10 #include "sandbox/src/dep.h"
11
12 #if defined(OS_MACOSX)
13 #include "base/mac/mac_util.h"
14 #include "base/system_monitor/system_monitor.h"
15 #endif
16
17 extern int BrowserMain(const MainFunctionParams&);
18
19 BrowserTestBase::BrowserTestBase() {
20 #if defined(OS_MACOSX)
21 base::mac::SetOverrideAmIBundled(true);
22 base::SystemMonitor::AllocateSystemIOPorts();
23 #endif
24 }
25
26 BrowserTestBase::~BrowserTestBase() {
27 }
28
29 void BrowserTestBase::SetUp() {
30 host_resolver_ = new net::RuleBasedHostResolverProc(NULL);
31
32 // Something inside the browser does this lookup implicitly. Make it fail
33 // to avoid external dependency. It won't break the tests.
34 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.
35
36 // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
37 // We don't want the test code to use it.
38 host_resolver_->AddSimulatedFailure("wpad");
39
40 net::ScopedDefaultHostResolverProc scoped_host_resolver_proc(
41 host_resolver_.get());
42
43 SandboxInitWrapper sandbox_wrapper;
44 MainFunctionParams params(*CommandLine::ForCurrentProcess(),
45 sandbox_wrapper,
46 NULL);
47 params.ui_task =
48 NewRunnableMethod(this, &BrowserTestBase::ProxyRunTestOnMainThreadLoop);
49
50 SetUpInProcessBrowserTestFixture();
51 BrowserMain(params);
52 TearDownInProcessBrowserTestFixture();
53 }
54
55 void BrowserTestBase::TearDown() {
56 }
57
58 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
59 RunTestOnMainThreadLoop();
60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698