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 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
" | 5 #import "chrome/browser/ui/cocoa/website_settings/permission_bubble_controller.h
" |
6 | 6 |
7 #include <Carbon/Carbon.h> | 7 #include <Carbon/Carbon.h> |
8 | 8 |
9 #include "base/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #import "base/mac/scoped_objc_class_swizzler.h" | 10 #import "base/mac/scoped_objc_class_swizzler.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 NSMenu* menu = [base::mac::ObjCCastStrict<NSPopUpButton>(menu_button) menu]; | 149 NSMenu* menu = [base::mac::ObjCCastStrict<NSPopUpButton>(menu_button) menu]; |
150 NSString* next_title = l10n_util::GetNSString(next_title_id); | 150 NSString* next_title = l10n_util::GetNSString(next_title_id); |
151 EXPECT_EQ([[menu itemWithTitle:[menu_button title]] state], NSOnState); | 151 EXPECT_EQ([[menu itemWithTitle:[menu_button title]] state], NSOnState); |
152 NSMenuItem* next_item = [menu itemWithTitle:next_title]; | 152 NSMenuItem* next_item = [menu itemWithTitle:next_title]; |
153 EXPECT_EQ([next_item state], NSOffState); | 153 EXPECT_EQ([next_item state], NSOffState); |
154 [menu performActionForItemAtIndex:[menu indexOfItem:next_item]]; | 154 [menu performActionForItemAtIndex:[menu indexOfItem:next_item]]; |
155 } | 155 } |
156 | 156 |
157 protected: | 157 protected: |
158 PermissionBubbleController* controller_; // Weak; it deletes itself. | 158 PermissionBubbleController* controller_; // Weak; it deletes itself. |
159 scoped_ptr<PermissionBubbleCocoa> bridge_; | 159 std::unique_ptr<PermissionBubbleCocoa> bridge_; |
160 std::vector<PermissionBubbleRequest*> requests_; | 160 std::vector<PermissionBubbleRequest*> requests_; |
161 std::vector<bool> accept_states_; | 161 std::vector<bool> accept_states_; |
162 }; | 162 }; |
163 | 163 |
164 TEST_F(PermissionBubbleControllerTest, ShowAndClose) { | 164 TEST_F(PermissionBubbleControllerTest, ShowAndClose) { |
165 EXPECT_FALSE([[controller_ window] isVisible]); | 165 EXPECT_FALSE([[controller_ window] isVisible]); |
166 [controller_ showWindow:nil]; | 166 [controller_ showWindow:nil]; |
167 EXPECT_TRUE([[controller_ window] isVisible]); | 167 EXPECT_TRUE([[controller_ window] isVisible]); |
168 } | 168 } |
169 | 169 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 [PermissionBubbleController class], | 401 [PermissionBubbleController class], |
402 [MockBubbleNoLocationBar class], | 402 [MockBubbleNoLocationBar class], |
403 @selector(hasLocationBar)); | 403 @selector(hasLocationBar)); |
404 withoutLocationBar = [controller_ getExpectedAnchorPoint]; | 404 withoutLocationBar = [controller_ getExpectedAnchorPoint]; |
405 } | 405 } |
406 | 406 |
407 // The bubble should be in different places depending if the location bar is | 407 // The bubble should be in different places depending if the location bar is |
408 // available or not. | 408 // available or not. |
409 EXPECT_NSNE(withLocationBar, withoutLocationBar); | 409 EXPECT_NSNE(withLocationBar, withoutLocationBar); |
410 } | 410 } |
OLD | NEW |