summaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-18 20:58:27 +0000
committerjamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-18 20:58:27 +0000
commit7081f9ffee03cad17be0ab5ad20bda69a30dd8fe (patch)
treeaaface38c8a889d3ad9685399dfbb0ca3b28b997 /cc
parenta313db565907985c49d189bd9f051721e1dfe994 (diff)
downloadchromium_src-7081f9ffee03cad17be0ab5ad20bda69a30dd8fe.zip
chromium_src-7081f9ffee03cad17be0ab5ad20bda69a30dd8fe.tar.gz
chromium_src-7081f9ffee03cad17be0ab5ad20bda69a30dd8fe.tar.bz2
Enable webkit_compositor_bindings_unittests in component builds
This shares the compositor setup code from cc_unittests so we can run webkit_compositor_bindings_unittests in component builds. BUG= Review URL: https://chromiumcodereview.appspot.com/10918281 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r--cc/cc_tests.gyp2
-rw-r--r--cc/test/run_all_unittests.cc56
-rw-r--r--cc/test/test_webkit_platform.cc53
-rw-r--r--cc/test/test_webkit_platform.h44
4 files changed, 101 insertions, 54 deletions
diff --git a/cc/cc_tests.gyp b/cc/cc_tests.gyp
index 0796afa..f8d4244 100644
--- a/cc/cc_tests.gyp
+++ b/cc/cc_tests.gyp
@@ -131,6 +131,8 @@
],
'sources': [
'<@(cc_tests_support_files)',
+ 'test/test_webkit_platform.cc',
+ 'test/test_webkit_platform.h',
],
},
],
diff --git a/cc/test/run_all_unittests.cc b/cc/test/run_all_unittests.cc
index 98152ba..ca2eccd 100644
--- a/cc/test/run_all_unittests.cc
+++ b/cc/test/run_all_unittests.cc
@@ -3,67 +3,15 @@
// found in the LICENSE file.
#include "base/message_loop.h"
-#include "base/rand_util.h"
-#include "base/threading/thread_local_storage.h"
#include "base/test/test_suite.h"
+#include "cc/test/test_webkit_platform.h"
#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
-#include "webkit/compositor_bindings/web_compositor_support_impl.h"
-#include "webkit/glue/webthread_impl.h"
#include <gmock/gmock.h>
-#include "base/debug/trace_event_impl.h"
-
-using webkit_glue::WebThreadImplForMessageLoop;
-
-class TestPlatform : public WebKit::Platform {
- public:
- virtual WebKit::WebCompositorSupport* compositorSupport() {
- return &compositor_support_;
- }
-
- virtual void cryptographicallyRandomValues(
- unsigned char* buffer, size_t length) {
- base::RandBytes(buffer, length);
- }
-
- virtual WebKit::WebThread* createThread(const char* name) {
- return new webkit_glue::WebThreadImpl(name);
- }
-
- virtual WebKit::WebThread* currentThread() {
- webkit_glue::WebThreadImplForMessageLoop* thread =
- static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
- if (thread)
- return (thread);
-
- scoped_refptr<base::MessageLoopProxy> message_loop =
- base::MessageLoopProxy::current();
- if (!message_loop)
- return NULL;
-
- thread = new WebThreadImplForMessageLoop(message_loop);
- current_thread_slot_.Set(thread);
- return thread;
- }
-
- virtual double currentTime() {
- return base::Time::Now().ToDoubleT();
- }
-
- virtual double monotonicallyIncreasingTime() {
- return base::TimeTicks::Now().ToInternalValue() /
- static_cast<double>(base::Time::kMicrosecondsPerSecond);
- }
-
- private:
- base::ThreadLocalStorage::Slot current_thread_slot_;
- webkit::WebCompositorSupportImpl compositor_support_;
-};
-
int main(int argc, char** argv) {
::testing::InitGoogleMock(&argc, argv);
TestSuite testSuite(argc, argv);
- TestPlatform platform;
+ cc::TestWebKitPlatform platform;
MessageLoop message_loop;
WebKit::Platform::initialize(&platform);
int result = testSuite.Run();
diff --git a/cc/test/test_webkit_platform.cc b/cc/test/test_webkit_platform.cc
new file mode 100644
index 0000000..403ba61
--- /dev/null
+++ b/cc/test/test_webkit_platform.cc
@@ -0,0 +1,53 @@
+// 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 "cc/test/test_webkit_platform.h"
+
+namespace cc {
+
+TestWebKitPlatform::TestWebKitPlatform() {
+}
+
+TestWebKitPlatform::~TestWebKitPlatform() {
+}
+
+WebKit::WebCompositorSupport* TestWebKitPlatform::compositorSupport() {
+ return &compositor_support_;
+}
+
+void TestWebKitPlatform::cryptographicallyRandomValues(
+ unsigned char* buffer, size_t length) {
+ base::RandBytes(buffer, length);
+}
+
+WebKit::WebThread* TestWebKitPlatform::createThread(const char* name) {
+ return new webkit_glue::WebThreadImpl(name);
+}
+
+WebKit::WebThread* TestWebKitPlatform::currentThread() {
+ webkit_glue::WebThreadImplForMessageLoop* thread =
+ static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get());
+ if (thread)
+ return (thread);
+
+ scoped_refptr<base::MessageLoopProxy> message_loop =
+ base::MessageLoopProxy::current();
+ if (!message_loop)
+ return NULL;
+
+ thread = new WebThreadImplForMessageLoop(message_loop);
+ current_thread_slot_.Set(thread);
+ return thread;
+}
+
+double TestWebKitPlatform::currentTime() {
+ return base::Time::Now().ToDoubleT();
+}
+
+double TestWebKitPlatform::monotonicallyIncreasingTime() {
+ return base::TimeTicks::Now().ToInternalValue() /
+ static_cast<double>(base::Time::kMicrosecondsPerSecond);
+}
+
+}
diff --git a/cc/test/test_webkit_platform.h b/cc/test/test_webkit_platform.h
new file mode 100644
index 0000000..ee7cfa6
--- /dev/null
+++ b/cc/test/test_webkit_platform.h
@@ -0,0 +1,44 @@
+// 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 CC_TEST_TEST_WEBKIT_PLATFORM_H_
+#define CC_TEST_TEST_WEBKIT_PLATFORM_H_
+
+#include "base/rand_util.h"
+#include "base/threading/thread_local_storage.h"
+#include "cc/test/test_webkit_platform.h"
+#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
+#include "webkit/compositor_bindings/web_compositor_support_impl.h"
+#include "webkit/glue/webthread_impl.h"
+
+using webkit_glue::WebThreadImplForMessageLoop;
+
+namespace cc {
+
+class TestWebKitPlatform : public WebKit::Platform {
+ public:
+ TestWebKitPlatform();
+ virtual ~TestWebKitPlatform();
+
+ virtual WebKit::WebCompositorSupport* compositorSupport();
+
+ virtual void cryptographicallyRandomValues(
+ unsigned char* buffer, size_t length);
+
+ virtual WebKit::WebThread* createThread(const char* name);
+
+ virtual WebKit::WebThread* currentThread();
+
+ virtual double currentTime();
+
+ virtual double monotonicallyIncreasingTime();
+
+ private:
+ base::ThreadLocalStorage::Slot current_thread_slot_;
+ webkit::WebCompositorSupportImpl compositor_support_;
+};
+
+} // namespace cc
+
+#endif // CC_TEST_TEST_WEBKIT_PLATFORM_H_