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/common/url_schemes.h" | 24 #include "content/common/url_schemes.h" |
25 #include "content/public/common/content_paths.h" | 25 #include "content/public/common/content_paths.h" |
26 #include "content/public/test/nested_message_pump_android.h" | 26 #include "content/public/test/nested_message_pump_android.h" |
27 #include "content/shell/browser/shell_content_browser_client.h" | 27 #include "content/shell/browser/shell_content_browser_client.h" |
28 #include "content/shell/common/shell_content_client.h" | 28 #include "content/shell/common/shell_content_client.h" |
29 #include "ui/base/ui_base_paths.h" | 29 #include "ui/base/ui_base_paths.h" |
| 30 |
| 31 #if defined(USE_MOJO) |
| 32 #include "content/app/mojo/mojo_init.h" |
| 33 #endif |
| 34 |
30 #endif | 35 #endif |
31 | 36 |
32 namespace content { | 37 namespace content { |
33 | 38 |
34 #if defined(OS_ANDROID) | 39 #if defined(OS_ANDROID) |
35 scoped_ptr<base::MessagePump> CreateMessagePumpForUI() { | 40 scoped_ptr<base::MessagePump> CreateMessagePumpForUI() { |
36 return scoped_ptr<base::MessagePump>(new NestedMessagePumpAndroid()); | 41 return scoped_ptr<base::MessagePump>(new NestedMessagePumpAndroid()); |
37 }; | 42 }; |
38 #endif | 43 #endif |
39 | 44 |
(...skipping 20 matching lines...) Expand all Loading... |
60 // things up manually. | 65 // things up manually. |
61 content_client_.reset(new ShellContentClient); | 66 content_client_.reset(new ShellContentClient); |
62 browser_content_client_.reset(new ShellContentBrowserClient()); | 67 browser_content_client_.reset(new ShellContentBrowserClient()); |
63 SetContentClient(content_client_.get()); | 68 SetContentClient(content_client_.get()); |
64 SetBrowserClientForTesting(browser_content_client_.get()); | 69 SetBrowserClientForTesting(browser_content_client_.get()); |
65 | 70 |
66 content::RegisterContentSchemes(false); | 71 content::RegisterContentSchemes(false); |
67 RegisterPathProvider(); | 72 RegisterPathProvider(); |
68 ui::RegisterPathProvider(); | 73 ui::RegisterPathProvider(); |
69 RegisterInProcessThreads(); | 74 RegisterInProcessThreads(); |
| 75 |
| 76 #if defined(USE_MOJO) |
| 77 InitializeMojo(); |
| 78 #endif |
| 79 |
70 #endif | 80 #endif |
71 | 81 |
72 ContentTestSuiteBase::Initialize(); | 82 ContentTestSuiteBase::Initialize(); |
73 } | 83 } |
74 | 84 |
| 85 virtual void Shutdown() OVERRIDE { |
| 86 ContentTestSuiteBase::Shutdown(); |
| 87 |
| 88 #if defined(OS_ANDROID) && defined(USE_MOJO) |
| 89 ShutdownMojo(); |
| 90 #endif |
| 91 } |
| 92 |
75 #if defined(OS_ANDROID) | 93 #if defined(OS_ANDROID) |
76 scoped_ptr<ShellContentClient> content_client_;» | 94 scoped_ptr<ShellContentClient> content_client_; |
77 scoped_ptr<ShellContentBrowserClient> browser_content_client_; | 95 scoped_ptr<ShellContentBrowserClient> browser_content_client_; |
78 #endif | 96 #endif |
79 | 97 |
80 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); | 98 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); |
81 }; | 99 }; |
82 | 100 |
83 class ContentTestLauncherDelegate : public TestLauncherDelegate { | 101 class ContentTestLauncherDelegate : public TestLauncherDelegate { |
84 public: | 102 public: |
85 ContentTestLauncherDelegate() {} | 103 ContentTestLauncherDelegate() {} |
86 virtual ~ContentTestLauncherDelegate() {} | 104 virtual ~ContentTestLauncherDelegate() {} |
(...skipping 20 matching lines...) Expand all Loading... |
107 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 125 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
108 }; | 126 }; |
109 | 127 |
110 } // namespace content | 128 } // namespace content |
111 | 129 |
112 int main(int argc, char** argv) { | 130 int main(int argc, char** argv) { |
113 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 131 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
114 content::ContentTestLauncherDelegate launcher_delegate; | 132 content::ContentTestLauncherDelegate launcher_delegate; |
115 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 133 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
116 } | 134 } |
OLD | NEW |