| 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/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 indicator.animation_->End(); | 44 indicator.animation_->End(); |
| 45 EXPECT_EQ(TabAudioIndicator::STATE_NOT_ANIMATING, indicator.state_); | 45 EXPECT_EQ(TabAudioIndicator::STATE_NOT_ANIMATING, indicator.state_); |
| 46 EXPECT_FALSE(indicator.IsAnimating()); | 46 EXPECT_FALSE(indicator.IsAnimating()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 TEST_F(TabAudioIndicatorTest, Paint) { | 49 TEST_F(TabAudioIndicatorTest, Paint) { |
| 50 TabAudioIndicator indicator(this); | 50 TabAudioIndicator indicator(this); |
| 51 indicator.SetIsPlayingAudio(true); | 51 indicator.SetIsPlayingAudio(true); |
| 52 | 52 |
| 53 gfx::Rect rect(0, 0, 16, 16); | 53 gfx::Rect rect(0, 0, 16, 16); |
| 54 gfx::Canvas canvas(rect.size(), ui::SCALE_FACTOR_100P, true); | 54 gfx::Canvas canvas(rect.size(), 1.0f, true); |
| 55 | 55 |
| 56 // Nothing to test here. Just exercise the paint code to verify that nothing | 56 // Nothing to test here. Just exercise the paint code to verify that nothing |
| 57 // leaks or crashes. | 57 // leaks or crashes. |
| 58 indicator.Paint(&canvas, rect); | 58 indicator.Paint(&canvas, rect); |
| 59 | 59 |
| 60 // Paint with a favicon. | 60 // Paint with a favicon. |
| 61 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 61 ui::ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 62 indicator.set_favicon(*rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16)); | 62 indicator.set_favicon(*rb.GetImageSkiaNamed(IDR_PRODUCT_LOGO_16)); |
| 63 indicator.Paint(&canvas, rect); | 63 indicator.Paint(&canvas, rect); |
| 64 } | 64 } |
| 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 |