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

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

Issue 10837238: Move browser_test_base.h to content/public/test. I originally thought that content_browsertests wou… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « content/test/browser_test_base.h ('k') | content/test/content_browser_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/public/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 "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
11 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
12 #include "content/public/common/main_function_params.h" 12 #include "content/public/common/main_function_params.h"
13 #include "sandbox/win/src/dep.h" 13 #include "sandbox/win/src/dep.h"
14 14
15 #if defined(OS_MACOSX) 15 #if defined(OS_MACOSX)
(...skipping 15 matching lines...) Expand all
31 static int g_browser_process_pid; 31 static int g_browser_process_pid;
32 static void DumpStackTraceSignalHandler(int signal) { 32 static void DumpStackTraceSignalHandler(int signal) {
33 if (g_browser_process_pid == base::GetCurrentProcId()) 33 if (g_browser_process_pid == base::GetCurrentProcId())
34 base::debug::StackTrace().PrintBacktrace(); 34 base::debug::StackTrace().PrintBacktrace();
35 _exit(128 + signal); 35 _exit(128 + signal);
36 } 36 }
37 #endif // defined(OS_POSIX) 37 #endif // defined(OS_POSIX)
38 38
39 } // namespace 39 } // namespace
40 40
41 namespace content {
42
41 BrowserTestBase::BrowserTestBase() { 43 BrowserTestBase::BrowserTestBase() {
42 #if defined(OS_MACOSX) 44 #if defined(OS_MACOSX)
43 base::mac::SetOverrideAmIBundled(true); 45 base::mac::SetOverrideAmIBundled(true);
44 base::SystemMonitor::AllocateSystemIOPorts(); 46 base::SystemMonitor::AllocateSystemIOPorts();
45 #endif 47 #endif
46 48
47 #if defined(OS_POSIX) 49 #if defined(OS_POSIX)
48 handle_sigterm_ = true; 50 handle_sigterm_ = true;
49 #endif 51 #endif
50 } 52 }
51 53
52 BrowserTestBase::~BrowserTestBase() { 54 BrowserTestBase::~BrowserTestBase() {
53 } 55 }
54 56
55 void BrowserTestBase::SetUp() { 57 void BrowserTestBase::SetUp() {
56 CommandLine* command_line = CommandLine::ForCurrentProcess(); 58 CommandLine* command_line = CommandLine::ForCurrentProcess();
57 59
58 // The tests assume that file:// URIs can freely access other file:// URIs. 60 // The tests assume that file:// URIs can freely access other file:// URIs.
59 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles); 61 command_line->AppendSwitch(switches::kAllowFileAccessFromFiles);
60 62
61 command_line->AppendSwitch(switches::kDomAutomationController); 63 command_line->AppendSwitch(switches::kDomAutomationController);
62 64
63 content::MainFunctionParams params(*command_line); 65 MainFunctionParams params(*command_line);
64 params.ui_task = 66 params.ui_task =
65 new base::Closure( 67 new base::Closure(
66 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this)); 68 base::Bind(&BrowserTestBase::ProxyRunTestOnMainThreadLoop, this));
67 69
68 SetUpInProcessBrowserTestFixture(); 70 SetUpInProcessBrowserTestFixture();
69 BrowserMain(params); 71 BrowserMain(params);
70 TearDownInProcessBrowserTestFixture(); 72 TearDownInProcessBrowserTestFixture();
71 } 73 }
72 74
73 void BrowserTestBase::TearDown() { 75 void BrowserTestBase::TearDown() {
74 } 76 }
75 77
76 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() { 78 void BrowserTestBase::ProxyRunTestOnMainThreadLoop() {
77 #if defined(OS_POSIX) 79 #if defined(OS_POSIX)
78 if (handle_sigterm_) { 80 if (handle_sigterm_) {
79 g_browser_process_pid = base::GetCurrentProcId(); 81 g_browser_process_pid = base::GetCurrentProcId();
80 signal(SIGTERM, DumpStackTraceSignalHandler); 82 signal(SIGTERM, DumpStackTraceSignalHandler);
81 } 83 }
82 #endif // defined(OS_POSIX) 84 #endif // defined(OS_POSIX)
83 RunTestOnMainThreadLoop(); 85 RunTestOnMainThreadLoop();
84 } 86 }
85 87
86 void BrowserTestBase::CreateTestServer(const char* test_server_base) { 88 void BrowserTestBase::CreateTestServer(const char* test_server_base) {
87 CHECK(!test_server_.get()); 89 CHECK(!test_server_.get());
88 test_server_.reset(new net::TestServer( 90 test_server_.reset(new net::TestServer(
89 net::TestServer::TYPE_HTTP, 91 net::TestServer::TYPE_HTTP,
90 net::TestServer::kLocalhost, 92 net::TestServer::kLocalhost,
91 FilePath().AppendASCII(test_server_base))); 93 FilePath().AppendASCII(test_server_base)));
92 } 94 }
95
96 } // namespace content
OLDNEW
« no previous file with comments | « content/test/browser_test_base.h ('k') | content/test/content_browser_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698