OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test_launcher.h" | 5 #include "content/public/test/test_launcher.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/stack_trace.h" | 9 #include "base/debug/stack_trace.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/process/memory.h" | 12 #include "base/process/memory.h" |
13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
14 #include "base/test/test_suite.h" | 14 #include "base/test/test_suite.h" |
15 #include "base/test/test_timeouts.h" | 15 #include "base/test/test_timeouts.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
17 #include "content/public/test/content_test_suite_base.h" | 17 #include "content/public/test/content_test_suite_base.h" |
18 #include "content/shell/app/shell_main_delegate.h" | 18 #include "content/shell/app/shell_main_delegate.h" |
19 #include "content/shell/common/shell_switches.h" | 19 #include "content/shell/common/shell_switches.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
21 | 21 |
22 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
23 #include "base/message_loop/message_loop.h" | 23 #include "base/message_loop/message_loop.h" |
| 24 #include "content/app/mojo/mojo_init.h" |
24 #include "content/common/url_schemes.h" | 25 #include "content/common/url_schemes.h" |
25 #include "content/public/common/content_paths.h" | 26 #include "content/public/common/content_paths.h" |
26 #include "content/public/test/nested_message_pump_android.h" | 27 #include "content/public/test/nested_message_pump_android.h" |
27 #include "content/shell/browser/shell_content_browser_client.h" | 28 #include "content/shell/browser/shell_content_browser_client.h" |
28 #include "content/shell/common/shell_content_client.h" | 29 #include "content/shell/common/shell_content_client.h" |
29 #include "ui/base/ui_base_paths.h" | 30 #include "ui/base/ui_base_paths.h" |
30 | |
31 #if defined(USE_MOJO) | |
32 #include "content/app/mojo/mojo_init.h" | |
33 #endif | |
34 | |
35 #endif | 31 #endif |
36 | 32 |
37 namespace content { | 33 namespace content { |
38 | 34 |
39 #if defined(OS_ANDROID) | 35 #if defined(OS_ANDROID) |
40 scoped_ptr<base::MessagePump> CreateMessagePumpForUI() { | 36 scoped_ptr<base::MessagePump> CreateMessagePumpForUI() { |
41 return scoped_ptr<base::MessagePump>(new NestedMessagePumpAndroid()); | 37 return scoped_ptr<base::MessagePump>(new NestedMessagePumpAndroid()); |
42 }; | 38 }; |
43 #endif | 39 #endif |
44 | 40 |
(...skipping 21 matching lines...) Expand all Loading... |
66 content_client_.reset(new ShellContentClient); | 62 content_client_.reset(new ShellContentClient); |
67 browser_content_client_.reset(new ShellContentBrowserClient()); | 63 browser_content_client_.reset(new ShellContentBrowserClient()); |
68 SetContentClient(content_client_.get()); | 64 SetContentClient(content_client_.get()); |
69 SetBrowserClientForTesting(browser_content_client_.get()); | 65 SetBrowserClientForTesting(browser_content_client_.get()); |
70 | 66 |
71 content::RegisterContentSchemes(false); | 67 content::RegisterContentSchemes(false); |
72 RegisterPathProvider(); | 68 RegisterPathProvider(); |
73 ui::RegisterPathProvider(); | 69 ui::RegisterPathProvider(); |
74 RegisterInProcessThreads(); | 70 RegisterInProcessThreads(); |
75 | 71 |
76 #if defined(USE_MOJO) | |
77 InitializeMojo(); | 72 InitializeMojo(); |
78 #endif | 73 #endif |
79 | 74 |
80 #endif | |
81 | |
82 ContentTestSuiteBase::Initialize(); | 75 ContentTestSuiteBase::Initialize(); |
83 } | 76 } |
84 | 77 |
85 virtual void Shutdown() OVERRIDE { | 78 virtual void Shutdown() OVERRIDE { |
86 ContentTestSuiteBase::Shutdown(); | 79 ContentTestSuiteBase::Shutdown(); |
87 | 80 |
88 #if defined(OS_ANDROID) && defined(USE_MOJO) | 81 #if defined(OS_ANDROID) |
89 ShutdownMojo(); | 82 ShutdownMojo(); |
90 #endif | 83 #endif |
91 } | 84 } |
92 | 85 |
93 #if defined(OS_ANDROID) | 86 #if defined(OS_ANDROID) |
94 scoped_ptr<ShellContentClient> content_client_; | 87 scoped_ptr<ShellContentClient> content_client_; |
95 scoped_ptr<ShellContentBrowserClient> browser_content_client_; | 88 scoped_ptr<ShellContentBrowserClient> browser_content_client_; |
96 #endif | 89 #endif |
97 | 90 |
98 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); | 91 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); |
(...skipping 26 matching lines...) Expand all Loading... |
125 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 118 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
126 }; | 119 }; |
127 | 120 |
128 } // namespace content | 121 } // namespace content |
129 | 122 |
130 int main(int argc, char** argv) { | 123 int main(int argc, char** argv) { |
131 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 124 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
132 content::ContentTestLauncherDelegate launcher_delegate; | 125 content::ContentTestLauncherDelegate launcher_delegate; |
133 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 126 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
134 } | 127 } |
OLD | NEW |