| 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 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 22 #include "gin/public/isolate_holder.h" |
| 23 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
| 21 #include "media/base/media_switches.h" | 24 #include "media/base/media_switches.h" |
| 22 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 23 | 26 |
| 24 #if defined(OS_ANDROID) | 27 #if defined(OS_ANDROID) |
| 25 #include "base/message_loop/message_loop.h" | 28 #include "base/message_loop/message_loop.h" |
| 26 #include "content/app/mojo/mojo_init.h" | 29 #include "content/app/mojo/mojo_init.h" |
| 27 #include "content/common/url_schemes.h" | 30 #include "content/common/url_schemes.h" |
| 28 #include "content/public/common/content_paths.h" | 31 #include "content/public/common/content_paths.h" |
| 29 #include "content/public/test/nested_message_pump_android.h" | 32 #include "content/public/test/nested_message_pump_android.h" |
| 30 #include "content/shell/browser/shell_content_browser_client.h" | 33 #include "content/shell/browser/shell_content_browser_client.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 47 } | 50 } |
| 48 virtual ~ContentBrowserTestSuite() { | 51 virtual ~ContentBrowserTestSuite() { |
| 49 } | 52 } |
| 50 | 53 |
| 51 protected: | 54 protected: |
| 52 virtual void Initialize() OVERRIDE { | 55 virtual void Initialize() OVERRIDE { |
| 53 | 56 |
| 54 #if defined(OS_ANDROID) | 57 #if defined(OS_ANDROID) |
| 55 base::i18n::AllowMultipleInitializeCallsForTesting(); | 58 base::i18n::AllowMultipleInitializeCallsForTesting(); |
| 56 base::i18n::InitializeICU(); | 59 base::i18n::InitializeICU(); |
| 60 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
| 61 gin::IsolateHolder::LoadV8Snapshot(); |
| 62 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
| 57 | 63 |
| 58 // This needs to be done before base::TestSuite::Initialize() is called, | 64 // This needs to be done before base::TestSuite::Initialize() is called, |
| 59 // as it also tries to set MessagePumpForUIFactory. | 65 // as it also tries to set MessagePumpForUIFactory. |
| 60 if (!base::MessageLoop::InitMessagePumpForUIFactory( | 66 if (!base::MessageLoop::InitMessagePumpForUIFactory( |
| 61 &CreateMessagePumpForUI)) | 67 &CreateMessagePumpForUI)) |
| 62 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; | 68 VLOG(0) << "MessagePumpForUIFactory already set, unable to override."; |
| 63 | 69 |
| 64 // 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 |
| 65 // through the normal browser initialization paths. For Android, we must set | 71 // through the normal browser initialization paths. For Android, we must set |
| 66 // things up manually. | 72 // things up manually. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); | 121 DISALLOW_COPY_AND_ASSIGN(ContentTestLauncherDelegate); |
| 116 }; | 122 }; |
| 117 | 123 |
| 118 } // namespace content | 124 } // namespace content |
| 119 | 125 |
| 120 int main(int argc, char** argv) { | 126 int main(int argc, char** argv) { |
| 121 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); | 127 int default_jobs = std::max(1, base::SysInfo::NumberOfProcessors() / 2); |
| 122 content::ContentTestLauncherDelegate launcher_delegate; | 128 content::ContentTestLauncherDelegate launcher_delegate; |
| 123 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); | 129 return LaunchTests(&launcher_delegate, default_jobs, argc, argv); |
| 124 } | 130 } |
| OLD | NEW |