| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include <public/WebLayerTreeView.h> | 7 #include <public/WebLayerTreeView.h> |
| 8 | 8 |
| 9 #include "CompositorFakeWebGraphicsContext3D.h" | 9 #include "CompositorFakeWebGraphicsContext3D.h" |
| 10 #include "FakeWebCompositorOutputSurface.h" | 10 #include "FakeWebCompositorOutputSurface.h" |
| 11 #include "WebLayerTreeViewTestCommon.h" | 11 #include "WebLayerTreeViewTestCommon.h" |
| 12 #include <gmock/gmock.h> | 12 #include <gmock/gmock.h> |
| 13 #include <public/Platform.h> | 13 #include <public/Platform.h> |
| 14 #include <public/WebCompositor.h> | 14 #include <public/WebCompositorSupport.h> |
| 15 #include <public/WebLayer.h> | 15 #include <public/WebLayer.h> |
| 16 #include <public/WebLayerTreeViewClient.h> | 16 #include <public/WebLayerTreeViewClient.h> |
| 17 #include <public/WebThread.h> | 17 #include <public/WebThread.h> |
| 18 #include <wtf/RefCounted.h> | 18 #include <wtf/RefCounted.h> |
| 19 #include <wtf/RefPtr.h> | 19 #include <wtf/RefPtr.h> |
| 20 | 20 |
| 21 using namespace WebKit; | 21 using namespace WebKit; |
| 22 using testing::Mock; | 22 using testing::Mock; |
| 23 using testing::Test; | 23 using testing::Test; |
| 24 | 24 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 46 ASSERT_TRUE(m_view = adoptPtr(WebLayerTreeView::create(client(), *m_root
Layer, WebLayerTreeView::Settings()))); | 46 ASSERT_TRUE(m_view = adoptPtr(WebLayerTreeView::create(client(), *m_root
Layer, WebLayerTreeView::Settings()))); |
| 47 m_view->setSurfaceReady(); | 47 m_view->setSurfaceReady(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 virtual void TearDown() | 50 virtual void TearDown() |
| 51 { | 51 { |
| 52 Mock::VerifyAndClearExpectations(client()); | 52 Mock::VerifyAndClearExpectations(client()); |
| 53 | 53 |
| 54 m_rootLayer.clear(); | 54 m_rootLayer.clear(); |
| 55 m_view.clear(); | 55 m_view.clear(); |
| 56 WebKit::WebCompositor::shutdown(); | 56 WebKit::Platform::current()->compositorSupport()->shutdown(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 OwnPtr<WebLayer> m_rootLayer; | 60 OwnPtr<WebLayer> m_rootLayer; |
| 61 OwnPtr<WebLayerTreeView> m_view; | 61 OwnPtr<WebLayerTreeView> m_view; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class WebLayerTreeViewSingleThreadTest : public WebLayerTreeViewTestBase { | 64 class WebLayerTreeViewSingleThreadTest : public WebLayerTreeViewTestBase { |
| 65 protected: | 65 protected: |
| 66 void composite() | 66 void composite() |
| 67 { | 67 { |
| 68 m_view->composite(); | 68 m_view->composite(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual void initializeCompositor() OVERRIDE | 71 virtual void initializeCompositor() OVERRIDE |
| 72 { | 72 { |
| 73 WebKit::WebCompositor::initialize(0); | 73 WebKit::Platform::current()->compositorSupport()->initialize(0); |
| 74 } | 74 } |
| 75 | 75 |
| 76 virtual WebLayerTreeViewClient* client() OVERRIDE | 76 virtual WebLayerTreeViewClient* client() OVERRIDE |
| 77 { | 77 { |
| 78 return &m_client; | 78 return &m_client; |
| 79 } | 79 } |
| 80 | 80 |
| 81 MockWebLayerTreeViewClient m_client; | 81 MockWebLayerTreeViewClient m_client; |
| 82 }; | 82 }; |
| 83 | 83 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 RefPtr<CancelableTaskWrapper> timeoutTask = adoptRef(new CancelableTaskW
rapper(adoptPtr(new TimeoutTask()))); | 142 RefPtr<CancelableTaskWrapper> timeoutTask = adoptRef(new CancelableTaskW
rapper(adoptPtr(new TimeoutTask()))); |
| 143 WebKit::Platform::current()->currentThread()->postDelayedTask(timeoutTas
k->createTask(), 5000); | 143 WebKit::Platform::current()->currentThread()->postDelayedTask(timeoutTas
k->createTask(), 5000); |
| 144 WebKit::Platform::current()->currentThread()->enterRunLoop(); | 144 WebKit::Platform::current()->currentThread()->enterRunLoop(); |
| 145 timeoutTask->cancel(); | 145 timeoutTask->cancel(); |
| 146 m_view->finishAllRendering(); | 146 m_view->finishAllRendering(); |
| 147 } | 147 } |
| 148 | 148 |
| 149 virtual void initializeCompositor() OVERRIDE | 149 virtual void initializeCompositor() OVERRIDE |
| 150 { | 150 { |
| 151 m_webThread = adoptPtr(WebKit::Platform::current()->createThread("WebLay
erTreeViewTest")); | 151 m_webThread = adoptPtr(WebKit::Platform::current()->createThread("WebLay
erTreeViewTest")); |
| 152 WebCompositor::initialize(m_webThread.get()); | 152 WebKit::Platform::current()->compositorSupport()->initialize(m_webThread
.get()); |
| 153 } | 153 } |
| 154 | 154 |
| 155 virtual WebLayerTreeViewClient* client() OVERRIDE | 155 virtual WebLayerTreeViewClient* client() OVERRIDE |
| 156 { | 156 { |
| 157 return &m_client; | 157 return &m_client; |
| 158 } | 158 } |
| 159 | 159 |
| 160 MockWebLayerTreeViewClientForThreadedTests m_client; | 160 MockWebLayerTreeViewClientForThreadedTests m_client; |
| 161 OwnPtr<WebThread> m_webThread; | 161 OwnPtr<WebThread> m_webThread; |
| 162 }; | 162 }; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 178 | 178 |
| 179 EXPECT_CALL(m_client, willBeginFrame()); | 179 EXPECT_CALL(m_client, willBeginFrame()); |
| 180 EXPECT_CALL(m_client, willCommit()); | 180 EXPECT_CALL(m_client, willCommit()); |
| 181 EXPECT_CALL(m_client, didCommit()); | 181 EXPECT_CALL(m_client, didCommit()); |
| 182 EXPECT_CALL(m_client, didBeginFrame()); | 182 EXPECT_CALL(m_client, didBeginFrame()); |
| 183 | 183 |
| 184 composite(); | 184 composite(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 } // namespace | 187 } // namespace |
| OLD | NEW |