| 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/public/test/content_browser_test.h" | 5 #include "content/public/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/message_loop.h" | 10 #include "base/message_loop/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_paths.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/public/common/url_constants.h" |
| 16 #include "content/shell/browser/shell.h" | 16 #include "content/shell/browser/shell.h" |
| 17 #include "content/shell/browser/shell_browser_context.h" | 17 #include "content/shell/browser/shell_browser_context.h" |
| 18 #include "content/shell/browser/shell_content_browser_client.h" | 18 #include "content/shell/browser/shell_content_browser_client.h" |
| 19 #include "content/shell/common/shell_switches.h" | 19 #include "content/shell/common/shell_switches.h" |
| 20 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client
.h" | 20 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client
.h" |
| 21 #include "content/test/test_content_client.h" | 21 #include "content/test/test_content_client.h" |
| 22 #include "net/test/embedded_test_server/embedded_test_server.h" | |
| 23 | 22 |
| 24 #if defined(OS_ANDROID) | 23 #if defined(OS_ANDROID) |
| 25 #include "content/shell/app/shell_main_delegate.h" | 24 #include "content/shell/app/shell_main_delegate.h" |
| 26 #endif | 25 #endif |
| 27 | 26 |
| 28 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
| 29 #include "base/mac/scoped_nsautorelease_pool.h" | 28 #include "base/mac/scoped_nsautorelease_pool.h" |
| 30 #endif | 29 #endif |
| 31 | 30 |
| 32 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) | 31 #if !defined(OS_CHROMEOS) && defined(OS_LINUX) |
| 33 #include "ui/base/ime/input_method_initializer.h" | 32 #include "ui/base/ime/input_method_initializer.h" |
| 34 #endif | 33 #endif |
| 35 | 34 |
| 36 namespace content { | 35 namespace content { |
| 37 | 36 |
| 38 ContentBrowserTest::ContentBrowserTest() { | 37 ContentBrowserTest::ContentBrowserTest() { |
| 39 #if defined(OS_MACOSX) | 38 #if defined(OS_MACOSX) |
| 40 // See comment in InProcessBrowserTest::InProcessBrowserTest(). | 39 // See comment in InProcessBrowserTest::InProcessBrowserTest(). |
| 41 base::FilePath content_shell_path; | 40 base::FilePath content_shell_path; |
| 42 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); | 41 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); |
| 43 content_shell_path = content_shell_path.DirName(); | 42 content_shell_path = content_shell_path.DirName(); |
| 44 content_shell_path = content_shell_path.Append( | 43 content_shell_path = content_shell_path.Append( |
| 45 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); | 44 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); |
| 46 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); | 45 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); |
| 47 #endif | 46 #endif |
| 48 base::FilePath content_test_data(FILE_PATH_LITERAL("content/test/data")); | 47 base::FilePath content_test_data(FILE_PATH_LITERAL("content/test/data")); |
| 49 CreateTestServer(content_test_data); | 48 CreateTestServer(content_test_data); |
| 50 base::FilePath content_test_data_absolute; | |
| 51 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &content_test_data_absolute)); | |
| 52 content_test_data_absolute = | |
| 53 content_test_data_absolute.Append(content_test_data); | |
| 54 embedded_test_server()->ServeFilesFromDirectory(content_test_data_absolute); | |
| 55 } | 49 } |
| 56 | 50 |
| 57 ContentBrowserTest::~ContentBrowserTest() { | 51 ContentBrowserTest::~ContentBrowserTest() { |
| 58 } | 52 } |
| 59 | 53 |
| 60 void ContentBrowserTest::SetUp() { | 54 void ContentBrowserTest::SetUp() { |
| 61 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 55 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 62 command_line->AppendSwitch(switches::kContentBrowserTest); | 56 command_line->AppendSwitch(switches::kContentBrowserTest); |
| 63 | 57 |
| 64 SetUpCommandLine(command_line); | 58 SetUpCommandLine(command_line); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 156 |
| 163 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { | 157 Shell* ContentBrowserTest::CreateOffTheRecordBrowser() { |
| 164 return Shell::CreateNewWindow( | 158 return Shell::CreateNewWindow( |
| 165 ShellContentBrowserClient::Get()->off_the_record_browser_context(), | 159 ShellContentBrowserClient::Get()->off_the_record_browser_context(), |
| 166 GURL(url::kAboutBlankURL), | 160 GURL(url::kAboutBlankURL), |
| 167 NULL, | 161 NULL, |
| 168 gfx::Size()); | 162 gfx::Size()); |
| 169 } | 163 } |
| 170 | 164 |
| 171 } // namespace content | 165 } // namespace content |
| OLD | NEW |