Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5062)

Unified Diff: chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm

Issue 1028243004: Hide the password bubble when the underlying ManagePasswordsUIController changes its state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add a Mac test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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]);
+}

Powered by Google App Engine
This is Rietveld 408576698