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

Side by Side Diff: chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller_unittest.mm

Issue 2298963002: Material Page Info (Mac, 3/3): Update site settings section. (Closed)
Patch Set: Update WSBC tests to compensate for removing the Permissions label. Created 4 years, 3 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
« no previous file with comments | « chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro ller.h" 5 #import "chrome/browser/ui/cocoa/website_settings/website_settings_bubble_contro ller.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // Since the bubble is only created once per identity, we only need to check 245 // Since the bubble is only created once per identity, we only need to check
246 // the button is *added* when needed. So we don't check that it's removed 246 // the button is *added* when needed. So we don't check that it's removed
247 // when we set an identity with `show_ssl_decision_revoke_button == false` 247 // when we set an identity with `show_ssl_decision_revoke_button == false`
248 // again. 248 // again.
249 } 249 }
250 250
251 TEST_F(WebsiteSettingsBubbleControllerTest, SetPermissionInfo) { 251 TEST_F(WebsiteSettingsBubbleControllerTest, SetPermissionInfo) {
252 CreateBubble(); 252 CreateBubble();
253 SetTestPermissions(); 253 SetTestPermissions();
254 254
255 // There should be three subviews per permission (an icon, a label and a 255 // There should be three subviews per permission.
256 // select box), plus a text label for the Permission section.
257 NSArray* subviews = [[controller_ permissionsView] subviews]; 256 NSArray* subviews = [[controller_ permissionsView] subviews];
258 EXPECT_EQ(arraysize(kTestPermissionTypes) * 3 + 1, [subviews count]); 257 EXPECT_EQ(arraysize(kTestPermissionTypes) * 3 , [subviews count]);
259 258
260 // Ensure that there is a distinct label for each permission. 259 // Ensure that there is a distinct label for each permission.
261 NSMutableSet* labels = [NSMutableSet set]; 260 NSMutableSet* labels = [NSMutableSet set];
262 for (NSView* view in subviews) { 261 for (NSView* view in subviews) {
263 if ([view isKindOfClass:[NSTextField class]]) 262 if ([view isKindOfClass:[NSTextField class]])
264 [labels addObject:[static_cast<NSTextField*>(view) stringValue]]; 263 [labels addObject:[static_cast<NSTextField*>(view) stringValue]];
265 } 264 }
266 // The section header ("Permissions") will also be found, hence the +1. 265 EXPECT_EQ(arraysize(kTestPermissionTypes), [labels count]);
267 EXPECT_EQ(arraysize(kTestPermissionTypes) + 1, [labels count]);
268 266
269 // Ensure that the button labels are distinct, and look for the correct 267 // Ensure that the button labels are distinct, and look for the correct
270 // number of disabled buttons. 268 // number of disabled buttons.
271 int disabled_count = 0; 269 int disabled_count = 0;
272 [labels removeAllObjects]; 270 [labels removeAllObjects];
273 for (NSView* view in subviews) { 271 for (NSView* view in subviews) {
274 if ([view isKindOfClass:[NSPopUpButton class]]) { 272 if ([view isKindOfClass:[NSPopUpButton class]]) {
275 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); 273 NSPopUpButton* button = static_cast<NSPopUpButton*>(view);
276 [labels addObject:[[button selectedCell] title]]; 274 [labels addObject:[[button selectedCell] title]];
277 275
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 } 315 }
318 if ([view isKindOfClass:[NSPopUpButton class]]) { 316 if ([view isKindOfClass:[NSPopUpButton class]]) {
319 NSPopUpButton* button = static_cast<NSPopUpButton*>(view); 317 NSPopUpButton* button = static_cast<NSPopUpButton*>(view);
320 EXPECT_LT(NSMaxX([button frame]), window_width); 318 EXPECT_LT(NSMaxX([button frame]), window_width);
321 } 319 }
322 } 320 }
323 } 321 }
324 } 322 }
325 323
326 } // namespace 324 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/website_settings/website_settings_bubble_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698