| 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 <memory> | 7 #include <memory> | 
| 8 | 8 | 
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" | 
| 10 #include "base/macros.h" |  | 
| 11 #include "base/metrics/statistics_recorder.h" | 10 #include "base/metrics/statistics_recorder.h" | 
| 12 #include "base/test/test_suite.h" | 11 #include "base/test/test_suite.h" | 
| 13 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" | 
| 14 #include "build/build_config.h" | 13 #include "build/build_config.h" | 
| 15 #include "content/browser/browser_thread_impl.h" |  | 
| 16 #include "content/browser/gpu/gpu_process_host.h" | 14 #include "content/browser/gpu/gpu_process_host.h" | 
| 17 #include "content/browser/renderer_host/render_process_host_impl.h" | 15 #include "content/browser/renderer_host/render_process_host_impl.h" | 
| 18 #include "content/browser/utility_process_host_impl.h" | 16 #include "content/browser/utility_process_host_impl.h" | 
| 19 #include "content/common/url_schemes.h" | 17 #include "content/common/url_schemes.h" | 
| 20 #include "content/gpu/in_process_gpu_thread.h" | 18 #include "content/gpu/in_process_gpu_thread.h" | 
| 21 #include "content/public/common/content_client.h" | 19 #include "content/public/common/content_client.h" | 
| 22 #include "content/renderer/in_process_renderer_thread.h" | 20 #include "content/renderer/in_process_renderer_thread.h" | 
| 23 #include "content/utility/in_process_utility_thread.h" | 21 #include "content/utility/in_process_utility_thread.h" | 
| 24 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" | 
| 25 #include "ui/base/material_design/material_design_controller.h" | 23 #include "ui/base/material_design/material_design_controller.h" | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 48 #include "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h" | 46 #include "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h" | 
| 49 #endif | 47 #endif | 
| 50 | 48 | 
| 51 #if defined(USE_OZONE) | 49 #if defined(USE_OZONE) | 
| 52 #include "ui/ozone/public/ozone_platform.h" | 50 #include "ui/ozone/public/ozone_platform.h" | 
| 53 #endif | 51 #endif | 
| 54 | 52 | 
| 55 | 53 | 
| 56 namespace content { | 54 namespace content { | 
| 57 | 55 | 
| 58 class ContentTestSuiteBaseListener : public testing::EmptyTestEventListener { |  | 
| 59  public: |  | 
| 60   ContentTestSuiteBaseListener() { |  | 
| 61   } |  | 
| 62   void OnTestEnd(const testing::TestInfo& test_info) override { |  | 
| 63     BrowserThreadImpl::FlushThreadPoolHelperForTesting(); |  | 
| 64   } |  | 
| 65  private: |  | 
| 66   DISALLOW_COPY_AND_ASSIGN(ContentTestSuiteBaseListener); |  | 
| 67 }; |  | 
| 68 |  | 
| 69 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv) | 56 ContentTestSuiteBase::ContentTestSuiteBase(int argc, char** argv) | 
| 70     : base::TestSuite(argc, argv) { | 57     : base::TestSuite(argc, argv) { | 
| 71 } | 58 } | 
| 72 | 59 | 
| 73 void ContentTestSuiteBase::Initialize() { | 60 void ContentTestSuiteBase::Initialize() { | 
| 74   base::TestSuite::Initialize(); | 61   base::TestSuite::Initialize(); | 
| 75 | 62 | 
| 76   // Initialize the histograms subsystem, so that any histograms hit in tests | 63   // Initialize the histograms subsystem, so that any histograms hit in tests | 
| 77   // are correctly registered with the statistics recorder and can be queried | 64   // are correctly registered with the statistics recorder and can be queried | 
| 78   // by tests. | 65   // by tests. | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 95   net::android::RegisterJni(env); | 82   net::android::RegisterJni(env); | 
| 96   ui::android::RegisterJni(env); | 83   ui::android::RegisterJni(env); | 
| 97   ui::RegisterUIAndroidJni(env); | 84   ui::RegisterUIAndroidJni(env); | 
| 98   ui::gl::android::RegisterJni(env); | 85   ui::gl::android::RegisterJni(env); | 
| 99 #if !defined(USE_AURA) | 86 #if !defined(USE_AURA) | 
| 100   ui::shell_dialogs::RegisterJni(env); | 87   ui::shell_dialogs::RegisterJni(env); | 
| 101   content::Compositor::Initialize(); | 88   content::Compositor::Initialize(); | 
| 102 #endif | 89 #endif | 
| 103 #endif | 90 #endif | 
| 104 | 91 | 
| 105   testing::UnitTest::GetInstance()->listeners().Append( |  | 
| 106       new ContentTestSuiteBaseListener); |  | 
| 107   ui::MaterialDesignController::Initialize(); | 92   ui::MaterialDesignController::Initialize(); | 
| 108 } | 93 } | 
| 109 | 94 | 
| 110 void ContentTestSuiteBase::RegisterContentSchemes( | 95 void ContentTestSuiteBase::RegisterContentSchemes( | 
| 111     ContentClient* content_client) { | 96     ContentClient* content_client) { | 
| 112   SetContentClient(content_client); | 97   SetContentClient(content_client); | 
| 113   content::RegisterContentSchemes(false); | 98   content::RegisterContentSchemes(false); | 
| 114   SetContentClient(NULL); | 99   SetContentClient(NULL); | 
| 115 } | 100 } | 
| 116 | 101 | 
| 117 void ContentTestSuiteBase::RegisterInProcessThreads() { | 102 void ContentTestSuiteBase::RegisterInProcessThreads() { | 
| 118   UtilityProcessHostImpl::RegisterUtilityMainThreadFactory( | 103   UtilityProcessHostImpl::RegisterUtilityMainThreadFactory( | 
| 119       CreateInProcessUtilityThread); | 104       CreateInProcessUtilityThread); | 
| 120   RenderProcessHostImpl::RegisterRendererMainThreadFactory( | 105   RenderProcessHostImpl::RegisterRendererMainThreadFactory( | 
| 121       CreateInProcessRendererThread); | 106       CreateInProcessRendererThread); | 
| 122   GpuProcessHost::RegisterGpuMainThreadFactory(CreateInProcessGpuThread); | 107   GpuProcessHost::RegisterGpuMainThreadFactory(CreateInProcessGpuThread); | 
| 123 } | 108 } | 
| 124 | 109 | 
| 125 }  // namespace content | 110 }  // namespace content | 
| OLD | NEW | 
|---|