OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #include <public/WebLayer.h> | 6 #include <public/WebLayer.h> |
7 | 7 |
8 #include "CompositorFakeWebGraphicsContext3D.h" | 8 #include "CompositorFakeWebGraphicsContext3D.h" |
9 #include "WebLayerImpl.h" | 9 #include "WebLayerImpl.h" |
10 #include "WebLayerTreeViewTestCommon.h" | 10 #include "WebLayerTreeViewTestCommon.h" |
11 #include <public/WebCompositor.h> | 11 #include <public/WebCompositor.h> |
12 #include <public/WebContentLayer.h> | 12 #include <public/WebContentLayer.h> |
13 #include <public/WebContentLayerClient.h> | 13 #include <public/WebContentLayerClient.h> |
14 #include <public/WebExternalTextureLayer.h> | 14 #include <public/WebExternalTextureLayer.h> |
15 #include <public/WebFloatPoint.h> | 15 #include <public/WebFloatPoint.h> |
16 #include <public/WebFloatRect.h> | 16 #include <public/WebFloatRect.h> |
| 17 #include <public/WebLayerScrollClient.h> |
17 #include <public/WebLayerTreeView.h> | 18 #include <public/WebLayerTreeView.h> |
18 #include <public/WebLayerTreeViewClient.h> | 19 #include <public/WebLayerTreeViewClient.h> |
19 #include <public/WebRect.h> | 20 #include <public/WebRect.h> |
20 #include <public/WebSize.h> | 21 #include <public/WebSize.h> |
21 | 22 |
22 #include <gmock/gmock.h> | 23 #include <gmock/gmock.h> |
23 | 24 |
24 using namespace WebKit; | 25 using namespace WebKit; |
25 using testing::AnyNumber; | 26 using testing::AnyNumber; |
26 using testing::AtLeast; | 27 using testing::AtLeast; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&con
tentClient)); | 146 OwnPtr<WebContentLayer> contentLayer = adoptPtr(WebContentLayer::create(&con
tentClient)); |
146 m_rootLayer->addChild(contentLayer->layer()); | 147 m_rootLayer->addChild(contentLayer->layer()); |
147 Mock::VerifyAndClearExpectations(&m_client); | 148 Mock::VerifyAndClearExpectations(&m_client); |
148 | 149 |
149 EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); | 150 EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); |
150 contentLayer->layer()->setDrawsContent(false); | 151 contentLayer->layer()->setDrawsContent(false); |
151 Mock::VerifyAndClearExpectations(&m_client); | 152 Mock::VerifyAndClearExpectations(&m_client); |
152 EXPECT_FALSE(contentLayer->layer()->drawsContent()); | 153 EXPECT_FALSE(contentLayer->layer()->drawsContent()); |
153 } | 154 } |
154 | 155 |
| 156 class MockScrollClient : public WebLayerScrollClient { |
| 157 public: |
| 158 MOCK_METHOD0(didScroll, void()); |
| 159 }; |
| 160 |
| 161 TEST_F(WebLayerTest, notifyScrollClient) |
| 162 { |
| 163 MockScrollClient scrollClient; |
| 164 |
| 165 EXPECT_CALL(scrollClient, didScroll()).Times(0); |
| 166 m_rootLayer->setScrollClient(&scrollClient); |
| 167 Mock::VerifyAndClearExpectations(&scrollClient); |
| 168 |
| 169 EXPECT_CALL(scrollClient, didScroll()).Times(1); |
| 170 m_rootLayer->setScrollPosition(WebPoint(14, 19)); |
| 171 Mock::VerifyAndClearExpectations(&scrollClient); |
| 172 |
| 173 EXPECT_CALL(scrollClient, didScroll()).Times(0); |
| 174 m_rootLayer->setScrollPosition(WebPoint(14, 19)); |
| 175 Mock::VerifyAndClearExpectations(&scrollClient); |
| 176 |
| 177 m_rootLayer->setScrollClient(0); |
155 } | 178 } |
| 179 |
| 180 } |
OLD | NEW |