| 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_highlight.h" | 5 #include "ui/views/animation/ink_drop_highlight.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 TestInkDropHighlightObserver observer_; | 49 TestInkDropHighlightObserver observer_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(InkDropHighlightTest); | 51 DISALLOW_COPY_AND_ASSIGN(InkDropHighlightTest); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 InkDropHighlightTest::InkDropHighlightTest() { | 54 InkDropHighlightTest::InkDropHighlightTest() { |
| 55 InitHighlight(base::MakeUnique<InkDropHighlight>( | 55 InitHighlight(base::MakeUnique<InkDropHighlight>( |
| 56 gfx::Size(10, 10), 3, gfx::PointF(), SK_ColorBLACK)); | 56 gfx::Size(10, 10), 3, gfx::PointF(), SK_ColorBLACK)); |
| 57 } | 57 } |
| 58 | 58 |
| 59 InkDropHighlightTest::~InkDropHighlightTest() {} | 59 InkDropHighlightTest::~InkDropHighlightTest() { |
| 60 // Destory highlight to make sure it is destroyed before the observer. |
| 61 DestroyHighlight(); |
| 62 } |
| 60 | 63 |
| 61 void InkDropHighlightTest::InitHighlight( | 64 void InkDropHighlightTest::InitHighlight( |
| 62 std::unique_ptr<InkDropHighlight> new_highlight) { | 65 std::unique_ptr<InkDropHighlight> new_highlight) { |
| 63 ink_drop_highlight_ = std::move(new_highlight); | 66 ink_drop_highlight_ = std::move(new_highlight); |
| 64 test_api_ = | 67 test_api_ = |
| 65 base::MakeUnique<InkDropHighlightTestApi>(ink_drop_highlight_.get()); | 68 base::MakeUnique<InkDropHighlightTestApi>(ink_drop_highlight_.get()); |
| 66 test_api()->SetDisableAnimationTimers(true); | 69 test_api()->SetDisableAnimationTimers(true); |
| 67 ink_drop_highlight()->set_observer(&observer_); | 70 ink_drop_highlight()->set_observer(&observer_); |
| 68 } | 71 } |
| 69 | 72 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 // Confirms a zero sized highlight doesn't crash. | 179 // Confirms a zero sized highlight doesn't crash. |
| 177 TEST_F(InkDropHighlightTest, AnimatingAZeroSizeHighlight) { | 180 TEST_F(InkDropHighlightTest, AnimatingAZeroSizeHighlight) { |
| 178 InitHighlight(base::MakeUnique<InkDropHighlight>( | 181 InitHighlight(base::MakeUnique<InkDropHighlight>( |
| 179 gfx::Size(0, 0), 3, gfx::PointF(), SK_ColorBLACK)); | 182 gfx::Size(0, 0), 3, gfx::PointF(), SK_ColorBLACK)); |
| 180 ink_drop_highlight()->FadeOut(base::TimeDelta::FromMilliseconds(0), | 183 ink_drop_highlight()->FadeOut(base::TimeDelta::FromMilliseconds(0), |
| 181 false /* explode */); | 184 false /* explode */); |
| 182 } | 185 } |
| 183 | 186 |
| 184 } // namespace test | 187 } // namespace test |
| 185 } // namespace views | 188 } // namespace views |
| OLD | NEW |