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/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 scoped_ptr<base::MessagePump> CreateMessagePumpForUI() { | 38 scoped_ptr<base::MessagePump> CreateMessagePumpForUI() { |
39 return scoped_ptr<base::MessagePump>(new NestedMessagePumpAndroid()); | 39 return scoped_ptr<base::MessagePump>(new NestedMessagePumpAndroid()); |
40 }; | 40 }; |
41 #endif | 41 #endif |
42 | 42 |
43 class ContentBrowserTestSuite : public ContentTestSuiteBase { | 43 class ContentBrowserTestSuite : public ContentTestSuiteBase { |
44 public: | 44 public: |
45 ContentBrowserTestSuite(int argc, char** argv) | 45 ContentBrowserTestSuite(int argc, char** argv) |
46 : ContentTestSuiteBase(argc, argv) { | 46 : ContentTestSuiteBase(argc, argv) { |
47 } | 47 } |
48 virtual ~ContentBrowserTestSuite() { | 48 ~ContentBrowserTestSuite() override {} |
49 } | |
50 | 49 |
51 protected: | 50 protected: |
52 virtual void Initialize() override { | 51 void Initialize() override { |
53 | |
54 #if defined(OS_ANDROID) | 52 #if defined(OS_ANDROID) |
55 base::i18n::AllowMultipleInitializeCallsForTesting(); | 53 base::i18n::AllowMultipleInitializeCallsForTesting(); |
56 base::i18n::InitializeICU(); | 54 base::i18n::InitializeICU(); |
57 | 55 |
58 // This needs to be done before base::TestSuite::Initialize() is called, | 56 // This needs to be done before base::TestSuite::Initialize() is called, |
59 // as it also tries to set MessagePumpForUIFactory. | 57 // as it also tries to set MessagePumpForUIFactory. |
60 if (!base::MessageLoop::InitMessagePumpForUIFactory( | 58 if (!base::MessageLoop::InitMessagePumpForUIFactory( |
61 &CreateMessagePumpForUI)) | 59 &CreateMessagePumpForUI)) |
62 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; | 60 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; |
63 | 61 |
(...skipping 20 matching lines...) Expand all Loading... |
84 scoped_ptr<ShellContentClient> content_client_; | 82 scoped_ptr<ShellContentClient> content_client_; |
85 scoped_ptr<ShellContentBrowserClient> browser_content_client_; | 83 scoped_ptr<ShellContentBrowserClient> browser_content_client_; |
86 #endif | 84 #endif |
87 | 85 |
88 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); | 86 DISALLOW_COPY_AND_ASSIGN(ContentBrowserTestSuite); |
89 }; | 87 }; |
90 | 88 |
91 class ContentTestLauncherDelegate : public TestLauncherDelegate { | 89 class ContentTestLauncherDelegate : public TestLauncherDelegate { |
92 public: | 90 public: |
93 ContentTestLauncherDelegate() {} | 91 ContentTestLauncherDelegate() {} |
94 virtual ~ContentTestLauncherDelegate() {} | 92 ~ContentTestLauncherDelegate() override {} |
95 | 93 |
96 virtual int RunTestSuite(int argc, char** argv) override { | 94 int RunTestSuite(int argc, char** argv) override { |
97 return ContentBrowserTestSuite(argc, argv).Run(); | 95 return ContentBrowserTestSuite(argc, argv).Run(); |
98 } | 96 } |
99 | 97 |
100 virtual bool AdjustChildProcessCommandLine( | 98 bool AdjustChildProcessCommandLine( |
101 CommandLine* command_line, const base::FilePath& temp_data_dir) override { | 99 CommandLine* command_line, |
| 100 const base::FilePath& temp_data_dir) override { |
102 command_line->AppendSwitchPath(switches::kContentShellDataPath, | 101 command_line->AppendSwitchPath(switches::kContentShellDataPath, |
103 temp_data_dir); | 102 temp_data_dir); |
104 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); | 103 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream); |
105 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); | 104 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); |
106 return true; | 105 return true; |
107 } | 106 } |
108 | 107 |
109 protected: | 108 protected: |
110 virtual ContentMainDelegate* CreateContentMainDelegate() override { | 109 ContentMainDelegate* CreateContentMainDelegate() override { |
111 return new ShellMainDelegate(); | 110 return new ShellMainDelegate(); |
112 } | 111 } |
113 | 112 |
114 private: | 113 private: |
115 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 114 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
116 }; | 115 }; |
117 | 116 |
118 } // namespace content | 117 } // namespace content |
119 | 118 |
120 int main(int argc, char** argv) { | 119 int main(int argc, char** argv) { |
121 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 120 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
122 content::ContentTestLauncherDelegate launcher_delegate; | 121 content::ContentTestLauncherDelegate launcher_delegate; |
123 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 122 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
124 } | 123 } |
OLD | NEW |