Index: chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm |
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm |
index bd14004e339f48c8efc6cb8d263ff6755becea5d..4c7d1e4f62d5bbbc476c308ef0089c7b6ff95267 100644 |
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm |
+++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm |
@@ -9,6 +9,7 @@ |
#include "base/compiler_specific.h" |
#include "base/mac/foundation_util.h" |
#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_command_controller.h" |
#include "chrome/browser/ui/browser_window.h" |
#import "chrome/browser/ui/cocoa/browser_window_controller.h" |
#include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
@@ -77,6 +78,11 @@ class ManagePasswordsBubbleCocoaTest : public CocoaProfileTest { |
return bubble ? [bubble->controller_ window] : nil; |
} |
+ ManagePasswordsIconCocoa* icon() { |
+ return static_cast<ManagePasswordsIconCocoa*>( |
+ ManagePasswordsBubbleCocoa::instance()->icon_); |
+ } |
+ |
private: |
scoped_refptr<content::SiteInstance> siteInstance_; |
content::WebContents* test_web_contents_; // weak |
@@ -124,3 +130,14 @@ TEST_F(ManagePasswordsBubbleCocoaTest, ShowBubbleOnInactiveTabShouldDoNothing) { |
ShowBubble(); |
EXPECT_FALSE(ManagePasswordsBubbleCocoa::instance()); |
} |
+ |
+TEST_F(ManagePasswordsBubbleCocoaTest, HideBubbleOnChangedState) { |
+ ShowBubble(); |
+ EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); |
+ EXPECT_TRUE([bubbleWindow() isVisible]); |
+ EXPECT_TRUE(icon()->active()); |
+ |
+ icon()->OnChangingState(); |
+ EXPECT_FALSE(ManagePasswordsBubbleCocoa::instance()); |
+ EXPECT_FALSE([bubbleWindow() isVisible]); |
+} |