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 "cc/scrollbar_layer.h" | 5 #include "cc/scrollbar_layer.h" |
6 | 6 |
7 #include "cc/scrollbar_animation_controller.h" | 7 #include "cc/scrollbar_animation_controller.h" |
8 #include "cc/scrollbar_layer_impl.h" | 8 #include "cc/scrollbar_layer_impl.h" |
9 #include "cc/single_thread_proxy.h" | 9 #include "cc/single_thread_proxy.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 class ScrollbarLayerTestMaxTextureSize : public ThreadedTest { | 131 class ScrollbarLayerTestMaxTextureSize : public ThreadedTest { |
132 public: | 132 public: |
133 ScrollbarLayerTestMaxTextureSize() {} | 133 ScrollbarLayerTestMaxTextureSize() {} |
134 | 134 |
135 void setScrollbarBounds(gfx::Size bounds) { | 135 void setScrollbarBounds(gfx::Size bounds) { |
136 m_bounds = bounds; | 136 m_bounds = bounds; |
137 } | 137 } |
138 | 138 |
139 virtual void beginTest() OVERRIDE | 139 virtual void beginTest() OVERRIDE |
140 { | 140 { |
| 141 m_layerTreeHost->initializeRendererIfNeeded(); |
| 142 |
141 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); | 143 scoped_ptr<WebKit::WebScrollbar> scrollbar(FakeWebScrollbar::create()); |
142 m_scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), m_painter, W
ebKit::FakeWebScrollbarThemeGeometry::create(), 1); | 144 m_scrollbarLayer = ScrollbarLayer::create(scrollbar.Pass(), m_painter, W
ebKit::FakeWebScrollbarThemeGeometry::create(), 1); |
| 145 m_scrollbarLayer->setLayerTreeHost(m_layerTreeHost.get()); |
143 m_scrollbarLayer->setBounds(m_bounds); | 146 m_scrollbarLayer->setBounds(m_bounds); |
144 m_layerTreeHost->rootLayer()->addChild(m_scrollbarLayer); | 147 m_layerTreeHost->rootLayer()->addChild(m_scrollbarLayer); |
145 | 148 |
146 m_scrollLayer = Layer::create(); | 149 m_scrollLayer = Layer::create(); |
147 m_scrollbarLayer->setScrollLayerId(m_scrollLayer->id()); | 150 m_scrollbarLayer->setScrollLayerId(m_scrollLayer->id()); |
148 m_layerTreeHost->rootLayer()->addChild(m_scrollLayer); | 151 m_layerTreeHost->rootLayer()->addChild(m_scrollLayer); |
149 | 152 |
150 postSetNeedsCommitToMainThread(); | 153 postSetNeedsCommitToMainThread(); |
151 } | 154 } |
152 | 155 |
153 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE | 156 virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE |
154 { | 157 { |
155 m_layerTreeHost->initializeRendererIfNeeded(); | |
156 | |
157 const int kMaxTextureSize = m_layerTreeHost->rendererCapabilities().maxT
extureSize; | 158 const int kMaxTextureSize = m_layerTreeHost->rendererCapabilities().maxT
extureSize; |
158 | 159 |
159 // Check first that we're actually testing something. | 160 // Check first that we're actually testing something. |
160 EXPECT_GT(m_scrollbarLayer->bounds().width(), kMaxTextureSize); | 161 EXPECT_GT(m_scrollbarLayer->bounds().width(), kMaxTextureSize); |
161 | 162 |
162 EXPECT_EQ(m_scrollbarLayer->contentBounds().width(), kMaxTextureSize - 1
); | 163 EXPECT_EQ(m_scrollbarLayer->contentBounds().width(), kMaxTextureSize - 1
); |
163 EXPECT_EQ(m_scrollbarLayer->contentBounds().height(), kMaxTextureSize -
1); | 164 EXPECT_EQ(m_scrollbarLayer->contentBounds().height(), kMaxTextureSize -
1); |
164 | 165 |
165 endTest(); | 166 endTest(); |
166 } | 167 } |
(...skipping 12 matching lines...) Expand all Loading... |
179 TEST_F(ScrollbarLayerTestMaxTextureSize, runTest) { | 180 TEST_F(ScrollbarLayerTestMaxTextureSize, runTest) { |
180 WebKit::FakeWebGraphicsContext3D context; | 181 WebKit::FakeWebGraphicsContext3D context; |
181 int max_size = 0; | 182 int max_size = 0; |
182 context.getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); | 183 context.getIntegerv(GL_MAX_TEXTURE_SIZE, &max_size); |
183 setScrollbarBounds(gfx::Size(max_size + 100, max_size + 100)); | 184 setScrollbarBounds(gfx::Size(max_size + 100, max_size + 100)); |
184 runTest(true); | 185 runTest(true); |
185 } | 186 } |
186 | 187 |
187 } // namespace | 188 } // namespace |
188 } // namespace cc | 189 } // namespace cc |
OLD | NEW |