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

Unified Diff: webkit/compositor_bindings/WebLayerTreeViewTest.cpp

Issue 11192050: Rename compositor bindings filenames to Chromium style (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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
Index: webkit/compositor_bindings/WebLayerTreeViewTest.cpp
diff --git a/webkit/compositor_bindings/WebLayerTreeViewTest.cpp b/webkit/compositor_bindings/WebLayerTreeViewTest.cpp
deleted file mode 100644
index 3fd09151f2caf0529e73cc4ef91bbaf675627cfb..0000000000000000000000000000000000000000
--- a/webkit/compositor_bindings/WebLayerTreeViewTest.cpp
+++ /dev/null
@@ -1,192 +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 "WebLayerImpl.h"
-#include "WebLayerTreeViewImpl.h"
-#include "WebLayerTreeViewTestCommon.h"
-#include "base/memory/ref_counted.h"
-#include "cc/test/compositor_fake_web_graphics_context_3d.h"
-#include "cc/test/fake_web_compositor_output_surface.h"
-#include "testing/gmock/include/gmock/gmock.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSupport.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebLayer.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeView.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebLayerTreeViewClient.h"
-#include "third_party/WebKit/Source/Platform/chromium/public/WebThread.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.reset(new WebLayerImpl);
- m_view.reset(new WebLayerTreeViewImpl(client()));
- ASSERT_TRUE(m_view->initialize(WebLayerTreeView::Settings()));
- m_view->setRootLayer(*m_rootLayer);
- m_view->setSurfaceReady();
- }
-
- virtual void TearDown()
- {
- Mock::VerifyAndClearExpectations(client());
-
- m_rootLayer.reset();
- m_view.reset();
- WebKit::Platform::current()->compositorSupport()->shutdown();
- }
-
-protected:
- scoped_ptr<WebLayer> m_rootLayer;
- scoped_ptr<WebLayerTreeViewImpl> m_view;
-};
-
-class WebLayerTreeViewSingleThreadTest : public WebLayerTreeViewTestBase {
-protected:
- void composite()
- {
- m_view->composite();
- }
-
- virtual void initializeCompositor() OVERRIDE
- {
- WebKit::Platform::current()->compositorSupport()->initialize(0);
- }
-
- virtual WebLayerTreeViewClient* client() OVERRIDE
- {
- return &m_client;
- }
-
- MockWebLayerTreeViewClient m_client;
-};
-
-class CancelableTaskWrapper : public base::RefCounted<CancelableTaskWrapper> {
- class Task : public WebThread::Task {
- public:
- Task(CancelableTaskWrapper* cancelableTask)
- : m_cancelableTask(cancelableTask)
- {
- }
-
- private:
- virtual void run() OVERRIDE
- {
- m_cancelableTask->runIfNotCanceled();
- }
-
- scoped_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:
- friend class base::RefCounted<CancelableTaskWrapper>;
- ~CancelableTaskWrapper() { }
-
- 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();
- scoped_refptr<CancelableTaskWrapper> timeoutTask(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.reset(WebKit::Platform::current()->createThread("WebLayerTreeViewTest"));
- WebKit::Platform::current()->compositorSupport()->initialize(m_webThread.get());
- }
-
- virtual WebLayerTreeViewClient* client() OVERRIDE
- {
- return &m_client;
- }
-
- MockWebLayerTreeViewClientForThreadedTests m_client;
- scoped_ptr<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_bindings/WebLayerTreeViewImpl.cpp ('k') | webkit/compositor_bindings/WebScrollbarLayerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698