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/thread.h" |
8 #include "cc/test/compositor_fake_web_graphics_context_3d.h" | 9 #include "cc/test/compositor_fake_web_graphics_context_3d.h" |
9 #include "web_layer_impl.h" | 10 #include "web_layer_impl.h" |
| 11 #include "web_layer_tree_view_impl.h" |
10 #include "web_layer_tree_view_test_common.h" | 12 #include "web_layer_tree_view_test_common.h" |
11 #include <public/WebContentLayer.h> | 13 #include <public/WebContentLayer.h> |
12 #include <public/WebContentLayerClient.h> | 14 #include <public/WebContentLayerClient.h> |
13 #include <public/WebExternalTextureLayer.h> | 15 #include <public/WebExternalTextureLayer.h> |
14 #include <public/WebFloatPoint.h> | 16 #include <public/WebFloatPoint.h> |
15 #include <public/WebFloatRect.h> | 17 #include <public/WebFloatRect.h> |
16 #include <public/WebLayerScrollClient.h> | 18 #include <public/WebLayerScrollClient.h> |
17 #include <public/WebLayerTreeView.h> | 19 #include <public/WebLayerTreeView.h> |
18 #include <public/WebLayerTreeViewClient.h> | 20 #include <public/WebLayerTreeViewClient.h> |
19 #include <public/WebRect.h> | 21 #include <public/WebRect.h> |
(...skipping 23 matching lines...) Expand all Loading... |
43 class WebLayerTest : public Test { | 45 class WebLayerTest : public Test { |
44 public: | 46 public: |
45 WebLayerTest() | 47 WebLayerTest() |
46 { | 48 { |
47 } | 49 } |
48 | 50 |
49 virtual void SetUp() | 51 virtual void SetUp() |
50 { | 52 { |
51 m_rootLayer.reset(WebLayer::create()); | 53 m_rootLayer.reset(WebLayer::create()); |
52 EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); | 54 EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); |
53 m_view.reset(WebLayerTreeView::create(&m_client, *m_rootLayer, WebLayerT
reeView::Settings())); | 55 m_view.reset(new WebLayerTreeViewImpl(&m_client)); |
| 56 EXPECT_TRUE(m_view->initialize(WebLayerTreeView::Settings(), scoped_ptr<
cc::Thread>(NULL))); |
| 57 m_view->setRootLayer(*m_rootLayer); |
54 EXPECT_TRUE(m_view); | 58 EXPECT_TRUE(m_view); |
55 Mock::VerifyAndClearExpectations(&m_client); | 59 Mock::VerifyAndClearExpectations(&m_client); |
56 } | 60 } |
57 | 61 |
58 virtual void TearDown() | 62 virtual void TearDown() |
59 { | 63 { |
60 // We may get any number of scheduleComposite calls during shutdown. | 64 // We may get any number of scheduleComposite calls during shutdown. |
61 EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); | 65 EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); |
62 m_rootLayer.reset(); | 66 m_rootLayer.reset(); |
63 m_view.reset(); | 67 m_view.reset(); |
64 } | 68 } |
65 | 69 |
66 protected: | 70 protected: |
67 MockWebLayerTreeViewClient m_client; | 71 MockWebLayerTreeViewClient m_client; |
68 scoped_ptr<WebLayer> m_rootLayer; | 72 scoped_ptr<WebLayer> m_rootLayer; |
69 scoped_ptr<WebLayerTreeView> m_view; | 73 scoped_ptr<WebLayerTreeViewImpl> m_view; |
70 }; | 74 }; |
71 | 75 |
72 // Tests that the client gets called to ask for a composite if we change the | 76 // Tests that the client gets called to ask for a composite if we change the |
73 // fields. | 77 // fields. |
74 TEST_F(WebLayerTest, Client) | 78 TEST_F(WebLayerTest, Client) |
75 { | 79 { |
76 // Base layer. | 80 // Base layer. |
77 EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); | 81 EXPECT_CALL(m_client, scheduleComposite()).Times(AnyNumber()); |
78 scoped_ptr<WebLayer> layer(WebLayer::create()); | 82 scoped_ptr<WebLayer> layer(WebLayer::create()); |
79 layer->setDrawsContent(true); | 83 layer->setDrawsContent(true); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 Mock::VerifyAndClearExpectations(&scrollClient); | 194 Mock::VerifyAndClearExpectations(&scrollClient); |
191 | 195 |
192 EXPECT_CALL(scrollClient, didScroll()).Times(0); | 196 EXPECT_CALL(scrollClient, didScroll()).Times(0); |
193 m_rootLayer->setScrollPosition(WebPoint(14, 19)); | 197 m_rootLayer->setScrollPosition(WebPoint(14, 19)); |
194 Mock::VerifyAndClearExpectations(&scrollClient); | 198 Mock::VerifyAndClearExpectations(&scrollClient); |
195 | 199 |
196 m_rootLayer->setScrollClient(0); | 200 m_rootLayer->setScrollClient(0); |
197 } | 201 } |
198 | 202 |
199 } | 203 } |
OLD | NEW |