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/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/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 54 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
55 command_line->AppendSwitch(switches::kContentBrowserTest); | 55 command_line->AppendSwitch(switches::kContentBrowserTest); |
56 | 56 |
57 SetUpCommandLine(command_line); | 57 SetUpCommandLine(command_line); |
58 | 58 |
59 // Single-process mode is not set in BrowserMain, so process it explicitly, | 59 // Single-process mode is not set in BrowserMain, so process it explicitly, |
60 // and set up renderer. | 60 // and set up renderer. |
61 if (command_line->HasSwitch(switches::kSingleProcess)) { | 61 if (command_line->HasSwitch(switches::kSingleProcess)) { |
62 single_process_renderer_client_.reset(new ShellContentRendererClient); | 62 single_process_renderer_client_.reset(new ShellContentRendererClient); |
63 GetContentClient()->set_renderer_for_testing( | 63 SetRendererClientForTesting(single_process_renderer_client_.get()); |
64 single_process_renderer_client_.get()); | |
65 } | 64 } |
66 | 65 |
67 #if defined(OS_MACOSX) | 66 #if defined(OS_MACOSX) |
68 // See InProcessBrowserTest::PrepareTestCommandLine(). | 67 // See InProcessBrowserTest::PrepareTestCommandLine(). |
69 base::FilePath subprocess_path; | 68 base::FilePath subprocess_path; |
70 PathService::Get(base::FILE_EXE, &subprocess_path); | 69 PathService::Get(base::FILE_EXE, &subprocess_path); |
71 subprocess_path = subprocess_path.DirName().DirName(); | 70 subprocess_path = subprocess_path.DirName().DirName(); |
72 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); | 71 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); |
73 subprocess_path = subprocess_path.Append( | 72 subprocess_path = subprocess_path.Append( |
74 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper")
; | 73 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper")
; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 123 |
125 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); | 124 for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
126 !i.IsAtEnd(); i.Advance()) { | 125 !i.IsAtEnd(); i.Advance()) { |
127 i.GetCurrentValue()->FastShutdownIfPossible(); | 126 i.GetCurrentValue()->FastShutdownIfPossible(); |
128 } | 127 } |
129 | 128 |
130 Shell::CloseAllWindows(); | 129 Shell::CloseAllWindows(); |
131 } | 130 } |
132 | 131 |
133 Shell* ContentBrowserTest::CreateBrowser() { | 132 Shell* ContentBrowserTest::CreateBrowser() { |
134 ShellContentBrowserClient* browser_client = | |
135 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser()); | |
136 return Shell::CreateNewWindow( | 133 return Shell::CreateNewWindow( |
137 browser_client->browser_context(), | 134 ShellContentBrowserClient::Get()->browser_context(), |
138 GURL(chrome::kAboutBlankURL), | 135 GURL(chrome::kAboutBlankURL), |
139 NULL, | 136 NULL, |
140 MSG_ROUTING_NONE, | 137 MSG_ROUTING_NONE, |
141 gfx::Size()); | 138 gfx::Size()); |
142 } | 139 } |
143 | 140 |
144 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { | 141 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { |
145 ShellContentBrowserClient* browser_client = | |
146 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser()); | |
147 return Shell::CreateNewWindow( | 142 return Shell::CreateNewWindow( |
148 browser_client->off_the_record_browser_context(), | 143 ShellContentBrowserClient::Get()->off_the_record_browser_context(), |
149 GURL(chrome::kAboutBlankURL), | 144 GURL(chrome::kAboutBlankURL), |
150 NULL, | 145 NULL, |
151 MSG_ROUTING_NONE, | 146 MSG_ROUTING_NONE, |
152 gfx::Size()); | 147 gfx::Size()); |
153 } | 148 } |
154 | 149 |
155 } // namespace content | 150 } // namespace content |
OLD | NEW |