| 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 12 matching lines...) Expand all Loading... |
| 46 : ContentTestSuiteBase(argc, argv) { | 50 : ContentTestSuiteBase(argc, argv) { |
| 47 } | 51 } |
| 48 ~ContentBrowserTestSuite() override {} | 52 ~ContentBrowserTestSuite() override {} |
| 49 | 53 |
| 50 protected: | 54 protected: |
| 51 void Initialize() override { | 55 void Initialize() override { |
| 52 #if defined(OS_ANDROID) | 56 #if defined(OS_ANDROID) |
| 53 base::i18n::AllowMultipleInitializeCallsForTesting(); | 57 base::i18n::AllowMultipleInitializeCallsForTesting(); |
| 54 base::i18n::InitializeICU(); | 58 base::i18n::InitializeICU(); |
| 55 | 59 |
| 60 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 61 gin::IsolateHolder::LoadV8Snapshot(); |
| 62 #endif |
| 63 |
| 56 // This needs to be done before base::TestSuite::Initialize() is called, | 64 // This needs to be done before base::TestSuite::Initialize() is called, |
| 57 // as it also tries to set MessagePumpForUIFactory. | 65 // as it also tries to set MessagePumpForUIFactory. |
| 58 if (!base::MessageLoop::InitMessagePumpForUIFactory( | 66 if (!base::MessageLoop::InitMessagePumpForUIFactory( |
| 59 &CreateMessagePumpForUI)) | 67 &CreateMessagePumpForUI)) |
| 60 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; | 68 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; |
| 61 | 69 |
| 62 // For all other platforms, we call ContentMain for browser tests which goes | 70 // For all other platforms, we call ContentMain for browser tests which goes |
| 63 // through the normal browser initialization paths. For Android, we must set | 71 // through the normal browser initialization paths. For Android, we must set |
| 64 // things up manually. | 72 // things up manually. |
| 65 content_client_.reset(new ShellContentClient); | 73 content_client_.reset(new ShellContentClient); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 122 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
| 115 }; | 123 }; |
| 116 | 124 |
| 117 } // namespace content | 125 } // namespace content |
| 118 | 126 |
| 119 int main(int argc, char** argv) { | 127 int main(int argc, char** argv) { |
| 120 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 128 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
| 121 content::ContentTestLauncherDelegate launcher_delegate; | 129 content::ContentTestLauncherDelegate launcher_delegate; |
| 122 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 130 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
| 123 } | 131 } |
| OLD | NEW |