diff options
-rw-r--r-- | ash/ash.gyp | 2 | ||||
-rw-r--r-- | ash/shell/content_client/shell_browser_main_parts.cc | 1 | ||||
-rw-r--r-- | ash/test/test_suite.cc | 3 | ||||
-rw-r--r-- | chrome/chrome_tests_unit.gypi | 1 | ||||
-rw-r--r-- | chrome/test/base/view_event_test_base.cc | 3 | ||||
-rw-r--r-- | ui/app_list/app_list.gyp | 1 | ||||
-rw-r--r-- | ui/app_list/test/app_list_test_suite.cc | 3 | ||||
-rw-r--r-- | ui/aura/aura.gyp | 3 | ||||
-rw-r--r-- | ui/aura/bench/bench_main.cc | 4 | ||||
-rw-r--r-- | ui/aura/demo/demo_main.cc | 4 | ||||
-rw-r--r-- | ui/aura/test/test_suite.cc | 3 | ||||
-rw-r--r-- | ui/compositor/compositor.gyp | 25 | ||||
-rw-r--r-- | ui/compositor/test/compositor_test_support.cc | 60 | ||||
-rw-r--r-- | ui/compositor/test/compositor_test_support.h | 20 | ||||
-rw-r--r-- | ui/compositor/test/test_suite.cc | 3 | ||||
-rw-r--r-- | ui/views/run_all_unittests.cc | 6 | ||||
-rw-r--r-- | ui/views/views.gyp | 2 | ||||
-rw-r--r-- | webkit/gpu/webkit_gpu.gypi | 1 |
18 files changed, 144 insertions, 1 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 618459c..53cf01c 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -499,6 +499,7 @@ '../ui/aura/aura.gyp:test_support_aura', '../ui/app_list/app_list.gyp:app_list', '../ui/compositor/compositor.gyp:compositor', + '../ui/compositor/compositor.gyp:compositor_test_support', '../ui/message_center/message_center.gyp:message_center', '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', @@ -632,6 +633,7 @@ '../ui/app_list/app_list.gyp:app_list', '../ui/aura/aura.gyp:aura', '../ui/compositor/compositor.gyp:compositor', + '../ui/compositor/compositor.gyp:compositor_test_support', '../ui/message_center/message_center.gyp:message_center', '../ui/ui.gyp:ui', '../ui/ui.gyp:ui_resources', diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc index a5f9d5c..a3f5c8d 100644 --- a/ash/shell/content_client/shell_browser_main_parts.cc +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -26,6 +26,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/compositor/compositor.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/views/focus/accelerator_handler.h" #include "ui/views/test/test_views_delegate.h" diff --git a/ash/test/test_suite.cc b/ash/test/test_suite.cc index 8cd5d6f..2cfaf52 100644 --- a/ash/test/test_suite.cc +++ b/ash/test/test_suite.cc @@ -10,6 +10,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/compositor/compositor_setup.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/gfx/gfx_paths.h" #if defined(OS_MACOSX) @@ -35,10 +36,12 @@ void AuraShellTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); + ui::CompositorTestSupport::Initialize(); ui::SetupTestCompositor(); } void AuraShellTestSuite::Shutdown() { + ui::CompositorTestSupport::Terminate(); ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); } diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 3133175..1dbcaed 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -301,6 +301,7 @@ '../ipc/ipc.gyp:test_support_ipc', '../ppapi/ppapi_internal.gyp:ppapi_shared', '../third_party/leveldatabase/leveldatabase.gyp:leveldatabase', + '../ui/compositor/compositor.gyp:compositor_test_support', ], 'export_dependent_settings': [ 'renderer', diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc index e0af8be..f3948d1 100644 --- a/chrome/test/base/view_event_test_base.cc +++ b/chrome/test/base/view_event_test_base.cc @@ -11,6 +11,7 @@ #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/browser_thread.h" #include "ui/base/ime/text_input_test_support.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/ui_controls/ui_controls.h" #include "ui/views/view.h" #include "ui/views/widget/widget.h" @@ -85,6 +86,7 @@ void ViewEventTestBase::Done() { void ViewEventTestBase::SetUp() { ui::TextInputTestSupport::Initialize(); + ui::CompositorTestSupport::Initialize(); #if defined(USE_ASH) ash::Shell::CreateInstance(new ash::test::TestShellDelegate()); #endif @@ -107,6 +109,7 @@ void ViewEventTestBase::TearDown() { #if defined(USE_AURA) aura::Env::DeleteInstance(); #endif + ui::CompositorTestSupport::Terminate(); ui::TextInputTestSupport::Shutdown(); } diff --git a/ui/app_list/app_list.gyp b/ui/app_list/app_list.gyp index 7fc5406..c40236c 100644 --- a/ui/app_list/app_list.gyp +++ b/ui/app_list/app_list.gyp @@ -76,6 +76,7 @@ '../../skia/skia.gyp:skia', '../../testing/gtest.gyp:gtest', '../compositor/compositor.gyp:compositor', + '../compositor/compositor.gyp:compositor_test_support', '../views/views.gyp:views', '../views/views.gyp:views_test_support', 'app_list', diff --git a/ui/app_list/test/app_list_test_suite.cc b/ui/app_list/test/app_list_test_suite.cc index 528d387..e38a348 100644 --- a/ui/app_list/test/app_list_test_suite.cc +++ b/ui/app_list/test/app_list_test_suite.cc @@ -7,6 +7,7 @@ #include "ui/base/ui_base_paths.h" #include "ui/base/resource/resource_bundle.h" #include "ui/compositor/compositor_setup.h" +#include "ui/compositor/test/compositor_test_support.h" namespace app_list { namespace test { @@ -24,10 +25,12 @@ void AppListTestSuite::Initialize() { // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); + ui::CompositorTestSupport::Initialize(); ui::SetupTestCompositor(); } void AppListTestSuite::Shutdown() { + ui::CompositorTestSupport::Terminate(); ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); diff --git a/ui/aura/aura.gyp b/ui/aura/aura.gyp index 69bbc6c..45f4da0 100644 --- a/ui/aura/aura.gyp +++ b/ui/aura/aura.gyp @@ -197,6 +197,7 @@ '../../third_party/icu/icu.gyp:icui18n', '../../third_party/icu/icu.gyp:icuuc', '../compositor/compositor.gyp:compositor', + '../compositor/compositor.gyp:compositor_test_support', '../ui.gyp:ui', '../ui.gyp:ui_resources', '../../ipc/ipc.gyp:ipc', @@ -220,6 +221,7 @@ '../../third_party/icu/icu.gyp:icui18n', '../../third_party/icu/icu.gyp:icuuc', '../compositor/compositor.gyp:compositor', + '../compositor/compositor.gyp:compositor_test_support', '../ui.gyp:ui', '../ui.gyp:ui_resources', 'aura', @@ -240,6 +242,7 @@ '../../chrome/chrome_resources.gyp:packed_resources', '../../skia/skia.gyp:skia', '../../testing/gtest.gyp:gtest', + '../compositor/compositor.gyp:compositor_test_support', '../compositor/compositor.gyp:compositor', '../gl/gl.gyp:gl', '../ui.gyp:ui', diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc index 20cd4dc..eb620f0 100644 --- a/ui/aura/bench/bench_main.cc +++ b/ui/aura/bench/bench_main.cc @@ -26,6 +26,7 @@ #include "ui/compositor/compositor_observer.h" #include "ui/compositor/debug_utils.h" #include "ui/compositor/layer.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/gfx/canvas.h" #include "ui/gfx/rect.h" #include "ui/gfx/skia_util.h" @@ -296,6 +297,7 @@ int main(int argc, char** argv) { ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); MessageLoop message_loop(MessageLoop::TYPE_UI); + ui::CompositorTestSupport::Initialize(); aura::Env::GetInstance(); aura::SetUseFullscreenHostWindow(true); aura::TestScreen test_screen; @@ -354,5 +356,7 @@ int main(int argc, char** argv) { focus_client.reset(); root_window.reset(); + ui::CompositorTestSupport::Terminate(); + return 0; } diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index ee09d85..b1ab577 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc @@ -19,6 +19,7 @@ #include "ui/base/hit_test.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/gfx/canvas.h" #include "ui/gfx/rect.h" @@ -125,6 +126,7 @@ class DemoStackingClient : public aura::client::StackingClient { int DemoMain() { // Create the message-loop here before creating the root window. MessageLoop message_loop(MessageLoop::TYPE_UI); + ui::CompositorTestSupport::Initialize(); aura::Env::GetInstance(); aura::TestScreen test_screen; gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, &test_screen); @@ -161,6 +163,8 @@ int DemoMain() { root_window->ShowRootWindow(); MessageLoopForUI::current()->Run(); + ui::CompositorTestSupport::Terminate(); + return 0; } diff --git a/ui/aura/test/test_suite.cc b/ui/aura/test/test_suite.cc index a0ac7e4..f74757d 100644 --- a/ui/aura/test/test_suite.cc +++ b/ui/aura/test/test_suite.cc @@ -10,6 +10,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/compositor/compositor_setup.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/gfx/gfx_paths.h" #include "ui/gl/gl_implementation.h" @@ -28,11 +29,13 @@ void AuraTestSuite::Initialize() { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); + ui::CompositorTestSupport::Initialize(); ui::SetupTestCompositor(); } void AuraTestSuite::Shutdown() { + ui::CompositorTestSupport::Terminate(); ui::ResourceBundle::CleanupSharedInstance(); base::TestSuite::Shutdown(); diff --git a/ui/compositor/compositor.gyp b/ui/compositor/compositor.gyp index 9f9e259b..c65ffe1 100644 --- a/ui/compositor/compositor.gyp +++ b/ui/compositor/compositor.gyp @@ -69,6 +69,30 @@ ], }, { + 'target_name': 'compositor_test_support', + 'type': 'static_library', + 'dependencies': [ + '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/webkit/support/webkit_support.gyp:webkit_support', + '<(DEPTH)/third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:webkit', + ], + 'sources': [ + 'test/compositor_test_support.cc', + 'test/compositor_test_support.h', + ], + 'conditions': [ + ['os_posix == 1 and OS != "mac"', { + 'conditions': [ + ['linux_use_tcmalloc==1', { + 'dependencies': [ + '<(DEPTH)/base/allocator/allocator.gyp:allocator', + ], + }], + ], + }], + ], + }, + { 'target_name': 'compositor_unittests', 'type': 'executable', 'dependencies': [ @@ -81,6 +105,7 @@ '<(DEPTH)/ui/ui.gyp:ui', '<(DEPTH)/ui/ui.gyp:ui_resources', 'compositor', + 'compositor_test_support', ], 'sources': [ 'layer_animation_element_unittest.cc', diff --git a/ui/compositor/test/compositor_test_support.cc b/ui/compositor/test/compositor_test_support.cc new file mode 100644 index 0000000..0ac2609 --- /dev/null +++ b/ui/compositor/test/compositor_test_support.cc @@ -0,0 +1,60 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/compositor/test/compositor_test_support.h" + +#include "base/compiler_specific.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebKit.h" +#include "webkit/glue/webkitplatformsupport_impl.h" + +namespace ui { + +class CompositorTestPlatformSupport: + public NON_EXPORTED_BASE(webkit_glue::WebKitPlatformSupportImpl) { + public: + virtual string16 GetLocalizedString(int message_id) OVERRIDE { + return string16(); + } + + virtual base::StringPiece GetDataResource( + int resource_id, + ui::ScaleFactor scale_factor) OVERRIDE { + return base::StringPiece(); + } + + virtual void GetPlugins( + bool refresh, std::vector<webkit::WebPluginInfo>* plugins) OVERRIDE { + } + + virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader( + const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info) + OVERRIDE { + NOTREACHED(); + return NULL; + } + + virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge( + WebKit::WebSocketStreamHandle* handle, + webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE { + NOTREACHED(); + return NULL; + } +}; + +static CompositorTestPlatformSupport* g_webkit_support; + +void CompositorTestSupport::Initialize() { + DCHECK(!g_webkit_support); + g_webkit_support = new CompositorTestPlatformSupport; + WebKit::initialize(g_webkit_support); +} + +void CompositorTestSupport::Terminate() { + DCHECK(g_webkit_support); + WebKit::shutdown(); + delete g_webkit_support; + g_webkit_support = NULL; +} + +} // namespace ui diff --git a/ui/compositor/test/compositor_test_support.h b/ui/compositor/test/compositor_test_support.h new file mode 100644 index 0000000..e092340 --- /dev/null +++ b/ui/compositor/test/compositor_test_support.h @@ -0,0 +1,20 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_COMPOSITOR_TEST_COMPOSITOR_TEST_SUPPORT_H_ +#define UI_COMPOSITOR_TEST_COMPOSITOR_TEST_SUPPORT_H_ + +namespace ui { + +class CompositorTestSupport { + public: + // Called by programs that want to use a real compositor, + // but skip the typical initialization of browser_main.cc. + static void Initialize(); + static void Terminate(); +}; + +} // namespace ui + +#endif // UI_COMPOSITOR_TEST_COMPOSITOR_TEST_SUPPORT_H_ diff --git a/ui/compositor/test/test_suite.cc b/ui/compositor/test/test_suite.cc index ec20b36..5b2f052 100644 --- a/ui/compositor/test/test_suite.cc +++ b/ui/compositor/test/test_suite.cc @@ -7,6 +7,7 @@ #include "base/message_loop.h" #include "ui/base/ui_base_paths.h" #include "ui/compositor/compositor.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/gfx/gfx_paths.h" #include "ui/gl/gl_implementation.h" @@ -27,11 +28,13 @@ void CompositorTestSuite::Initialize() { gfx::RegisterPathProvider(); message_loop_.reset(new MessageLoop(MessageLoop::TYPE_UI)); + CompositorTestSupport::Initialize(); Compositor::Initialize(false); } void CompositorTestSuite::Shutdown() { Compositor::Terminate(); + CompositorTestSupport::Terminate(); message_loop_.reset(); base::TestSuite::Shutdown(); diff --git a/ui/views/run_all_unittests.cc b/ui/views/run_all_unittests.cc index ef4b709..0482acb 100644 --- a/ui/views/run_all_unittests.cc +++ b/ui/views/run_all_unittests.cc @@ -8,6 +8,7 @@ #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_paths.h" #include "ui/compositor/compositor_setup.h" +#include "ui/compositor/test/compositor_test_support.h" #include "ui/views/view.h" class ViewTestSuite : public base::TestSuite { @@ -21,9 +22,14 @@ class ViewTestSuite : public base::TestSuite { ui::RegisterPathProvider(); ui::ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL); + ui::CompositorTestSupport::Initialize(); ui::SetupTestCompositor(); } + virtual void Shutdown() OVERRIDE { + ui::CompositorTestSupport::Terminate(); + } + private: DISALLOW_COPY_AND_ASSIGN(ViewTestSuite); }; diff --git a/ui/views/views.gyp b/ui/views/views.gyp index 07a9d66..16af3ef 100644 --- a/ui/views/views.gyp +++ b/ui/views/views.gyp @@ -613,6 +613,7 @@ '../../third_party/icu/icu.gyp:icuuc', '../base/strings/ui_strings.gyp:ui_strings', '../compositor/compositor.gyp:compositor', + '../compositor/compositor.gyp:compositor_test_support', '../ui.gyp:ui', '../ui.gyp:ui_resources', '../ui.gyp:ui_test_support', @@ -929,6 +930,7 @@ ['use_aura==1', { 'dependencies': [ '../compositor/compositor.gyp:compositor', + '../compositor/compositor.gyp:compositor_test_support', ], }], ['OS=="win"', { diff --git a/webkit/gpu/webkit_gpu.gypi b/webkit/gpu/webkit_gpu.gypi index 626fa37..85e1846 100644 --- a/webkit/gpu/webkit_gpu.gypi +++ b/webkit/gpu/webkit_gpu.gypi @@ -18,7 +18,6 @@ '<(DEPTH)/gpu/gpu.gyp:gles2_implementation', '<(DEPTH)/third_party/angle/src/build_angle.gyp:translator_glsl', '<(DEPTH)/ui/gl/gl.gyp:gl', - '<(DEPTH)/webkit/support/webkit_support.gyp:glue', ], 'include_dirs': [ '<(DEPTH)/skia/config', |