OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/views/tabs/alert_indicator_button.h" | 5 #include "chrome/browser/ui/views/tabs/alert_indicator_button.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" | 7 #include "chrome/browser/ui/views/tabs/fake_base_tab_strip_controller.h" |
8 #include "chrome/browser/ui/views/tabs/tab.h" | 8 #include "chrome/browser/ui/views/tabs/tab.h" |
9 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 9 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void StopAnimation(Tab* tab) { | 56 void StopAnimation(Tab* tab) { |
57 ASSERT_TRUE(tab->alert_indicator_button_->fade_animation_); | 57 ASSERT_TRUE(tab->alert_indicator_button_->fade_animation_); |
58 tab->alert_indicator_button_->fade_animation_->Stop(); | 58 tab->alert_indicator_button_->fade_animation_->Stop(); |
59 } | 59 } |
60 | 60 |
61 // Owned by TabStrip. | 61 // Owned by TabStrip. |
62 FakeBaseTabStripController* controller_; | 62 FakeBaseTabStripController* controller_; |
63 // Owns |tab_strip_|. | 63 // Owns |tab_strip_|. |
64 views::View parent_; | 64 views::View parent_; |
65 TabStrip* tab_strip_; | 65 TabStrip* tab_strip_; |
66 scoped_ptr<views::Widget> widget_; | 66 std::unique_ptr<views::Widget> widget_; |
67 | 67 |
68 private: | 68 private: |
69 DISALLOW_COPY_AND_ASSIGN(AlertIndicatorButtonTest); | 69 DISALLOW_COPY_AND_ASSIGN(AlertIndicatorButtonTest); |
70 }; | 70 }; |
71 | 71 |
72 // This test verifies that the tab has its icon state updated when the alert | 72 // This test verifies that the tab has its icon state updated when the alert |
73 // animation fade-out finishes. | 73 // animation fade-out finishes. |
74 TEST_F(AlertIndicatorButtonTest, ButtonUpdateOnAudioStateAnimation) { | 74 TEST_F(AlertIndicatorButtonTest, ButtonUpdateOnAudioStateAnimation) { |
75 controller_->AddPinnedTab(0, false); | 75 controller_->AddPinnedTab(0, false); |
76 controller_->AddTab(1, true); | 76 controller_->AddTab(1, true); |
(...skipping 24 matching lines...) Expand all Loading... |
101 | 101 |
102 // Rather than flakily waiting some unknown number of seconds for the fade | 102 // Rather than flakily waiting some unknown number of seconds for the fade |
103 // out animation to stop, reach out and stop the fade animation directly, | 103 // out animation to stop, reach out and stop the fade animation directly, |
104 // to make sure that it updates the tab appropriately when it's done. | 104 // to make sure that it updates the tab appropriately when it's done. |
105 StopAnimation(media_tab); | 105 StopAnimation(media_tab); |
106 | 106 |
107 EXPECT_TRUE(showing_icon(media_tab)); | 107 EXPECT_TRUE(showing_icon(media_tab)); |
108 EXPECT_FALSE(showing_alert_indicator(media_tab)); | 108 EXPECT_FALSE(showing_alert_indicator(media_tab)); |
109 EXPECT_FALSE(showing_close_button(media_tab)); | 109 EXPECT_FALSE(showing_close_button(media_tab)); |
110 } | 110 } |
OLD | NEW |