OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_bubble_controller.h" | 5 #import "chrome/browser/ui/cocoa/website_settings_bubble_controller.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 8 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
9 #include "testing/gtest_mac.h" | 9 #include "testing/gtest_mac.h" |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // Return a pointer to the first NSTextField found that either matches, or | 86 // Return a pointer to the first NSTextField found that either matches, or |
87 // doesn't match, the given text. | 87 // doesn't match, the given text. |
88 NSTextField* FindTextField(MatchType match_type, NSString* text) { | 88 NSTextField* FindTextField(MatchType match_type, NSString* text) { |
89 // The window's only immediate child is an invisible view that has a flipped | 89 // The window's only immediate child is an invisible view that has a flipped |
90 // coordinate origin. It is into this that all views get placed. | 90 // coordinate origin. It is into this that all views get placed. |
91 NSArray* window_subviews = [[window_ contentView] subviews]; | 91 NSArray* window_subviews = [[window_ contentView] subviews]; |
92 EXPECT_EQ(1U, [window_subviews count]); | 92 EXPECT_EQ(1U, [window_subviews count]); |
93 NSArray* subviews = [[window_subviews lastObject] subviews]; | 93 NSArray* subviews = [[window_subviews lastObject] subviews]; |
94 | 94 |
95 // Expect 3 views: the identity, identity status, and the tab view. | 95 // Expect 4 views: the identity, identity status, the segmented control |
96 EXPECT_EQ(3U, [subviews count]); | 96 // (which implements the tab strip), and the tab view. |
| 97 EXPECT_EQ(4U, [subviews count]); |
97 | 98 |
98 bool desired_result = match_type == TEXT_EQUAL; | 99 bool desired_result = match_type == TEXT_EQUAL; |
99 | 100 |
100 for (NSView* view in subviews) { | 101 for (NSView* view in subviews) { |
101 if ([view isKindOfClass:[NSTextField class]]) { | 102 if ([view isKindOfClass:[NSTextField class]]) { |
102 NSTextField* text_field = static_cast<NSTextField*>(view); | 103 NSTextField* text_field = static_cast<NSTextField*>(view); |
103 if ([[text_field stringValue] isEqual:text] == desired_result) | 104 if ([[text_field stringValue] isEqual:text] == desired_result) |
104 return text_field; | 105 return text_field; |
105 } | 106 } |
106 } | 107 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 [button selectItemAtIndex:kMenuIndexContentSettingDefault]; | 237 [button selectItemAtIndex:kMenuIndexContentSettingDefault]; |
237 [controller_ permissionValueChanged:button]; | 238 [controller_ permissionValueChanged:button]; |
238 EXPECT_NSNE(original_title, [[[button cell] menuItem] title]); | 239 EXPECT_NSNE(original_title, [[[button cell] menuItem] title]); |
239 | 240 |
240 [button selectItemAtIndex:kMenuIndexContentSettingAllow]; | 241 [button selectItemAtIndex:kMenuIndexContentSettingAllow]; |
241 [controller_ permissionValueChanged:button]; | 242 [controller_ permissionValueChanged:button]; |
242 EXPECT_NSEQ(original_title, [[[button cell] menuItem] title]); | 243 EXPECT_NSEQ(original_title, [[[button cell] menuItem] title]); |
243 } | 244 } |
244 | 245 |
245 } // namespace | 246 } // namespace |
OLD | NEW |