Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(262)

Side by Side Diff: cc/animation/scrollbar_animation_controller_thinning_unittest.cc

Issue 774763004: Use EXPECT_EQ when possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/animation/scrollbar_animation_controller_thinning.h" 5 #include "cc/animation/scrollbar_animation_controller_thinning.h"
6 6
7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" 7 #include "cc/layers/solid_color_scrollbar_layer_impl.h"
8 #include "cc/test/fake_impl_proxy.h" 8 #include "cc/test/fake_impl_proxy.h"
9 #include "cc/test/fake_layer_tree_host_impl.h" 9 #include "cc/test/fake_layer_tree_host_impl.h"
10 #include "cc/test/geometry_test_utils.h" 10 #include "cc/test/geometry_test_utils.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) { 78 TEST_F(ScrollbarAnimationControllerThinningTest, Idle) {
79 scrollbar_controller_->Animate(base::TimeTicks()); 79 scrollbar_controller_->Animate(base::TimeTicks());
80 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); 80 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
81 EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor()); 81 EXPECT_FLOAT_EQ(0.4f, scrollbar_layer_->thumb_thickness_scale_factor());
82 } 82 }
83 83
84 // Check that scrollbar disappears when the layer becomes non-scrollable. 84 // Check that scrollbar disappears when the layer becomes non-scrollable.
85 TEST_F(ScrollbarAnimationControllerThinningTest, HideOnResize) { 85 TEST_F(ScrollbarAnimationControllerThinningTest, HideOnResize) {
86 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1); 86 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1);
87 ASSERT_TRUE(scroll_layer); 87 ASSERT_TRUE(scroll_layer);
88 EXPECT_SIZE_EQ(gfx::Size(200, 200), scroll_layer->bounds()); 88 EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds());
89 89
90 EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation()); 90 EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation());
91 91
92 // Shrink along X axis, horizontal scrollbar should appear. 92 // Shrink along X axis, horizontal scrollbar should appear.
93 clip_layer_->SetBounds(gfx::Size(100, 200)); 93 clip_layer_->SetBounds(gfx::Size(100, 200));
94 EXPECT_SIZE_EQ(gfx::Size(100, 200), clip_layer_->bounds()); 94 EXPECT_EQ(gfx::Size(100, 200), clip_layer_->bounds());
95 95
96 scrollbar_controller_->DidScrollBegin(); 96 scrollbar_controller_->DidScrollBegin();
97 97
98 scrollbar_controller_->DidScrollUpdate(false); 98 scrollbar_controller_->DidScrollUpdate(false);
99 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); 99 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity());
100 100
101 scrollbar_controller_->DidScrollEnd(); 101 scrollbar_controller_->DidScrollEnd();
102 102
103 // Shrink along Y axis and expand along X, horizontal scrollbar 103 // Shrink along Y axis and expand along X, horizontal scrollbar
104 // should disappear. 104 // should disappear.
105 clip_layer_->SetBounds(gfx::Size(200, 100)); 105 clip_layer_->SetBounds(gfx::Size(200, 100));
106 EXPECT_SIZE_EQ(gfx::Size(200, 100), clip_layer_->bounds()); 106 EXPECT_EQ(gfx::Size(200, 100), clip_layer_->bounds());
107 107
108 scrollbar_controller_->DidScrollBegin(); 108 scrollbar_controller_->DidScrollBegin();
109 109
110 scrollbar_controller_->DidScrollUpdate(false); 110 scrollbar_controller_->DidScrollUpdate(false);
111 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); 111 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity());
112 112
113 scrollbar_controller_->DidScrollEnd(); 113 scrollbar_controller_->DidScrollEnd();
114 } 114 }
115 115
116 // Scroll content. Confirm the scrollbar gets dark and then becomes light 116 // Scroll content. Confirm the scrollbar gets dark and then becomes light
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 365
366 time += base::TimeDelta::FromSeconds(1); 366 time += base::TimeDelta::FromSeconds(1);
367 scrollbar_controller_->Animate(time); 367 scrollbar_controller_->Animate(time);
368 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity()); 368 EXPECT_FLOAT_EQ(0.7f, scrollbar_layer_->opacity());
369 // The thickness now gets big again. 369 // The thickness now gets big again.
370 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor()); 370 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->thumb_thickness_scale_factor());
371 } 371 }
372 372
373 } // namespace 373 } // namespace
374 } // namespace cc 374 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/scrollbar_animation_controller_linear_fade_unittest.cc ('k') | cc/base/tiling_data_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698