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 "base/containers/hash_tables.h" | 5 #include "base/containers/hash_tables.h" |
6 #include "cc/animation/scrollbar_animation_controller.h" | 6 #include "cc/animation/scrollbar_animation_controller.h" |
7 #include "cc/layers/append_quads_data.h" | 7 #include "cc/layers/append_quads_data.h" |
8 #include "cc/layers/painted_scrollbar_layer.h" | 8 #include "cc/layers/painted_scrollbar_layer.h" |
9 #include "cc/layers/painted_scrollbar_layer_impl.h" | 9 #include "cc/layers/painted_scrollbar_layer_impl.h" |
10 #include "cc/layers/scrollbar_layer_interface.h" | 10 #include "cc/layers/scrollbar_layer_interface.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 EXPECT_EQ(300, cc_scrollbar_layer->maximum()); | 186 EXPECT_EQ(300, cc_scrollbar_layer->maximum()); |
187 } | 187 } |
188 | 188 |
189 #define UPDATE_AND_EXTRACT_LAYER_POINTERS() \ | 189 #define UPDATE_AND_EXTRACT_LAYER_POINTERS() \ |
190 do { \ | 190 do { \ |
191 scrollbar_layer->UpdateThumbAndTrackGeometry(); \ | 191 scrollbar_layer->UpdateThumbAndTrackGeometry(); \ |
192 root_clip_layer_impl = host->CommitAndCreateLayerImplTree(); \ | 192 root_clip_layer_impl = host->CommitAndCreateLayerImplTree(); \ |
193 root_layer_impl = root_clip_layer_impl->children()[0]; \ | 193 root_layer_impl = root_clip_layer_impl->children()[0]; \ |
194 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( \ | 194 scrollbar_layer_impl = static_cast<PaintedScrollbarLayerImpl*>( \ |
195 root_layer_impl->children()[1]); \ | 195 root_layer_impl->children()[1]); \ |
196 scrollbar_layer_impl->ScrollbarParametersDidChange(); \ | 196 scrollbar_layer_impl->ScrollbarParametersDidChange(false); \ |
197 } while (false) | 197 } while (false) |
198 | 198 |
199 TEST(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) { | 199 TEST(ScrollbarLayerTest, UpdatePropertiesOfScrollBarWhenThumbRemoved) { |
200 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); | 200 FakeLayerTreeHostClient client(FakeLayerTreeHostClient::DIRECT_3D); |
201 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); | 201 scoped_ptr<FakeLayerTreeHost> host = FakeLayerTreeHost::Create(&client); |
202 scoped_refptr<Layer> root_clip_layer = Layer::Create(); | 202 scoped_refptr<Layer> root_clip_layer = Layer::Create(); |
203 scoped_refptr<Layer> root_layer = Layer::Create(); | 203 scoped_refptr<Layer> root_layer = Layer::Create(); |
204 scoped_refptr<Layer> content_layer = Layer::Create(); | 204 scoped_refptr<Layer> content_layer = Layer::Create(); |
205 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = | 205 scoped_refptr<FakePaintedScrollbarLayer> scrollbar_layer = |
206 FakePaintedScrollbarLayer::Create(false, true, root_layer->id()); | 206 FakePaintedScrollbarLayer::Create(false, true, root_layer->id()); |
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); | 1103 TestScale(gfx::Rect(1240, 0, 15, 1333), 2.7754839f); |
1104 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); | 1104 TestScale(gfx::Rect(1240, 0, 15, 677), 2.46677136f); |
1105 | 1105 |
1106 // Horizontal Scrollbars. | 1106 // Horizontal Scrollbars. |
1107 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); | 1107 TestScale(gfx::Rect(0, 1240, 1333, 15), 2.7754839f); |
1108 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); | 1108 TestScale(gfx::Rect(0, 1240, 677, 15), 2.46677136f); |
1109 } | 1109 } |
1110 | 1110 |
1111 } // namespace | 1111 } // namespace |
1112 } // namespace cc | 1112 } // namespace cc |
OLD | NEW |