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