summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-29 07:17:01 +0000
committerkinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-29 07:17:01 +0000
commit99e1e1e28de1d78e145352558892f2a12413896d (patch)
tree244a6a21b78f487531fead1c9a0e8d0e50069f84 /ui
parenta38edc462009e1591e4629b1e17c45d65d324ac5 (diff)
downloadchromium_src-99e1e1e28de1d78e145352558892f2a12413896d.zip
chromium_src-99e1e1e28de1d78e145352558892f2a12413896d.tar.gz
chromium_src-99e1e1e28de1d78e145352558892f2a12413896d.tar.bz2
Revert 202787 "Remove unnecessary ui::CompositorTestSupport"
Suspected to break Linux ChromeOS build http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromiumOS%20Full/builds/19953/steps/compile/logs/stdio obj/ui/snapshot/test/snapshot_unittests.run_all_unittests.o:run_all_unittests.cc:function main:error: undefined reference to 'ui::test::CompositorTestSuite::CompositorTestSuite(int, char**)' obj/ui/snapshot/test/snapshot_unittests.run_all_unittests.o:run_all_unittests.cc:function main:error: undefined reference to 'ui::test::CompositorTestSuite::~CompositorTestSuite()' > Remove unnecessary ui::CompositorTestSupport > > The ui::CompositorTestSupport class existed to initialize WebKit since > ui::Compositor depends on cc which used to depend on WebKit being initialized > to function properly. cc no longer has this requirement, so this class is > unnecessary. > > R=piman, sky > > Review URL: https://chromiumcodereview.appspot.com/14744016 TBR=jamesr@chromium.org Review URL: https://codereview.chromium.org/15838015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202790 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/app_list/app_list.gyp1
-rw-r--r--ui/aura/bench/bench_main.cc4
-rw-r--r--ui/aura/demo/demo_main.cc4
-rw-r--r--ui/aura/test/test_suite.cc3
-rw-r--r--ui/compositor/compositor.gyp28
-rw-r--r--ui/compositor/test/compositor_test_support.cc60
-rw-r--r--ui/compositor/test/compositor_test_support.h20
-rw-r--r--ui/compositor/test/test_suite.cc3
-rw-r--r--ui/keyboard/keyboard.gyp1
-rw-r--r--ui/keyboard/keyboard_test_suite.cc3
-rw-r--r--ui/message_center/message_center.gyp1
-rw-r--r--ui/message_center/test/run_all_unittests.cc6
-rw-r--r--ui/snapshot/snapshot.gyp1
-rw-r--r--ui/views/run_all_unittests.cc6
-rw-r--r--ui/views/views.gyp2
15 files changed, 130 insertions, 13 deletions
diff --git a/ui/app_list/app_list.gyp b/ui/app_list/app_list.gyp
index b1128c1..8479ff7 100644
--- a/ui/app_list/app_list.gyp
+++ b/ui/app_list/app_list.gyp
@@ -143,6 +143,7 @@
'../../skia/skia.gyp:skia',
'../../testing/gtest.gyp:gtest',
'../compositor/compositor.gyp:compositor',
+ '../compositor/compositor.gyp:compositor_test_support',
'../ui.gyp:run_ui_unittests',
'app_list',
],
diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc
index 4f0afe1..e397929 100644
--- a/ui/aura/bench/bench_main.cc
+++ b/ui/aura/bench/bench_main.cc
@@ -25,6 +25,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"
@@ -301,6 +302,7 @@ int main(int argc, char** argv) {
ResourceBundle::InitSharedInstanceWithLocale("en-US", NULL);
base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
+ ui::CompositorTestSupport::Initialize();
aura::Env::GetInstance();
scoped_ptr<aura::TestScreen> test_screen(
aura::TestScreen::CreateFullscreen());
@@ -359,5 +361,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 f6d5f27..41717d2 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"
@@ -109,6 +110,7 @@ class DemoStackingClient : public aura::client::StackingClient {
int DemoMain() {
// Create the message-loop here before creating the root window.
base::MessageLoop message_loop(base::MessageLoop::TYPE_UI);
+ ui::CompositorTestSupport::Initialize();
aura::Env::GetInstance();
scoped_ptr<aura::TestScreen> test_screen(aura::TestScreen::Create());
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, test_screen.get());
@@ -145,6 +147,8 @@ int DemoMain() {
root_window->ShowRootWindow();
base::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 5b76a17..e487c9b 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 d6c48a7..226b2c4 100644
--- a/ui/compositor/compositor.gyp
+++ b/ui/compositor/compositor.gyp
@@ -79,17 +79,28 @@
'type': 'static_library',
'dependencies': [
'<(DEPTH)/base/base.gyp:base',
- '<(DEPTH)/skia/skia.gyp:skia',
- '<(DEPTH)/ui/gl/gl.gyp:gl',
- '<(DEPTH)/ui/ui.gyp:ui',
- 'compositor',
+ '<(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',
'test/test_layers.cc',
'test/test_layers.h',
'test/test_suite.cc',
'test/test_suite.h',
],
+ 'conditions': [
+ ['os_posix == 1 and OS != "mac"', {
+ 'conditions': [
+ ['linux_use_tcmalloc==1', {
+ 'dependencies': [
+ '<(DEPTH)/base/allocator/allocator.gyp:allocator',
+ ],
+ }],
+ ],
+ }],
+ ],
},
{
'target_name': 'compositor_unittests',
@@ -133,15 +144,6 @@
'<(DEPTH)/third_party/mesa/mesa.gyp:osmesa',
],
}],
- ['os_posix == 1 and OS != "mac"', {
- 'conditions': [
- ['linux_use_tcmalloc==1', {
- 'dependencies': [
- '<(DEPTH)/base/allocator/allocator.gyp:allocator',
- ],
- }],
- ],
- }],
],
},
],
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 e6ca68c..516cafc 100644
--- a/ui/compositor/test/test_suite.cc
+++ b/ui/compositor/test/test_suite.cc
@@ -9,6 +9,7 @@
#include "ui/base/ui_base_paths.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/compositor_switches.h"
+#include "ui/compositor/test/compositor_test_support.h"
#include "ui/gfx/gfx_paths.h"
#include "ui/gl/gl_implementation.h"
@@ -36,11 +37,13 @@ void CompositorTestSuite::Initialize() {
gfx::RegisterPathProvider();
message_loop_.reset(new base::MessageLoop(base::MessageLoop::TYPE_UI));
+ CompositorTestSupport::Initialize();
Compositor::Initialize();
}
void CompositorTestSuite::Shutdown() {
Compositor::Terminate();
+ CompositorTestSupport::Terminate();
message_loop_.reset();
base::TestSuite::Shutdown();
diff --git a/ui/keyboard/keyboard.gyp b/ui/keyboard/keyboard.gyp
index 0995fd85..1953692 100644
--- a/ui/keyboard/keyboard.gyp
+++ b/ui/keyboard/keyboard.gyp
@@ -83,6 +83,7 @@
'../aura/aura.gyp:aura',
'../aura/aura.gyp:aura_test_support',
'../compositor/compositor.gyp:compositor',
+ '../compositor/compositor.gyp:compositor_test_support',
'../ui.gyp:run_ui_unittests',
'../ui.gyp:ui',
'keyboard',
diff --git a/ui/keyboard/keyboard_test_suite.cc b/ui/keyboard/keyboard_test_suite.cc
index 5b4db504d..f756a13 100644
--- a/ui/keyboard/keyboard_test_suite.cc
+++ b/ui/keyboard/keyboard_test_suite.cc
@@ -5,6 +5,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/compositor/compositor_setup.h"
+#include "ui/compositor/test/compositor_test_support.h"
#include "ui/test/test_suite.h"
class KeyboardTestSuite : public ui::test::UITestSuite {
@@ -24,10 +25,12 @@ class KeyboardTestSuite : public ui::test::UITestSuite {
void KeyboardTestSuite::Initialize() {
ui::test::UITestSuite::Initialize();
+ ui::CompositorTestSupport::Initialize();
ui::SetupTestCompositor();
}
void KeyboardTestSuite::Shutdown() {
+ ui::CompositorTestSupport::Terminate();
ui::test::UITestSuite::Shutdown();
}
diff --git a/ui/message_center/message_center.gyp b/ui/message_center/message_center.gyp
index 18e7c87..7e9652f 100644
--- a/ui/message_center/message_center.gyp
+++ b/ui/message_center/message_center.gyp
@@ -157,6 +157,7 @@
# Compositor is needed by message_center_view_unittest.cc
# and for the fonts used by bounded_label_unittest.cc.
'../compositor/compositor.gyp:compositor',
+ '../compositor/compositor.gyp:compositor_test_support',
'../views/views.gyp:views',
'../views/views.gyp:views_test_support',
],
diff --git a/ui/message_center/test/run_all_unittests.cc b/ui/message_center/test/run_all_unittests.cc
index 03fe7fe..0c2e56a 100644
--- a/ui/message_center/test/run_all_unittests.cc
+++ b/ui/message_center/test/run_all_unittests.cc
@@ -7,6 +7,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/test/test_suite.h"
#include "ui/views/view.h"
@@ -28,12 +29,17 @@ void MessageCenterTestSuite::Initialize() {
ui::test::UITestSuite::Initialize();
#if !defined(OS_MACOSX)
+ ui::CompositorTestSupport::Initialize();
ui::SetupTestCompositor();
#endif
}
void MessageCenterTestSuite::Shutdown() {
ui::test::UITestSuite::Shutdown();
+
+#if !defined(OS_MACOSX)
+ ui::CompositorTestSupport::Terminate();
+#endif
}
int main(int argc, char** argv) {
diff --git a/ui/snapshot/snapshot.gyp b/ui/snapshot/snapshot.gyp
index 8a252ed..9f71d0d 100644
--- a/ui/snapshot/snapshot.gyp
+++ b/ui/snapshot/snapshot.gyp
@@ -63,6 +63,7 @@
'../../base/base.gyp:test_support_base',
'../aura/aura.gyp:aura_test_support',
'../compositor/compositor.gyp:compositor',
+ '../compositor/compositor.gyp:compositor_test_support',
],
}],
],
diff --git a/ui/views/run_all_unittests.cc b/ui/views/run_all_unittests.cc
index cd73011..d2962b4 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 {
@@ -20,9 +21,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 08eaee9..635ed67 100644
--- a/ui/views/views.gyp
+++ b/ui/views/views.gyp
@@ -659,6 +659,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',
@@ -997,6 +998,7 @@
['use_aura==1', {
'dependencies': [
'../compositor/compositor.gyp:compositor',
+ '../compositor/compositor.gyp:compositor_test_support',
],
}],
['OS=="win"', {