Index: chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
diff --git a/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
index feccd6fed5ad2a6aa31422278e4403668816a533..f2e8bb5e64f890cef393e1328bc8503538569feb 100644 |
--- a/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
+++ b/chrome/browser/ui/cocoa/base_bubble_controller_unittest.mm |
@@ -156,7 +156,8 @@ TEST_F(BaseBubbleControllerTest, ResignKeyCloses) { |
EXPECT_TRUE([other_window isVisible]); |
} |
-// Test that clicking outside the window causes the bubble to close. |
+// Test that clicking outside the window causes the bubble to close if |
+// shouldCloseOnResignKey is YES. |
TEST_F(BaseBubbleControllerTest, LionClickOutsideCloses) { |
// The event tap is only installed on 10.7+. |
if (!base::mac::IsOSLionOrLater()) |
@@ -166,16 +167,26 @@ TEST_F(BaseBubbleControllerTest, LionClickOutsideCloses) { |
base::scoped_nsobject<BaseBubbleController> keep_alive([controller_ retain]); |
NSWindow* window = [controller_ window]; |
+ EXPECT_TRUE([controller_ shouldCloseOnResignKey]); // Verify default value. |
EXPECT_FALSE([window isVisible]); |
[controller_ showWindow:nil]; |
EXPECT_TRUE([window isVisible]); |
+ [controller_ setShouldCloseOnResignKey:NO]; |
NSEvent* event = cocoa_test_event_utils::LeftMouseDownAtPointInWindow( |
NSMakePoint(10, 10), test_window()); |
[NSApp sendEvent:event]; |
chrome::testing::NSRunLoopRunAllPending(); |
+ EXPECT_TRUE([window isVisible]); |
+ |
+ [controller_ setShouldCloseOnResignKey:YES]; |
+ event = cocoa_test_event_utils::LeftMouseDownAtPointInWindow( |
+ NSMakePoint(10, 10), test_window()); |
+ [NSApp sendEvent:event]; |
+ chrome::testing::NSRunLoopRunAllPending(); |
+ |
EXPECT_FALSE([window isVisible]); |
} |