| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/process/memory.h" | 13 #include "base/process/memory.h" |
| 14 #include "base/sys_info.h" | 14 #include "base/sys_info.h" |
| 15 #include "base/test/test_suite.h" | 15 #include "base/test/test_suite.h" |
| 16 #include "base/test/test_timeouts.h" | 16 #include "base/test/test_timeouts.h" |
| 17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/test/content_test_suite_base.h" | 18 #include "content/public/test/content_test_suite_base.h" |
| 19 #include "content/shell/app/shell_main_delegate.h" | 19 #include "content/shell/app/shell_main_delegate.h" |
| 20 #include "content/shell/common/shell_switches.h" | 20 #include "content/shell/common/shell_switches.h" |
| 21 #include "media/base/media_switches.h" | 21 #include "media/base/media_switches.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 23 |
| 24 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 25 #include "gin/public/isolate_holder.h" |
| 26 #endif |
| 27 |
| 24 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 25 #include "base/message_loop/message_loop.h" | 29 #include "base/message_loop/message_loop.h" |
| 26 #include "content/app/mojo/mojo_init.h" | 30 #include "content/app/mojo/mojo_init.h" |
| 27 #include "content/common/url_schemes.h" | 31 #include "content/common/url_schemes.h" |
| 28 #include "content/public/common/content_paths.h" | 32 #include "content/public/common/content_paths.h" |
| 29 #include "content/public/test/nested_message_pump_android.h" | 33 #include "content/public/test/nested_message_pump_android.h" |
| 30 #include "content/shell/browser/shell_content_browser_client.h" | 34 #include "content/shell/browser/shell_content_browser_client.h" |
| 31 #include "content/shell/common/shell_content_client.h" | 35 #include "content/shell/common/shell_content_client.h" |
| 32 #include "ui/base/ui_base_paths.h" | 36 #include "ui/base/ui_base_paths.h" |
| 33 #endif | 37 #endif |
| (...skipping 14 matching lines...) Expand all Loading... |
| 48 virtual ~ContentBrowserTestSuite() { | 52 virtual ~ContentBrowserTestSuite() { |
| 49 } | 53 } |
| 50 | 54 |
| 51 protected: | 55 protected: |
| 52 virtual void Initialize() override { | 56 virtual void Initialize() override { |
| 53 | 57 |
| 54 #if defined(OS_ANDROID) | 58 #if defined(OS_ANDROID) |
| 55 base::i18n::AllowMultipleInitializeCallsForTesting(); | 59 base::i18n::AllowMultipleInitializeCallsForTesting(); |
| 56 base::i18n::InitializeICU(); | 60 base::i18n::InitializeICU(); |
| 57 | 61 |
| 62 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 63 gin::IsolateHolder::LoadV8Snapshot(); |
| 64 #endif |
| 65 |
| 58 // This needs to be done before base::TestSuite::Initialize() is called, | 66 // This needs to be done before base::TestSuite::Initialize() is called, |
| 59 // as it also tries to set MessagePumpForUIFactory. | 67 // as it also tries to set MessagePumpForUIFactory. |
| 60 if (!base::MessageLoop::InitMessagePumpForUIFactory( | 68 if (!base::MessageLoop::InitMessagePumpForUIFactory( |
| 61 &CreateMessagePumpForUI)) | 69 &CreateMessagePumpForUI)) |
| 62 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; | 70 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; |
| 63 | 71 |
| 64 // For all other platforms, we call ContentMain for browser tests which goes | 72 // For all other platforms, we call ContentMain for browser tests which goes |
| 65 // through the normal browser initialization paths. For Android, we must set | 73 // through the normal browser initialization paths. For Android, we must set |
| 66 // things up manually. | 74 // things up manually. |
| 67 content_client_.reset(new ShellContentClient); | 75 content_client_.reset(new ShellContentClient); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 123 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
| 116 }; | 124 }; |
| 117 | 125 |
| 118 } // namespace content | 126 } // namespace content |
| 119 | 127 |
| 120 int main(int argc, char** argv) { | 128 int main(int argc, char** argv) { |
| 121 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 129 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
| 122 content::ContentTestLauncherDelegate launcher_delegate; | 130 content::ContentTestLauncherDelegate launcher_delegate; |
| 123 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 131 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
| 124 } | 132 } |
| OLD | NEW |