Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1077)

Unified Diff: webkit/compositor/WebLayerTreeViewTest.cpp

Issue 10920056: Make cc_unittests and webkit_compositor_unittests executable always (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename to webkit_compositor_bindings Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/compositor/WebLayerTreeViewImpl.cpp ('k') | webkit/compositor/WebScrollbarLayerImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/compositor/WebLayerTreeViewTest.cpp
diff --git a/webkit/compositor/WebLayerTreeViewTest.cpp b/webkit/compositor/WebLayerTreeViewTest.cpp
deleted file mode 100644
index d09b8067c8937fa7c3e069b10a5b0da3488d0ee9..0000000000000000000000000000000000000000
--- a/webkit/compositor/WebLayerTreeViewTest.cpp
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright 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 "config.h"
-
-#include <public/WebLayerTreeView.h>
-
-#include "CompositorFakeWebGraphicsContext3D.h"
-#include "FakeWebCompositorOutputSurface.h"
-#include "WebLayerTreeViewTestCommon.h"
-#include <gmock/gmock.h>
-#include <public/Platform.h>
-#include <public/WebCompositor.h>
-#include <public/WebLayer.h>
-#include <public/WebLayerTreeViewClient.h>
-#include <public/WebThread.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-using namespace WebKit;
-using testing::Mock;
-using testing::Test;
-
-namespace {
-
-class MockWebLayerTreeViewClientForThreadedTests : public MockWebLayerTreeViewClient {
-public:
- virtual void didBeginFrame() OVERRIDE
- {
- WebKit::Platform::current()->currentThread()->exitRunLoop();
- MockWebLayerTreeViewClient::didBeginFrame();
- }
-};
-
-class WebLayerTreeViewTestBase : public Test {
-protected:
- virtual void initializeCompositor() = 0;
- virtual WebLayerTreeViewClient* client() = 0;
-
-public:
- virtual void SetUp()
- {
- initializeCompositor();
- m_rootLayer = adoptPtr(WebLayer::create());
- ASSERT_TRUE(m_view = adoptPtr(WebLayerTreeView::create(client(), *m_rootLayer, WebLayerTreeView::Settings())));
- m_view->setSurfaceReady();
- }
-
- virtual void TearDown()
- {
- Mock::VerifyAndClearExpectations(client());
-
- m_rootLayer.clear();
- m_view.clear();
- WebKit::WebCompositor::shutdown();
- }
-
-protected:
- OwnPtr<WebLayer> m_rootLayer;
- OwnPtr<WebLayerTreeView> m_view;
-};
-
-class WebLayerTreeViewSingleThreadTest : public WebLayerTreeViewTestBase {
-protected:
- void composite()
- {
- m_view->composite();
- }
-
- virtual void initializeCompositor() OVERRIDE
- {
- WebKit::WebCompositor::initialize(0);
- }
-
- virtual WebLayerTreeViewClient* client() OVERRIDE
- {
- return &m_client;
- }
-
- MockWebLayerTreeViewClient m_client;
-};
-
-class CancelableTaskWrapper : public RefCounted<CancelableTaskWrapper> {
- class Task : public WebThread::Task {
- public:
- Task(CancelableTaskWrapper* cancelableTask)
- : m_cancelableTask(cancelableTask)
- {
- }
-
- private:
- virtual void run() OVERRIDE
- {
- m_cancelableTask->runIfNotCanceled();
- }
-
- RefPtr<CancelableTaskWrapper> m_cancelableTask;
- };
-
-public:
- CancelableTaskWrapper(PassOwnPtr<WebThread::Task> task)
- : m_task(task)
- {
- }
-
- void cancel()
- {
- m_task.clear();
- }
-
- WebThread::Task* createTask()
- {
- ASSERT(m_task);
- return new Task(this);
- }
-
- void runIfNotCanceled()
- {
- if (!m_task)
- return;
- m_task->run();
- m_task.clear();
- }
-
-private:
- OwnPtr<WebThread::Task> m_task;
-};
-
-class WebLayerTreeViewThreadedTest : public WebLayerTreeViewTestBase {
-protected:
- class TimeoutTask : public WebThread::Task {
- virtual void run() OVERRIDE
- {
- WebKit::Platform::current()->currentThread()->exitRunLoop();
- }
- };
-
- void composite()
- {
- m_view->setNeedsRedraw();
- RefPtr<CancelableTaskWrapper> timeoutTask = adoptRef(new CancelableTaskWrapper(adoptPtr(new TimeoutTask())));
- WebKit::Platform::current()->currentThread()->postDelayedTask(timeoutTask->createTask(), 5000);
- WebKit::Platform::current()->currentThread()->enterRunLoop();
- timeoutTask->cancel();
- m_view->finishAllRendering();
- }
-
- virtual void initializeCompositor() OVERRIDE
- {
- m_webThread = adoptPtr(WebKit::Platform::current()->createThread("WebLayerTreeViewTest"));
- WebCompositor::initialize(m_webThread.get());
- }
-
- virtual WebLayerTreeViewClient* client() OVERRIDE
- {
- return &m_client;
- }
-
- MockWebLayerTreeViewClientForThreadedTests m_client;
- OwnPtr<WebThread> m_webThread;
-};
-
-TEST_F(WebLayerTreeViewSingleThreadTest, InstrumentationCallbacks)
-{
- ::testing::InSequence dummy;
-
- EXPECT_CALL(m_client, willCommit());
- EXPECT_CALL(m_client, didCommit());
- EXPECT_CALL(m_client, didBeginFrame());
-
- composite();
-}
-
-TEST_F(WebLayerTreeViewThreadedTest, InstrumentationCallbacks)
-{
- ::testing::InSequence dummy;
-
- EXPECT_CALL(m_client, willBeginFrame());
- EXPECT_CALL(m_client, willCommit());
- EXPECT_CALL(m_client, didCommit());
- EXPECT_CALL(m_client, didBeginFrame());
-
- composite();
-}
-
-} // namespace
« no previous file with comments | « webkit/compositor/WebLayerTreeViewImpl.cpp ('k') | webkit/compositor/WebScrollbarLayerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698