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 "cc/test/compositor_fake_web_graphics_context_3d.h" | 8 #include "cc/test/compositor_fake_web_graphics_context_3d.h" |
9 #include "cc/test/web_compositor_initializer.h" | 9 #include "cc/test/web_compositor_initializer.h" |
| 10 #include "SkBitmap.h" |
10 #include "WebLayerImpl.h" | 11 #include "WebLayerImpl.h" |
11 #include "WebLayerTreeViewTestCommon.h" | 12 #include "WebLayerTreeViewTestCommon.h" |
12 #include <public/WebContentLayer.h> | 13 #include <public/WebContentLayer.h> |
13 #include <public/WebContentLayerClient.h> | 14 #include <public/WebContentLayerClient.h> |
| 15 #include <public/WebDecorationLayer.h> |
14 #include <public/WebExternalTextureLayer.h> | 16 #include <public/WebExternalTextureLayer.h> |
15 #include <public/WebFloatPoint.h> | 17 #include <public/WebFloatPoint.h> |
16 #include <public/WebFloatRect.h> | 18 #include <public/WebFloatRect.h> |
17 #include <public/WebLayerScrollClient.h> | 19 #include <public/WebLayerScrollClient.h> |
18 #include <public/WebLayerTreeView.h> | 20 #include <public/WebLayerTreeView.h> |
19 #include <public/WebLayerTreeViewClient.h> | 21 #include <public/WebLayerTreeViewClient.h> |
20 #include <public/WebRect.h> | 22 #include <public/WebRect.h> |
21 #include <public/WebSize.h> | 23 #include <public/WebSize.h> |
22 #include <public/WebSolidColorLayer.h> | 24 #include <public/WebSolidColorLayer.h> |
23 | 25 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 contentLayer->layer()->setDrawsContent(false); | 157 contentLayer->layer()->setDrawsContent(false); |
156 Mock::VerifyAndClearExpectations(&m_client); | 158 Mock::VerifyAndClearExpectations(&m_client); |
157 EXPECT_FALSE(contentLayer->layer()->drawsContent()); | 159 EXPECT_FALSE(contentLayer->layer()->drawsContent()); |
158 | 160 |
159 // Solid color layer. | 161 // Solid color layer. |
160 EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); | 162 EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); |
161 OwnPtr<WebSolidColorLayer> solidColorLayer = adoptPtr(WebSolidColorLayer::cr
eate()); | 163 OwnPtr<WebSolidColorLayer> solidColorLayer = adoptPtr(WebSolidColorLayer::cr
eate()); |
162 m_rootLayer->addChild(solidColorLayer->layer()); | 164 m_rootLayer->addChild(solidColorLayer->layer()); |
163 Mock::VerifyAndClearExpectations(&m_client); | 165 Mock::VerifyAndClearExpectations(&m_client); |
164 | 166 |
| 167 // Decoration layer. |
| 168 EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); |
| 169 OwnPtr<WebDecorationLayer> decorationLayer = adoptPtr(WebDecorationLayer::cr
eate()); |
| 170 m_rootLayer->addChild(decorationLayer->layer()); |
| 171 Mock::VerifyAndClearExpectations(&m_client); |
| 172 |
| 173 EXPECT_CALL(m_client, scheduleComposite()).Times(AtLeast(1)); |
| 174 SkBitmap bitmap; |
| 175 decorationLayer->setBitmap(bitmap, WebRect(10, 10, 5, 5)); |
| 176 Mock::VerifyAndClearExpectations(&m_client); |
165 } | 177 } |
166 | 178 |
167 class MockScrollClient : public WebLayerScrollClient { | 179 class MockScrollClient : public WebLayerScrollClient { |
168 public: | 180 public: |
169 MOCK_METHOD0(didScroll, void()); | 181 MOCK_METHOD0(didScroll, void()); |
170 }; | 182 }; |
171 | 183 |
172 TEST_F(WebLayerTest, notifyScrollClient) | 184 TEST_F(WebLayerTest, notifyScrollClient) |
173 { | 185 { |
174 MockScrollClient scrollClient; | 186 MockScrollClient scrollClient; |
175 | 187 |
176 EXPECT_CALL(scrollClient, didScroll()).Times(0); | 188 EXPECT_CALL(scrollClient, didScroll()).Times(0); |
177 m_rootLayer->setScrollClient(&scrollClient); | 189 m_rootLayer->setScrollClient(&scrollClient); |
178 Mock::VerifyAndClearExpectations(&scrollClient); | 190 Mock::VerifyAndClearExpectations(&scrollClient); |
179 | 191 |
180 EXPECT_CALL(scrollClient, didScroll()).Times(1); | 192 EXPECT_CALL(scrollClient, didScroll()).Times(1); |
181 m_rootLayer->setScrollPosition(WebPoint(14, 19)); | 193 m_rootLayer->setScrollPosition(WebPoint(14, 19)); |
182 Mock::VerifyAndClearExpectations(&scrollClient); | 194 Mock::VerifyAndClearExpectations(&scrollClient); |
183 | 195 |
184 EXPECT_CALL(scrollClient, didScroll()).Times(0); | 196 EXPECT_CALL(scrollClient, didScroll()).Times(0); |
185 m_rootLayer->setScrollPosition(WebPoint(14, 19)); | 197 m_rootLayer->setScrollPosition(WebPoint(14, 19)); |
186 Mock::VerifyAndClearExpectations(&scrollClient); | 198 Mock::VerifyAndClearExpectations(&scrollClient); |
187 | 199 |
188 m_rootLayer->setScrollClient(0); | 200 m_rootLayer->setScrollClient(0); |
189 } | 201 } |
190 | 202 |
191 } | 203 } |
OLD | NEW |