OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/ui/tabs/tab_audio_indicator.h" | 5 #include "chrome/browser/ui/tabs/tab_audio_indicator.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/base/animation/linear_animation.h" | |
11 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/animation/linear_animation.h" |
12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
13 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
14 | 14 |
15 class TabAudioIndicatorTest : public TabAudioIndicator::Delegate, | 15 class TabAudioIndicatorTest : public TabAudioIndicator::Delegate, |
16 public testing::Test { | 16 public testing::Test { |
17 protected: | 17 protected: |
18 TabAudioIndicatorTest() : schedule_paint_count_(0) {} | 18 TabAudioIndicatorTest() : schedule_paint_count_(0) {} |
19 | 19 |
20 virtual void ScheduleAudioIndicatorPaint() OVERRIDE { | 20 virtual void ScheduleAudioIndicatorPaint() OVERRIDE { |
21 ++schedule_paint_count_; | 21 ++schedule_paint_count_; |
22 } | 22 } |
23 | 23 |
24 int schedule_paint_count_; | 24 int schedule_paint_count_; |
25 base::MessageLoopForUI message_loop_; // Needed for ui::LinearAnimation. | 25 base::MessageLoopForUI message_loop_; // Needed for gfx::LinearAnimation. |
26 | 26 |
27 private: | 27 private: |
28 DISALLOW_COPY_AND_ASSIGN(TabAudioIndicatorTest); | 28 DISALLOW_COPY_AND_ASSIGN(TabAudioIndicatorTest); |
29 }; | 29 }; |
30 | 30 |
31 TEST_F(TabAudioIndicatorTest, AnimationState) { | 31 TEST_F(TabAudioIndicatorTest, AnimationState) { |
32 // Start animating. | 32 // Start animating. |
33 TabAudioIndicator indicator(this); | 33 TabAudioIndicator indicator(this); |
34 indicator.SetIsPlayingAudio(true); | 34 indicator.SetIsPlayingAudio(true); |
35 EXPECT_EQ(TabAudioIndicator::STATE_ANIMATING, indicator.state_); | 35 EXPECT_EQ(TabAudioIndicator::STATE_ANIMATING, indicator.state_); |
(...skipping 29 matching lines...) Expand all Loading... |
65 | 65 |
66 TEST_F(TabAudioIndicatorTest, SchedulePaint) { | 66 TEST_F(TabAudioIndicatorTest, SchedulePaint) { |
67 TabAudioIndicator indicator(this); | 67 TabAudioIndicator indicator(this); |
68 indicator.SetIsPlayingAudio(true); | 68 indicator.SetIsPlayingAudio(true); |
69 | 69 |
70 indicator.animation_->SetCurrentValue(1.0); | 70 indicator.animation_->SetCurrentValue(1.0); |
71 schedule_paint_count_ = 0; | 71 schedule_paint_count_ = 0; |
72 indicator.AnimationProgressed(NULL); | 72 indicator.AnimationProgressed(NULL); |
73 EXPECT_EQ(1, schedule_paint_count_); | 73 EXPECT_EQ(1, schedule_paint_count_); |
74 } | 74 } |
OLD | NEW |