Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/views/animation/ink_drop_impl.h" | 5 #include "ui/views/animation/ink_drop_impl.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/test/test_simple_task_runner.h" | 8 #include "base/test/test_simple_task_runner.h" |
| 9 #include "base/threading/thread_task_runner_handle.h" | 9 #include "base/threading/thread_task_runner_handle.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 TEST_F(InkDropImplTest, FocusHighlightComesBackImmediatelyAfterAction) { | 287 TEST_F(InkDropImplTest, FocusHighlightComesBackImmediatelyAfterAction) { |
| 288 ink_drop_host_.set_should_show_highlight(true); | 288 ink_drop_host_.set_should_show_highlight(true); |
| 289 | 289 |
| 290 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers()); | 290 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers()); |
| 291 | 291 |
| 292 ink_drop_.SetFocused(true); | 292 ink_drop_.SetFocused(true); |
| 293 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | 293 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); |
| 294 | 294 |
| 295 ink_drop_.AnimateToState(InkDropState::ACTION_PENDING); | 295 ink_drop_.AnimateToState(InkDropState::ACTION_PENDING); |
| 296 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | 296 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); |
| 297 EXPECT_FALSE(test_api_.IsHighlightFadingInOrVisible()); | |
| 297 | 298 |
| 298 ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED); | 299 ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED); |
| 299 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | 300 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); |
| 300 | 301 |
| 301 test_api_.CompleteAnimations(); | 302 test_api_.CompleteAnimations(); |
| 302 | 303 |
| 303 // No delay (unlike in the hover case). | 304 // No delay (unlike in the hover case). |
| 304 EXPECT_FALSE(task_runner_->HasPendingTask()); | 305 EXPECT_FALSE(task_runner_->HasPendingTask()); |
| 305 | 306 |
| 306 // Highlight should be back. | 307 // Highlight should be back. |
| 307 EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible()); | 308 EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible()); |
| 308 } | 309 } |
| 309 | 310 |
| 311 TEST_F(InkDropImplTest, HighlightCanCoexistWithRipple) { | |
| 312 ink_drop_host_.set_should_show_highlight(true); | |
| 313 ink_drop_host_.set_ripple_overrides_highlight(false); | |
| 314 | |
| 315 EXPECT_EQ(0, ink_drop_host_.num_ink_drop_layers()); | |
| 316 | |
| 317 ink_drop_.SetHovered(true); | |
|
bruthig
2016/08/31 22:22:30
Can you add a test that makes the ripple visible b
| |
| 318 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | |
| 319 | |
| 320 ink_drop_.AnimateToState(InkDropState::ACTION_PENDING); | |
| 321 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | |
| 322 EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible()); | |
| 323 | |
| 324 ink_drop_.AnimateToState(InkDropState::ACTION_TRIGGERED); | |
| 325 EXPECT_EQ(1, ink_drop_host_.num_ink_drop_layers()); | |
| 326 EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible()); | |
| 327 | |
| 328 test_api_.CompleteAnimations(); | |
| 329 | |
| 330 // Nothing to fade in because the highlight has always been visible. | |
| 331 EXPECT_FALSE(task_runner_->HasPendingTask()); | |
| 332 EXPECT_TRUE(test_api_.IsHighlightFadingInOrVisible()); | |
| 333 } | |
| 334 | |
| 310 } // namespace views | 335 } // namespace views |
| OLD | NEW |