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/file_path.h" | 8 #include "base/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 16 matching lines...) Expand all Loading... |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_ShouldntRun) { | 29 IN_PROC_BROWSER_TEST_F(ContentBrowserTest, MANUAL_ShouldntRun) { |
30 // Ensures that tests with MANUAL_ prefix don't run automatically. | 30 // Ensures that tests with MANUAL_ prefix don't run automatically. |
31 ASSERT_TRUE(false); | 31 ASSERT_TRUE(false); |
32 } | 32 } |
33 | 33 |
34 ContentBrowserTest::ContentBrowserTest() { | 34 ContentBrowserTest::ContentBrowserTest() { |
35 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) |
36 // See comment in InProcessBrowserTest::InProcessBrowserTest(). | 36 // See comment in InProcessBrowserTest::InProcessBrowserTest(). |
37 FilePath content_shell_path; | 37 base::FilePath content_shell_path; |
38 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); | 38 CHECK(PathService::Get(base::FILE_EXE, &content_shell_path)); |
39 content_shell_path = content_shell_path.DirName(); | 39 content_shell_path = content_shell_path.DirName(); |
40 content_shell_path = content_shell_path.Append( | 40 content_shell_path = content_shell_path.Append( |
41 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); | 41 FILE_PATH_LITERAL("Content Shell.app/Contents/MacOS/Content Shell")); |
42 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); | 42 CHECK(PathService::Override(base::FILE_EXE, content_shell_path)); |
43 #endif | 43 #endif |
44 CreateTestServer(FilePath(FILE_PATH_LITERAL("content/test/data"))); | 44 CreateTestServer(base::FilePath(FILE_PATH_LITERAL("content/test/data"))); |
45 } | 45 } |
46 | 46 |
47 ContentBrowserTest::~ContentBrowserTest() { | 47 ContentBrowserTest::~ContentBrowserTest() { |
48 } | 48 } |
49 | 49 |
50 void ContentBrowserTest::SetUp() { | 50 void ContentBrowserTest::SetUp() { |
51 shell_main_delegate_.reset(new ShellMainDelegate); | 51 shell_main_delegate_.reset(new ShellMainDelegate); |
52 shell_main_delegate_->PreSandboxStartup(); | 52 shell_main_delegate_->PreSandboxStartup(); |
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 GetContentClient()->set_renderer_for_testing( |
64 single_process_renderer_client_.get()); | 64 single_process_renderer_client_.get()); |
65 } | 65 } |
66 | 66 |
67 #if defined(OS_MACOSX) | 67 #if defined(OS_MACOSX) |
68 // See InProcessBrowserTest::PrepareTestCommandLine(). | 68 // See InProcessBrowserTest::PrepareTestCommandLine(). |
69 FilePath subprocess_path; | 69 base::FilePath subprocess_path; |
70 PathService::Get(base::FILE_EXE, &subprocess_path); | 70 PathService::Get(base::FILE_EXE, &subprocess_path); |
71 subprocess_path = subprocess_path.DirName().DirName(); | 71 subprocess_path = subprocess_path.DirName().DirName(); |
72 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); | 72 DCHECK_EQ(subprocess_path.BaseName().value(), "Contents"); |
73 subprocess_path = subprocess_path.Append( | 73 subprocess_path = subprocess_path.Append( |
74 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper")
; | 74 "Frameworks/Content Shell Helper.app/Contents/MacOS/Content Shell Helper")
; |
75 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, | 75 command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, |
76 subprocess_path); | 76 subprocess_path); |
77 #endif | 77 #endif |
78 | 78 |
79 // NOTE: should be kept in sync with | 79 // NOTE: should be kept in sync with |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser()); | 146 static_cast<ShellContentBrowserClient*>(GetContentClient()->browser()); |
147 return Shell::CreateNewWindow( | 147 return Shell::CreateNewWindow( |
148 browser_client->off_the_record_browser_context(), | 148 browser_client->off_the_record_browser_context(), |
149 GURL(chrome::kAboutBlankURL), | 149 GURL(chrome::kAboutBlankURL), |
150 NULL, | 150 NULL, |
151 MSG_ROUTING_NONE, | 151 MSG_ROUTING_NONE, |
152 gfx::Size()); | 152 gfx::Size()); |
153 } | 153 } |
154 | 154 |
155 } // namespace content | 155 } // namespace content |
OLD | NEW |