| 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/content_test_suite_base.h" | 5 #include "content/public/test/content_test_suite_base.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/test/test_suite.h" | 10 #include "base/test/test_suite.h" |
| 11 #include "base/threading/sequenced_worker_pool.h" |
| 12 #include "content/browser/browser_thread_impl.h" |
| 11 #include "content/common/url_schemes.h" | 13 #include "content/common/url_schemes.h" |
| 12 #include "content/public/common/content_client.h" | 14 #include "content/public/common/content_client.h" |
| 13 #include "content/public/common/content_paths.h" | 15 #include "content/public/common/content_paths.h" |
| 14 #include "media/base/media.h" | 16 #include "media/base/media.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/base/ui_base_paths.h" | 18 #include "ui/base/ui_base_paths.h" |
| 16 #include "ui/compositor/compositor_setup.h" | 19 #include "ui/compositor/compositor_setup.h" |
| 17 | 20 |
| 18 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
| 19 #include "base/android/jni_android.h" | 22 #include "base/android/jni_android.h" |
| 20 #include "content/browser/android/browser_jni_registrar.h" | 23 #include "content/browser/android/browser_jni_registrar.h" |
| 21 #include "content/common/android/common_jni_registrar.h" | 24 #include "content/common/android/common_jni_registrar.h" |
| 22 #include "net/android/net_jni_registrar.h" | 25 #include "net/android/net_jni_registrar.h" |
| 23 #include "ui/android/ui_jni_registrar.h" | 26 #include "ui/android/ui_jni_registrar.h" |
| 24 #endif | 27 #endif |
| 25 | 28 |
| 26 namespace content { | 29 namespace content { |
| 27 | 30 |
| 31 namespace { |
| 32 class ContentTestSuiteListener : public testing::EmptyTestEventListener { |
| 33 public: |
| 34 ContentTestSuiteListener() { |
| 35 } |
| 36 virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE { |
| 37 BrowserThreadImpl::FlushThreadPoolForTesting(); |
| 38 } |
| 39 DISALLOW_COPY_AND_ASSIGN(ContentTestSuiteListener); |
| 40 }; |
| 41 } // namespace |
| 42 |
| 28 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv) | 43 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv) |
| 29 : base::TestSuite(argc, argv), | 44 : base::TestSuite(argc, argv), |
| 30 external_libraries_enabled_(true) { | 45 external_libraries_enabled_(true) { |
| 31 } | 46 } |
| 32 | 47 |
| 33 void ContentTestSuiteBase::Initialize() { | 48 void ContentTestSuiteBase::Initialize() { |
| 34 base::TestSuite::Initialize(); | 49 base::TestSuite::Initialize(); |
| 35 | 50 |
| 36 #if defined(OS_ANDROID) | 51 #if defined(OS_ANDROID) |
| 37 // Register JNI bindings for android. | 52 // Register JNI bindings for android. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 48 scoped_ptr<ContentClient> client_for_init(CreateClientForInitialization()); | 63 scoped_ptr<ContentClient> client_for_init(CreateClientForInitialization()); |
| 49 SetContentClient(client_for_init.get()); | 64 SetContentClient(client_for_init.get()); |
| 50 RegisterContentSchemes(false); | 65 RegisterContentSchemes(false); |
| 51 SetContentClient(NULL); | 66 SetContentClient(NULL); |
| 52 | 67 |
| 53 RegisterPathProvider(); | 68 RegisterPathProvider(); |
| 54 ui::RegisterPathProvider(); | 69 ui::RegisterPathProvider(); |
| 55 | 70 |
| 56 // Mock out the compositor on platforms that use it. | 71 // Mock out the compositor on platforms that use it. |
| 57 ui::SetupTestCompositor(); | 72 ui::SetupTestCompositor(); |
| 73 |
| 74 testing::TestEventListeners& listeners = |
| 75 testing::UnitTest::GetInstance()->listeners(); |
| 76 listeners.Append(new ContentTestSuiteListener); |
| 58 } | 77 } |
| 59 | 78 |
| 60 } // namespace content | 79 } // namespace content |
| OLD | NEW |