| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "cc/animation/scrollbar_animation_controller_linear_fade.h" | |
| 6 | |
| 7 #include "cc/layers/solid_color_scrollbar_layer_impl.h" | |
| 8 #include "cc/test/fake_impl_proxy.h" | |
| 9 #include "cc/test/fake_layer_tree_host_impl.h" | |
| 10 #include "cc/test/geometry_test_utils.h" | |
| 11 #include "cc/test/test_shared_bitmap_manager.h" | |
| 12 #include "cc/test/test_task_graph_runner.h" | |
| 13 #include "cc/trees/layer_tree_impl.h" | |
| 14 #include "testing/gtest/include/gtest/gtest.h" | |
| 15 | |
| 16 namespace cc { | |
| 17 namespace { | |
| 18 | |
| 19 class ScrollbarAnimationControllerLinearFadeTest | |
| 20 : public testing::Test, | |
| 21 public ScrollbarAnimationControllerClient { | |
| 22 public: | |
| 23 ScrollbarAnimationControllerLinearFadeTest() | |
| 24 : host_impl_(&proxy_, &shared_bitmap_manager_, &task_graph_runner_) {} | |
| 25 | |
| 26 void StartAnimatingScrollbarAnimationController( | |
| 27 ScrollbarAnimationController* controller) override { | |
| 28 is_animating_ = true; | |
| 29 } | |
| 30 void StopAnimatingScrollbarAnimationController( | |
| 31 ScrollbarAnimationController* controller) override { | |
| 32 is_animating_ = false; | |
| 33 } | |
| 34 void PostDelayedScrollbarAnimationTask(const base::Closure& start_fade, | |
| 35 base::TimeDelta delay) override { | |
| 36 start_fade_ = start_fade; | |
| 37 delay_ = delay; | |
| 38 } | |
| 39 void SetNeedsRedrawForScrollbarAnimation() override { | |
| 40 did_request_redraw_ = true; | |
| 41 } | |
| 42 | |
| 43 protected: | |
| 44 void SetUp() override { | |
| 45 const int kThumbThickness = 10; | |
| 46 const int kTrackStart = 0; | |
| 47 const bool kIsLeftSideVerticalScrollbar = false; | |
| 48 const bool kIsOverlayScrollbar = true; // Allow opacity animations. | |
| 49 | |
| 50 scoped_ptr<LayerImpl> scroll_layer = | |
| 51 LayerImpl::Create(host_impl_.active_tree(), 1); | |
| 52 scrollbar_layer_ = | |
| 53 SolidColorScrollbarLayerImpl::Create(host_impl_.active_tree(), | |
| 54 2, | |
| 55 orientation(), | |
| 56 kThumbThickness, | |
| 57 kTrackStart, | |
| 58 kIsLeftSideVerticalScrollbar, | |
| 59 kIsOverlayScrollbar); | |
| 60 clip_layer_ = LayerImpl::Create(host_impl_.active_tree(), 3); | |
| 61 scroll_layer->SetScrollClipLayer(clip_layer_->id()); | |
| 62 LayerImpl* scroll_layer_ptr = scroll_layer.get(); | |
| 63 clip_layer_->AddChild(scroll_layer.Pass()); | |
| 64 | |
| 65 scrollbar_layer_->SetScrollLayerAndClipLayerByIds(scroll_layer_ptr->id(), | |
| 66 clip_layer_->id()); | |
| 67 clip_layer_->SetBounds(gfx::Size(100, 100)); | |
| 68 scroll_layer_ptr->SetBounds(gfx::Size(200, 200)); | |
| 69 | |
| 70 scrollbar_controller_ = ScrollbarAnimationControllerLinearFade::Create( | |
| 71 scroll_layer_ptr, this, base::TimeDelta::FromSeconds(2), | |
| 72 base::TimeDelta::FromSeconds(5), base::TimeDelta::FromSeconds(3)); | |
| 73 } | |
| 74 | |
| 75 virtual ScrollbarOrientation orientation() const { return HORIZONTAL; } | |
| 76 | |
| 77 FakeImplProxy proxy_; | |
| 78 TestSharedBitmapManager shared_bitmap_manager_; | |
| 79 TestTaskGraphRunner task_graph_runner_; | |
| 80 FakeLayerTreeHostImpl host_impl_; | |
| 81 scoped_ptr<ScrollbarAnimationControllerLinearFade> scrollbar_controller_; | |
| 82 scoped_ptr<LayerImpl> clip_layer_; | |
| 83 scoped_ptr<SolidColorScrollbarLayerImpl> scrollbar_layer_; | |
| 84 | |
| 85 base::Closure start_fade_; | |
| 86 base::TimeDelta delay_; | |
| 87 bool is_animating_; | |
| 88 bool did_request_redraw_; | |
| 89 }; | |
| 90 | |
| 91 class VerticalScrollbarAnimationControllerLinearFadeTest | |
| 92 : public ScrollbarAnimationControllerLinearFadeTest { | |
| 93 protected: | |
| 94 ScrollbarOrientation orientation() const override { return VERTICAL; } | |
| 95 }; | |
| 96 | |
| 97 TEST_F(ScrollbarAnimationControllerLinearFadeTest, DelayAnimationOnResize) { | |
| 98 scrollbar_layer_->SetOpacity(0.0f); | |
| 99 scrollbar_controller_->DidScrollBegin(); | |
| 100 scrollbar_controller_->DidScrollUpdate(true); | |
| 101 scrollbar_controller_->DidScrollEnd(); | |
| 102 // Normal Animation delay of 2 seconds. | |
| 103 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 104 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(2)); | |
| 105 | |
| 106 scrollbar_layer_->SetOpacity(0.0f); | |
| 107 scrollbar_controller_->DidScrollUpdate(true); | |
| 108 // Delay animation on resize to 5 seconds. | |
| 109 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 110 EXPECT_EQ(delay_, base::TimeDelta::FromSeconds(5)); | |
| 111 } | |
| 112 | |
| 113 TEST_F(ScrollbarAnimationControllerLinearFadeTest, HiddenInBegin) { | |
| 114 scrollbar_layer_->SetOpacity(0.0f); | |
| 115 scrollbar_controller_->Animate(base::TimeTicks()); | |
| 116 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 117 } | |
| 118 | |
| 119 TEST_F(ScrollbarAnimationControllerLinearFadeTest, | |
| 120 HiddenAfterNonScrollingGesture) { | |
| 121 scrollbar_layer_->SetOpacity(0.0f); | |
| 122 scrollbar_controller_->DidScrollBegin(); | |
| 123 | |
| 124 base::TimeTicks time; | |
| 125 time += base::TimeDelta::FromSeconds(100); | |
| 126 scrollbar_controller_->Animate(time); | |
| 127 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 128 scrollbar_controller_->DidScrollEnd(); | |
| 129 | |
| 130 EXPECT_TRUE(start_fade_.Equals(base::Closure())); | |
| 131 | |
| 132 time += base::TimeDelta::FromSeconds(100); | |
| 133 scrollbar_controller_->Animate(time); | |
| 134 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 135 } | |
| 136 | |
| 137 TEST_F(ScrollbarAnimationControllerLinearFadeTest, HideOnResize) { | |
| 138 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1); | |
| 139 ASSERT_TRUE(scroll_layer); | |
| 140 EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds()); | |
| 141 | |
| 142 EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation()); | |
| 143 | |
| 144 // Shrink along X axis, horizontal scrollbar should appear. | |
| 145 clip_layer_->SetBounds(gfx::Size(100, 200)); | |
| 146 EXPECT_EQ(gfx::Size(100, 200), clip_layer_->bounds()); | |
| 147 | |
| 148 scrollbar_controller_->DidScrollBegin(); | |
| 149 | |
| 150 scrollbar_controller_->DidScrollUpdate(false); | |
| 151 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 152 | |
| 153 scrollbar_controller_->DidScrollEnd(); | |
| 154 | |
| 155 // Shrink along Y axis and expand along X, horizontal scrollbar | |
| 156 // should disappear. | |
| 157 clip_layer_->SetBounds(gfx::Size(200, 100)); | |
| 158 EXPECT_EQ(gfx::Size(200, 100), clip_layer_->bounds()); | |
| 159 | |
| 160 scrollbar_controller_->DidScrollBegin(); | |
| 161 | |
| 162 scrollbar_controller_->DidScrollUpdate(false); | |
| 163 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 164 | |
| 165 scrollbar_controller_->DidScrollEnd(); | |
| 166 } | |
| 167 | |
| 168 TEST_F(VerticalScrollbarAnimationControllerLinearFadeTest, HideOnResize) { | |
| 169 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1); | |
| 170 ASSERT_TRUE(scroll_layer); | |
| 171 EXPECT_EQ(gfx::Size(200, 200), scroll_layer->bounds()); | |
| 172 | |
| 173 EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation()); | |
| 174 | |
| 175 // Shrink along X axis, vertical scrollbar should remain invisible. | |
| 176 clip_layer_->SetBounds(gfx::Size(100, 200)); | |
| 177 EXPECT_EQ(gfx::Size(100, 200), clip_layer_->bounds()); | |
| 178 | |
| 179 scrollbar_controller_->DidScrollBegin(); | |
| 180 | |
| 181 scrollbar_controller_->DidScrollUpdate(false); | |
| 182 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 183 | |
| 184 scrollbar_controller_->DidScrollEnd(); | |
| 185 | |
| 186 // Shrink along Y axis and expand along X, vertical scrollbar should appear. | |
| 187 clip_layer_->SetBounds(gfx::Size(200, 100)); | |
| 188 EXPECT_EQ(gfx::Size(200, 100), clip_layer_->bounds()); | |
| 189 | |
| 190 scrollbar_controller_->DidScrollBegin(); | |
| 191 | |
| 192 scrollbar_controller_->DidScrollUpdate(false); | |
| 193 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 194 | |
| 195 scrollbar_controller_->DidScrollEnd(); | |
| 196 } | |
| 197 | |
| 198 TEST_F(ScrollbarAnimationControllerLinearFadeTest, | |
| 199 HideOnUserNonScrollableHorz) { | |
| 200 EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation()); | |
| 201 | |
| 202 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1); | |
| 203 ASSERT_TRUE(scroll_layer); | |
| 204 scroll_layer->set_user_scrollable_horizontal(false); | |
| 205 | |
| 206 scrollbar_controller_->DidScrollBegin(); | |
| 207 | |
| 208 scrollbar_controller_->DidScrollUpdate(false); | |
| 209 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 210 | |
| 211 scrollbar_controller_->DidScrollEnd(); | |
| 212 } | |
| 213 | |
| 214 TEST_F(ScrollbarAnimationControllerLinearFadeTest, | |
| 215 ShowOnUserNonScrollableVert) { | |
| 216 EXPECT_EQ(HORIZONTAL, scrollbar_layer_->orientation()); | |
| 217 | |
| 218 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1); | |
| 219 ASSERT_TRUE(scroll_layer); | |
| 220 scroll_layer->set_user_scrollable_vertical(false); | |
| 221 | |
| 222 scrollbar_controller_->DidScrollBegin(); | |
| 223 | |
| 224 scrollbar_controller_->DidScrollUpdate(false); | |
| 225 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 226 | |
| 227 scrollbar_controller_->DidScrollEnd(); | |
| 228 } | |
| 229 | |
| 230 TEST_F(VerticalScrollbarAnimationControllerLinearFadeTest, | |
| 231 HideOnUserNonScrollableVert) { | |
| 232 EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation()); | |
| 233 | |
| 234 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1); | |
| 235 ASSERT_TRUE(scroll_layer); | |
| 236 scroll_layer->set_user_scrollable_vertical(false); | |
| 237 | |
| 238 scrollbar_controller_->DidScrollBegin(); | |
| 239 | |
| 240 scrollbar_controller_->DidScrollUpdate(false); | |
| 241 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 242 | |
| 243 scrollbar_controller_->DidScrollEnd(); | |
| 244 } | |
| 245 | |
| 246 TEST_F(VerticalScrollbarAnimationControllerLinearFadeTest, | |
| 247 ShowOnUserNonScrollableHorz) { | |
| 248 EXPECT_EQ(VERTICAL, scrollbar_layer_->orientation()); | |
| 249 | |
| 250 LayerImpl* scroll_layer = host_impl_.active_tree()->LayerById(1); | |
| 251 ASSERT_TRUE(scroll_layer); | |
| 252 scroll_layer->set_user_scrollable_horizontal(false); | |
| 253 | |
| 254 scrollbar_controller_->DidScrollBegin(); | |
| 255 | |
| 256 scrollbar_controller_->DidScrollUpdate(false); | |
| 257 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 258 | |
| 259 scrollbar_controller_->DidScrollEnd(); | |
| 260 } | |
| 261 | |
| 262 TEST_F(ScrollbarAnimationControllerLinearFadeTest, AwakenByScrollingGesture) { | |
| 263 base::TimeTicks time; | |
| 264 time += base::TimeDelta::FromSeconds(1); | |
| 265 scrollbar_controller_->DidScrollBegin(); | |
| 266 | |
| 267 scrollbar_controller_->DidScrollUpdate(false); | |
| 268 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 269 | |
| 270 EXPECT_TRUE(start_fade_.Equals(base::Closure())); | |
| 271 | |
| 272 time += base::TimeDelta::FromSeconds(100); | |
| 273 | |
| 274 scrollbar_controller_->Animate(time); | |
| 275 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 276 scrollbar_controller_->DidScrollEnd(); | |
| 277 start_fade_.Run(); | |
| 278 | |
| 279 time += base::TimeDelta::FromSeconds(2); | |
| 280 EXPECT_TRUE(is_animating_); | |
| 281 scrollbar_controller_->Animate(time); | |
| 282 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 283 | |
| 284 time += base::TimeDelta::FromSeconds(1); | |
| 285 EXPECT_TRUE(is_animating_); | |
| 286 scrollbar_controller_->Animate(time); | |
| 287 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 288 | |
| 289 time += base::TimeDelta::FromSeconds(1); | |
| 290 EXPECT_TRUE(is_animating_); | |
| 291 scrollbar_controller_->Animate(time); | |
| 292 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 293 | |
| 294 time += base::TimeDelta::FromSeconds(1); | |
| 295 | |
| 296 scrollbar_controller_->DidScrollBegin(); | |
| 297 scrollbar_controller_->DidScrollUpdate(false); | |
| 298 scrollbar_controller_->DidScrollEnd(); | |
| 299 | |
| 300 start_fade_.Run(); | |
| 301 | |
| 302 time += base::TimeDelta::FromSeconds(2); | |
| 303 EXPECT_TRUE(is_animating_); | |
| 304 scrollbar_controller_->Animate(time); | |
| 305 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 306 | |
| 307 time += base::TimeDelta::FromSeconds(1); | |
| 308 EXPECT_TRUE(is_animating_); | |
| 309 scrollbar_controller_->Animate(time); | |
| 310 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 311 | |
| 312 time += base::TimeDelta::FromSeconds(1); | |
| 313 EXPECT_TRUE(is_animating_); | |
| 314 scrollbar_controller_->Animate(time); | |
| 315 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 316 | |
| 317 time += base::TimeDelta::FromSeconds(1); | |
| 318 EXPECT_TRUE(is_animating_); | |
| 319 scrollbar_controller_->Animate(time); | |
| 320 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 321 EXPECT_FALSE(is_animating_); | |
| 322 } | |
| 323 | |
| 324 TEST_F(ScrollbarAnimationControllerLinearFadeTest, AwakenByProgrammaticScroll) { | |
| 325 base::TimeTicks time; | |
| 326 time += base::TimeDelta::FromSeconds(1); | |
| 327 scrollbar_controller_->DidScrollUpdate(false); | |
| 328 | |
| 329 start_fade_.Run(); | |
| 330 EXPECT_TRUE(is_animating_); | |
| 331 scrollbar_controller_->Animate(time); | |
| 332 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 333 | |
| 334 time += base::TimeDelta::FromSeconds(1); | |
| 335 EXPECT_TRUE(is_animating_); | |
| 336 scrollbar_controller_->Animate(time); | |
| 337 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 338 scrollbar_controller_->DidScrollUpdate(false); | |
| 339 | |
| 340 start_fade_.Run(); | |
| 341 time += base::TimeDelta::FromSeconds(2); | |
| 342 EXPECT_TRUE(is_animating_); | |
| 343 scrollbar_controller_->Animate(time); | |
| 344 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 345 | |
| 346 time += base::TimeDelta::FromSeconds(1); | |
| 347 EXPECT_TRUE(is_animating_); | |
| 348 scrollbar_controller_->Animate(time); | |
| 349 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 350 | |
| 351 time += base::TimeDelta::FromSeconds(1); | |
| 352 EXPECT_TRUE(is_animating_); | |
| 353 scrollbar_controller_->Animate(time); | |
| 354 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 355 | |
| 356 time += base::TimeDelta::FromSeconds(1); | |
| 357 scrollbar_controller_->DidScrollUpdate(false); | |
| 358 start_fade_.Run(); | |
| 359 time += base::TimeDelta::FromSeconds(1); | |
| 360 EXPECT_TRUE(is_animating_); | |
| 361 scrollbar_controller_->Animate(time); | |
| 362 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 363 | |
| 364 time += base::TimeDelta::FromSeconds(1); | |
| 365 EXPECT_TRUE(is_animating_); | |
| 366 scrollbar_controller_->Animate(time); | |
| 367 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 368 | |
| 369 time += base::TimeDelta::FromSeconds(1); | |
| 370 EXPECT_TRUE(is_animating_); | |
| 371 scrollbar_controller_->Animate(time); | |
| 372 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 373 | |
| 374 time += base::TimeDelta::FromSeconds(1); | |
| 375 EXPECT_TRUE(is_animating_); | |
| 376 scrollbar_controller_->Animate(time); | |
| 377 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 378 EXPECT_FALSE(is_animating_); | |
| 379 } | |
| 380 | |
| 381 TEST_F(ScrollbarAnimationControllerLinearFadeTest, | |
| 382 AnimationPreservedByNonScrollingGesture) { | |
| 383 base::TimeTicks time; | |
| 384 time += base::TimeDelta::FromSeconds(1); | |
| 385 scrollbar_controller_->DidScrollUpdate(false); | |
| 386 start_fade_.Run(); | |
| 387 EXPECT_TRUE(is_animating_); | |
| 388 scrollbar_controller_->Animate(time); | |
| 389 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 390 | |
| 391 time += base::TimeDelta::FromSeconds(1); | |
| 392 EXPECT_TRUE(is_animating_); | |
| 393 scrollbar_controller_->Animate(time); | |
| 394 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 395 | |
| 396 scrollbar_controller_->DidScrollBegin(); | |
| 397 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 398 | |
| 399 time += base::TimeDelta::FromSeconds(1); | |
| 400 EXPECT_TRUE(is_animating_); | |
| 401 scrollbar_controller_->Animate(time); | |
| 402 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 403 | |
| 404 scrollbar_controller_->DidScrollEnd(); | |
| 405 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 406 | |
| 407 time += base::TimeDelta::FromSeconds(1); | |
| 408 EXPECT_TRUE(is_animating_); | |
| 409 scrollbar_controller_->Animate(time); | |
| 410 EXPECT_FLOAT_EQ(0.0f, scrollbar_layer_->opacity()); | |
| 411 EXPECT_FALSE(is_animating_); | |
| 412 } | |
| 413 | |
| 414 TEST_F(ScrollbarAnimationControllerLinearFadeTest, | |
| 415 AnimationOverriddenByScrollingGesture) { | |
| 416 base::TimeTicks time; | |
| 417 time += base::TimeDelta::FromSeconds(1); | |
| 418 scrollbar_controller_->DidScrollUpdate(false); | |
| 419 start_fade_.Run(); | |
| 420 EXPECT_TRUE(is_animating_); | |
| 421 scrollbar_controller_->Animate(time); | |
| 422 EXPECT_FLOAT_EQ(1.0f, scrollbar_layer_->opacity()); | |
| 423 | |
| 424 time += base::TimeDelta::FromSeconds(1); | |
| 425 EXPECT_TRUE(is_animating_); | |
| 426 scrollbar_controller_->Animate(time); | |
| 427 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 428 | |
| 429 scrollbar_controller_->DidScrollBegin(); | |
| 430 EXPECT_FLOAT_EQ(2.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 431 | |
| 432 time += base::TimeDelta::FromSeconds(1); | |
| 433 EXPECT_TRUE(is_animating_); | |
| 434 scrollbar_controller_->Animate(time); | |
| 435 EXPECT_FLOAT_EQ(1.0f / 3.0f, scrollbar_layer_->opacity()); | |
| 436 | |
| 437 time += base::TimeDelta::FromSeconds(1); | |
| 438 scrollbar_controller_->DidScrollUpdate(false); | |
| 439 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); | |
| 440 | |
| 441 time += base::TimeDelta::FromSeconds(1); | |
| 442 scrollbar_controller_->DidScrollEnd(); | |
| 443 EXPECT_FLOAT_EQ(1, scrollbar_layer_->opacity()); | |
| 444 } | |
| 445 | |
| 446 } // namespace | |
| 447 } // namespace cc | |
| OLD | NEW |