From 7081f9ffee03cad17be0ab5ad20bda69a30dd8fe Mon Sep 17 00:00:00 2001 From: "jamesr@chromium.org" Date: Tue, 18 Sep 2012 20:58:27 +0000 Subject: 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 --- cc/test/run_all_unittests.cc | 56 ++------------------------------------------ 1 file changed, 2 insertions(+), 54 deletions(-) (limited to 'cc/test/run_all_unittests.cc') 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 -#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(current_thread_slot_.Get()); - if (thread) - return (thread); - - scoped_refptr 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(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(); -- cgit v1.1