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

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

Issue 10820007: Move all the layout tests that ran under browser_tests to run under content_browsertests. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac 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
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/content_browser_test.h" 5 #include "content/test/content_browser_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/stack_trace.h" 8 #include "base/debug/stack_trace.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "content/public/browser/render_process_host.h" 13 #include "content/public/browser/render_process_host.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/public/common/url_constants.h"
15 #include "content/shell/shell.h" 16 #include "content/shell/shell.h"
17 #include "content/shell/shell_browser_context.h"
18 #include "content/shell/shell_content_browser_client.h"
16 #include "content/shell/shell_main_delegate.h" 19 #include "content/shell/shell_main_delegate.h"
17 #include "content/shell/shell_switches.h" 20 #include "content/shell/shell_switches.h"
18 #include "content/test/test_content_client.h" 21 #include "content/test/test_content_client.h"
19 22
20 #if defined(OS_MACOSX) 23 #if defined(OS_MACOSX)
21 #include "base/mac/scoped_nsautorelease_pool.h" 24 #include "base/mac/scoped_nsautorelease_pool.h"
22 #endif 25 #endif
23 26
24 namespace content { 27 namespace content {
25 28
26 ContentBrowserTest::ContentBrowserTest() { 29 ContentBrowserTest::ContentBrowserTest() {
27 #if defined(OS_MACOSX) 30 #if defined(OS_MACOSX)
28 // See comment in InProcessBrowserTest::InProcessBrowserTest(). 31 // See comment in InProcessBrowserTest::InProcessBrowserTest().
29 FilePath content_shell_path; 32 FilePath content_shell_path;
30 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); 33 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path));
31 content_shell_path = content_shell_path.DirName(); 34 content_shell_path = content_shell_path.DirName();
32 content_shell_path = content_shell_path.Append( 35 content_shell_path = content_shell_path.Append(
33 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); 36 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell"));
34 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); 37 CHECK(PathService::Override(base::FILE_EXE, content_shell_path));
35 #endif 38 #endif
39 CreateTestServer("content/test/data");
36 } 40 }
37 41
38 ContentBrowserTest::~ContentBrowserTest() { 42 ContentBrowserTest::~ContentBrowserTest() {
39 } 43 }
40 44
41 void ContentBrowserTest::SetUp() { 45 void ContentBrowserTest::SetUp() {
42 shell_main_delegate_.reset(new ShellMainDelegate); 46 shell_main_delegate_.reset(new ShellMainDelegate);
43 shell_main_delegate_->PreSandboxStartup(); 47 shell_main_delegate_->PreSandboxStartup();
44 48
45 CommandLine* command_line = CommandLine::ForCurrentProcess(); 49 CommandLine* command_line = CommandLine::ForCurrentProcess();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 #if defined(OS_MACOSX) 114 #if defined(OS_MACOSX)
111 pool.Recycle(); 115 pool.Recycle();
112 #endif 116 #endif
113 117
114 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); 118 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator());
115 !i.IsAtEnd(); i.Advance()) { 119 !i.IsAtEnd(); i.Advance()) {
116 i.GetCurrentValue()->FastShutdownIfPossible(); 120 i.GetCurrentValue()->FastShutdownIfPossible();
117 } 121 }
118 } 122 }
119 123
124 Shell* ContentBrowserTest::CreateBrowser() {
125 ShellContentBrowserClient* browser_client =
126 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser());
127 return Shell::CreateNewWindow(
128 browser_client->browser_context(),
129 GURL(chrome::kAboutBlankURL),
130 NULL,
131 MSG_ROUTING_NONE,
132 NULL);
133 }
134
135 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() {
136 ShellContentBrowserClient* browser_client =
137 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser());
138 return Shell::CreateNewWindow(
139 browser_client->off_the_record_browser_context(),
140 GURL(chrome::kAboutBlankURL),
141 NULL,
142 MSG_ROUTING_NONE,
143 NULL);
144 }
145
120 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698