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

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm

Issue 265073003: [Win, Mac] UI fixes for the delete account button in the new avatar bubble. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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/profiles/profile_chooser_controller.h" 5 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/mac/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 static_cast<NSButton*>([accountsSubviews objectAtIndex:0]); 393 static_cast<NSButton*>([accountsSubviews objectAtIndex:0]);
394 EXPECT_EQ(@selector(addAccount:), [addAccountsButton action]); 394 EXPECT_EQ(@selector(addAccount:), [addAccountsButton action]);
395 EXPECT_EQ(controller(), [addAccountsButton target]); 395 EXPECT_EQ(controller(), [addAccountsButton target]);
396 396
397 // There should be two accounts in the account list container. 397 // There should be two accounts in the account list container.
398 NSArray* accountsListSubviews = [[accountsSubviews objectAtIndex:1] subviews]; 398 NSArray* accountsListSubviews = [[accountsSubviews objectAtIndex:1] subviews];
399 EXPECT_EQ(2U, [accountsListSubviews count]); 399 EXPECT_EQ(2U, [accountsListSubviews count]);
400 400
401 NSButton* genericAccount = 401 NSButton* genericAccount =
402 static_cast<NSButton*>([accountsListSubviews objectAtIndex:0]); 402 static_cast<NSButton*>([accountsListSubviews objectAtIndex:0]);
403 EXPECT_EQ(@selector(showAccountRemovalView:), [genericAccount action]); 403 NSButton* genericAccountDelete =
404 EXPECT_EQ(controller(), [genericAccount target]); 404 static_cast<NSButton*>([[genericAccount subviews] objectAtIndex:0]);
405 EXPECT_NE(-1, [genericAccount tag]); 405 EXPECT_EQ(@selector(showAccountRemovalView:), [genericAccountDelete action]);
406 EXPECT_EQ(controller(), [genericAccountDelete target]);
407 EXPECT_NE(-1, [genericAccountDelete tag]);
406 408
407 // Primary accounts are always last. 409 // Primary accounts are always last.
408 NSButton* primaryAccount = 410 NSButton* primaryAccount =
409 static_cast<NSButton*>([accountsListSubviews objectAtIndex:1]); 411 static_cast<NSButton*>([accountsListSubviews objectAtIndex:1]);
410 EXPECT_EQ(@selector(showAccountRemovalView:), [primaryAccount action]); 412 NSButton* primaryAccountDelete =
411 EXPECT_EQ(controller(), [primaryAccount target]); 413 static_cast<NSButton*>([[primaryAccount subviews] objectAtIndex:0]);
412 EXPECT_EQ(-1, [primaryAccount tag]); 414 EXPECT_EQ(@selector(showAccountRemovalView:), [primaryAccountDelete action]);
415 EXPECT_EQ(controller(), [primaryAccountDelete target]);
416 EXPECT_EQ(-1, [primaryAccountDelete tag]);
413 417
414 // There should be another separator. 418 // There should be another separator.
415 EXPECT_TRUE([[subviews objectAtIndex:3] isKindOfClass:[NSBox class]]); 419 EXPECT_TRUE([[subviews objectAtIndex:3] isKindOfClass:[NSBox class]]);
416 420
417 // There should be the profile avatar, name and a "hide accounts" link 421 // There should be the profile avatar, name and a "hide accounts" link
418 // container in the active card view. 422 // container in the active card view.
419 NSArray* activeCardSubviews = [[subviews objectAtIndex:4] subviews]; 423 NSArray* activeCardSubviews = [[subviews objectAtIndex:4] subviews];
420 EXPECT_EQ(3U, [activeCardSubviews count]); 424 EXPECT_EQ(3U, [activeCardSubviews count]);
421 425
422 // Profile icon. 426 // Profile icon.
423 NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2]; 427 NSView* activeProfileImage = [activeCardSubviews objectAtIndex:2];
424 EXPECT_TRUE([activeProfileImage isKindOfClass:[NSImageView class]]); 428 EXPECT_TRUE([activeProfileImage isKindOfClass:[NSImageView class]]);
425 429
426 // Profile name. 430 // Profile name.
427 NSView* activeProfileName = [activeCardSubviews objectAtIndex:1]; 431 NSView* activeProfileName = [activeCardSubviews objectAtIndex:1];
428 EXPECT_TRUE([activeProfileName isKindOfClass:[NSButton class]]); 432 EXPECT_TRUE([activeProfileName isKindOfClass:[NSButton class]]);
429 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16( 433 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16(
430 [static_cast<NSButton*>(activeProfileName) title])); 434 [static_cast<NSButton*>(activeProfileName) title]));
431 435
432 // Profile links. This is a local profile, so there should be a signin button. 436 // Profile links. This is a local profile, so there should be a signin button.
433 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews]; 437 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews];
434 EXPECT_EQ(1U, [linksSubviews count]); 438 EXPECT_EQ(1U, [linksSubviews count]);
435 NSButton* link = static_cast<NSButton*>([linksSubviews objectAtIndex:0]); 439 NSButton* link = static_cast<NSButton*>([linksSubviews objectAtIndex:0]);
436 EXPECT_EQ(@selector(hideAccountManagement:), [link action]); 440 EXPECT_EQ(@selector(hideAccountManagement:), [link action]);
437 EXPECT_EQ(controller(), [link target]); 441 EXPECT_EQ(controller(), [link target]);
438 } 442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698