| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
| 10 #include "chrome/common/extensions/extension_action.h" | 10 #include "chrome/common/extensions/extension_action.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 MessageLoop message_loop; | 163 MessageLoop message_loop; |
| 164 | 164 |
| 165 ExtensionAction script_badge("", ExtensionAction::TYPE_SCRIPT_BADGE); | 165 ExtensionAction script_badge("", ExtensionAction::TYPE_SCRIPT_BADGE); |
| 166 EXPECT_FALSE(script_badge.GetIsVisible(1)); | 166 EXPECT_FALSE(script_badge.GetIsVisible(1)); |
| 167 EXPECT_FALSE(script_badge.GetIconAnimation(1)); | 167 EXPECT_FALSE(script_badge.GetIconAnimation(1)); |
| 168 script_badge.SetAppearance(1, ExtensionAction::WANTS_ATTENTION); | 168 script_badge.SetAppearance(1, ExtensionAction::WANTS_ATTENTION); |
| 169 EXPECT_TRUE(script_badge.GetIsVisible(1)); | 169 EXPECT_TRUE(script_badge.GetIsVisible(1)); |
| 170 EXPECT_TRUE(script_badge.GetIconAnimation(1)); | 170 EXPECT_TRUE(script_badge.GetIconAnimation(1)); |
| 171 | 171 |
| 172 // Simulate waiting long enough for the animation to end. | 172 // Simulate waiting long enough for the animation to end. |
| 173 action.GetIconAnimation(1)->Stop(); | 173 script_badge.GetIconAnimation(1)->Stop(); |
| 174 EXPECT_FALSE(script_badge.GetIconAnimation(1)); // Sanity check. | 174 EXPECT_FALSE(script_badge.GetIconAnimation(1)); // Sanity check. |
| 175 | 175 |
| 176 script_badge.SetAppearance(1, ExtensionAction::ACTIVE); | 176 script_badge.SetAppearance(1, ExtensionAction::ACTIVE); |
| 177 EXPECT_FALSE(script_badge.GetIconAnimation(1)) | 177 EXPECT_FALSE(script_badge.GetIconAnimation(1)) |
| 178 << "The animation should not play again if the icon was already visible."; | 178 << "The animation should not play again if the icon was already visible."; |
| 179 | 179 |
| 180 message_loop.RunAllPending(); | 180 message_loop.RunAllPending(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 TEST_F(ExtensionActionTest, Badge) { | 183 TEST_F(ExtensionActionTest, Badge) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 action.SetPopupUrl(ExtensionAction::kDefaultTabId, url_baz); | 246 action.SetPopupUrl(ExtensionAction::kDefaultTabId, url_baz); |
| 247 ASSERT_EQ(url_baz, action.GetPopupUrl(1)); | 247 ASSERT_EQ(url_baz, action.GetPopupUrl(1)); |
| 248 ASSERT_EQ(url_bar, action.GetPopupUrl(100)); | 248 ASSERT_EQ(url_bar, action.GetPopupUrl(100)); |
| 249 | 249 |
| 250 action.ClearAllValuesForTab(100); | 250 action.ClearAllValuesForTab(100); |
| 251 ASSERT_EQ(url_baz, action.GetPopupUrl(1)); | 251 ASSERT_EQ(url_baz, action.GetPopupUrl(1)); |
| 252 ASSERT_EQ(url_baz, action.GetPopupUrl(100)); | 252 ASSERT_EQ(url_baz, action.GetPopupUrl(100)); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace | 255 } // namespace |
| OLD | NEW |