| OLD | NEW |
| 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 "base/mac/foundation_util.h" | 5 #include "base/mac/foundation_util.h" |
| 6 #include "base/mac/scoped_objc_class_swizzler.h" | 6 #include "base/mac/scoped_objc_class_swizzler.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
| 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 10 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // Open a new tab. | 105 // Open a new tab. |
| 106 int firstTab = browser()->tab_strip_model()->active_index(); | 106 int firstTab = browser()->tab_strip_model()->active_index(); |
| 107 AddTabAtIndex( | 107 AddTabAtIndex( |
| 108 firstTab + 1, GURL("http://foo.bar/"), ui::PAGE_TRANSITION_TYPED); | 108 firstTab + 1, GURL("http://foo.bar/"), ui::PAGE_TRANSITION_TYPED); |
| 109 EXPECT_FALSE(decoration()->IsVisible()); | 109 EXPECT_FALSE(decoration()->IsVisible()); |
| 110 | 110 |
| 111 // Switch back to the previous tab. | 111 // Switch back to the previous tab. |
| 112 browser()->tab_strip_model()->ActivateTabAt(firstTab, true); | 112 browser()->tab_strip_model()->ActivateTabAt(firstTab, true); |
| 113 EXPECT_TRUE(decoration()->IsVisible()); | 113 EXPECT_TRUE(decoration()->IsVisible()); |
| 114 } | 114 } |
| 115 |
| 116 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleTest, DoubleOpenBubble) { |
| 117 // Open the bubble first. |
| 118 DoWithSwizzledNSWindow(^{ SetupPendingPassword(); }); |
| 119 base::scoped_nsobject<ManagePasswordsBubbleController> bubble_controller( |
| 120 [controller() retain]); |
| 121 EXPECT_TRUE(bubble_controller); |
| 122 EXPECT_TRUE(view()->active()); |
| 123 |
| 124 // Open the bubble again, the first one should be replaced. |
| 125 DoWithSwizzledNSWindow(^{ SetupPendingPassword(); }); |
| 126 EXPECT_NSNE(bubble_controller, controller()); |
| 127 EXPECT_TRUE(controller()); |
| 128 EXPECT_TRUE(view()->active()); |
| 129 } |
| OLD | NEW |