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

Side by Side Diff: chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa_unittest.mm

Issue 2018013002: Refresh the password bubble if it's open when the second request comes in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/cocoa/passwords/passwords_bubble_cocoa.h" 5 #include "chrome/browser/ui/cocoa/passwords/passwords_bubble_cocoa.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 ShowBubble(false); 170 ShowBubble(false);
171 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); 171 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance());
172 EXPECT_TRUE([bubbleWindow() isVisible]); 172 EXPECT_TRUE([bubbleWindow() isVisible]);
173 EXPECT_TRUE(icon()->active()); 173 EXPECT_TRUE(icon()->active());
174 174
175 icon()->OnChangingState(); 175 icon()->OnChangingState();
176 EXPECT_FALSE(ManagePasswordsBubbleCocoa::instance()); 176 EXPECT_FALSE(ManagePasswordsBubbleCocoa::instance());
177 EXPECT_FALSE([bubbleWindow() isVisible]); 177 EXPECT_FALSE([bubbleWindow() isVisible]);
178 } 178 }
179 179
180 TEST_F(ManagePasswordsBubbleCocoaTest, ShowBubbleTwice) {
181 ShowBubble(false);
182 base::scoped_nsobject<NSWindow> bubble([bubbleWindow() retain]);
183 // Opening the bubble again should retrieve the data from the UI controller
184 // again.
185 ShowBubble(false);
186 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance());
187 EXPECT_NSNE(bubble, bubbleWindow());
188 EXPECT_TRUE([bubbleWindow() isVisible]);
189 }
190
180 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithoutFocus) { 191 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithoutFocus) {
181 ShowBubble(false); 192 ShowBubble(false);
182 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); 193 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance());
183 EXPECT_FALSE([controller() shouldOpenAsKeyWindow]); 194 EXPECT_FALSE([controller() shouldOpenAsKeyWindow]);
184 EXPECT_FALSE([bubbleWindow() defaultButtonCell]); 195 EXPECT_FALSE([bubbleWindow() defaultButtonCell]);
185 } 196 }
186 197
187 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithFocus) { 198 TEST_F(ManagePasswordsBubbleCocoaTest, OpenWithFocus) {
188 ShowBubble(true); 199 ShowBubble(true);
189 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance()); 200 EXPECT_TRUE(ManagePasswordsBubbleCocoa::instance());
190 EXPECT_TRUE([controller() shouldOpenAsKeyWindow]); 201 EXPECT_TRUE([controller() shouldOpenAsKeyWindow]);
191 EXPECT_TRUE([bubbleWindow() defaultButtonCell]); 202 EXPECT_TRUE([bubbleWindow() defaultButtonCell]);
192 } 203 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698