OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 "content/test/browser_test_base.h" | 5 #include "content/test/browser_test_base.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "content/public/common/content_switches.h" |
9 #include "content/public/common/main_function_params.h" | 10 #include "content/public/common/main_function_params.h" |
10 #include "sandbox/win/src/dep.h" | 11 #include "sandbox/win/src/dep.h" |
11 | 12 |
12 #if defined(OS_MACOSX) | 13 #if defined(OS_MACOSX) |
13 #include "base/mac/mac_util.h" | 14 #include "base/mac/mac_util.h" |
14 #include "base/system_monitor/system_monitor.h" | 15 #include "base/system_monitor/system_monitor.h" |
15 #endif | 16 #endif |
16 | 17 |
17 extern int BrowserMain(const content::MainFunctionParams&); | 18 extern int BrowserMain(const content::MainFunctionParams&); |
18 | 19 |
19 BrowserTestBase::BrowserTestBase() { | 20 BrowserTestBase::BrowserTestBase() { |
20 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
21 base::mac::SetOverrideAmIBundled(true); | 22 base::mac::SetOverrideAmIBundled(true); |
22 base::SystemMonitor::AllocateSystemIOPorts(); | 23 base::SystemMonitor::AllocateSystemIOPorts(); |
23 #endif | 24 #endif |
24 } | 25 } |
25 | 26 |
26 BrowserTestBase::~BrowserTestBase() { | 27 BrowserTestBase::~BrowserTestBase() { |
27 } | 28 } |
28 | 29 |
29 void BrowserTestBase::SetUp() { | 30 void BrowserTestBase::SetUp() { |
30 content::MainFunctionParams params(*CommandLine::ForCurrentProcess()); | 31 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 32 |
| 33 // The tests assume that file:// URIs can freely access other file:// URIs. |
| 34 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); |
| 35 |
| 36 content::MainFunctionParams params(*command_line); |
31 params.ui_task = | 37 params.ui_task = |
32 new base::Closure( | 38 new base::Closure( |
33 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); | 39 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); |
34 | 40 |
35 SetUpInProcessBrowserTestFixture(); | 41 SetUpInProcessBrowserTestFixture(); |
36 BrowserMain(params); | 42 BrowserMain(params); |
37 TearDownInProcessBrowserTestFixture(); | 43 TearDownInProcessBrowserTestFixture(); |
38 } | 44 } |
39 | 45 |
40 void BrowserTestBase::TearDown() { | 46 void BrowserTestBase::TearDown() { |
41 } | 47 } |
42 | 48 |
43 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { | 49 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { |
44 RunTestOnMainThreadLoop(); | 50 RunTestOnMainThreadLoop(); |
45 } | 51 } |
OLD | NEW |