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" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "content/public/browser/render_process_host.h" | 12 #include "content/public/browser/render_process_host.h" |
| 13 #include "content/public/common/content_paths.h" |
13 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
14 #include "content/public/common/url_constants.h" | 15 #include "content/public/common/url_constants.h" |
15 #include "content/shell/app/shell_main_delegate.h" | 16 #include "content/shell/app/shell_main_delegate.h" |
16 #include "content/shell/common/shell_switches.h" | 17 #include "content/shell/common/shell_switches.h" |
17 #include "content/shell/renderer/shell_content_renderer_client.h" | 18 #include "content/shell/renderer/shell_content_renderer_client.h" |
18 #include "content/shell/shell.h" | 19 #include "content/shell/shell.h" |
19 #include "content/shell/shell_browser_context.h" | 20 #include "content/shell/shell_browser_context.h" |
20 #include "content/shell/shell_content_browser_client.h" | 21 #include "content/shell/shell_content_browser_client.h" |
21 #include "content/test/test_content_client.h" | 22 #include "content/test/test_content_client.h" |
| 23 #include "net/test/embedded_test_server/embedded_test_server.h" |
22 | 24 |
23 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
24 #include "base/mac/scoped_nsautorelease_pool.h" | 26 #include "base/mac/scoped_nsautorelease_pool.h" |
25 #endif | 27 #endif |
26 | 28 |
27 namespace content { | 29 namespace content { |
28 | 30 |
29 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_ShouldntRun) { | 31 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_ShouldntRun) { |
30 // Ensures that tests with MANUAL_ prefix don't run automatically. | 32 // Ensures that tests with MANUAL_ prefix don't run automatically. |
31 ASSERT_TRUE(false); | 33 ASSERT_TRUE(false); |
32 } | 34 } |
33 | 35 |
34 ContentBrowserTest::ContentBrowserTest() { | 36 ContentBrowserTest::ContentBrowserTest() { |
35 #if defined(OS_MACOSX) | 37 #if defined(OS_MACOSX) |
36 // See comment in InProcessBrowserTest::InProcessBrowserTest(). | 38 // See comment in InProcessBrowserTest::InProcessBrowserTest(). |
37 base::FilePath content_shell_path; | 39 base::FilePath content_shell_path; |
38 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); | 40 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); |
39 content_shell_path = content_shell_path.DirName(); | 41 content_shell_path = content_shell_path.DirName(); |
40 content_shell_path = content_shell_path.Append( | 42 content_shell_path = content_shell_path.Append( |
41 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); | 43 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); |
42 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); | 44 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); |
43 #endif | 45 #endif |
44 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | 46 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
| 47 base::FilePath content_test_data_dir; |
| 48 CHECK(PathService::Get(DIR_TEST_DATA, &content_test_data_dir)); |
| 49 embedded_test_server()->ServeFilesFromDirectory(content_test_data_dir); |
45 } | 50 } |
46 | 51 |
47 ContentBrowserTest::~ContentBrowserTest() { | 52 ContentBrowserTest::~ContentBrowserTest() { |
48 } | 53 } |
49 | 54 |
50 void ContentBrowserTest::SetUp() { | 55 void ContentBrowserTest::SetUp() { |
51 shell_main_delegate_.reset(new ShellMainDelegate); | 56 shell_main_delegate_.reset(new ShellMainDelegate); |
52 shell_main_delegate_->PreSandboxStartup(); | 57 shell_main_delegate_->PreSandboxStartup(); |
53 | 58 |
54 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 59 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { | 146 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { |
142 return Shell::CreateNewWindow( | 147 return Shell::CreateNewWindow( |
143 ShellContentBrowserClient::Get()->off_the_record_browser_context(), | 148 ShellContentBrowserClient::Get()->off_the_record_browser_context(), |
144 GURL(kAboutBlankURL), | 149 GURL(kAboutBlankURL), |
145 NULL, | 150 NULL, |
146 MSG_ROUTING_NONE, | 151 MSG_ROUTING_NONE, |
147 gfx::Size()); | 152 gfx::Size()); |
148 } | 153 } |
149 | 154 |
150 } // namespace content | 155 } // namespace content |
OLD | NEW |