| 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/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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 385 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
| 386 | 386 |
| 387 NSArray* subviews = [[[controller() window] contentView] subviews]; | 387 NSArray* subviews = [[[controller() window] contentView] subviews]; |
| 388 EXPECT_EQ(1U, [subviews count]); | 388 EXPECT_EQ(1U, [subviews count]); |
| 389 subviews = [[subviews objectAtIndex:0] subviews]; | 389 subviews = [[subviews objectAtIndex:0] subviews]; |
| 390 | 390 |
| 391 // There should be one active card, one accounts container, two separators | 391 // There should be one active card, one accounts container, two separators |
| 392 // and one option buttons view. | 392 // and one option buttons view. |
| 393 EXPECT_EQ(5U, [subviews count]); | 393 EXPECT_EQ(5U, [subviews count]); |
| 394 | 394 |
| 395 // There should be two buttons in the option buttons view. | 395 // There should be two buttons and a separator in the option buttons view. |
| 396 NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews]; | 396 NSArray* buttonSubviews = [[subviews objectAtIndex:0] subviews]; |
| 397 const SEL buttonSelectors[] = { @selector(showUserManager:), | 397 EXPECT_EQ(3U, [buttonSubviews count]); |
| 398 @selector(lockProfile:) }; | 398 |
| 399 EXPECT_EQ(2U, [buttonSubviews count]); | 399 NSButton* notYouButton = |
| 400 for (NSUInteger i = 0; i < [buttonSubviews count]; ++i) { | 400 static_cast<NSButton*>([buttonSubviews objectAtIndex:0]); |
| 401 NSButton* button = static_cast<NSButton*>([buttonSubviews objectAtIndex:i]); | 401 EXPECT_EQ(@selector(showUserManager:), [notYouButton action]); |
| 402 EXPECT_EQ(buttonSelectors[i], [button action]); | 402 EXPECT_EQ(controller(), [notYouButton target]); |
| 403 EXPECT_EQ(controller(), [button target]); | 403 |
| 404 } | 404 EXPECT_TRUE([[buttonSubviews objectAtIndex:1] isKindOfClass:[NSBox class]]); |
| 405 |
| 406 NSButton* lockButton = |
| 407 static_cast<NSButton*>([buttonSubviews objectAtIndex:2]); |
| 408 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); |
| 409 EXPECT_EQ(controller(), [lockButton target]); |
| 405 | 410 |
| 406 // There should be a separator. | 411 // There should be a separator. |
| 407 EXPECT_TRUE([[subviews objectAtIndex:1] isKindOfClass:[NSBox class]]); | 412 EXPECT_TRUE([[subviews objectAtIndex:1] isKindOfClass:[NSBox class]]); |
| 408 | 413 |
| 409 // In the accounts view, there should be the account list container | 414 // In the accounts view, there should be the account list container |
| 410 // accounts and one "add accounts" button. | 415 // accounts and one "add accounts" button. |
| 411 NSArray* accountsSubviews = [[subviews objectAtIndex:2] subviews]; | 416 NSArray* accountsSubviews = [[subviews objectAtIndex:2] subviews]; |
| 412 EXPECT_EQ(2U, [accountsSubviews count]); | 417 EXPECT_EQ(2U, [accountsSubviews count]); |
| 413 | 418 |
| 414 NSButton* addAccountsButton = | 419 NSButton* addAccountsButton = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16( | 460 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16( |
| 456 [static_cast<NSButton*>(activeProfileName) title])); | 461 [static_cast<NSButton*>(activeProfileName) title])); |
| 457 | 462 |
| 458 // Profile links. This is a local profile, so there should be a signin button. | 463 // Profile links. This is a local profile, so there should be a signin button. |
| 459 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews]; | 464 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews]; |
| 460 EXPECT_EQ(1U, [linksSubviews count]); | 465 EXPECT_EQ(1U, [linksSubviews count]); |
| 461 NSButton* link = static_cast<NSButton*>([linksSubviews objectAtIndex:0]); | 466 NSButton* link = static_cast<NSButton*>([linksSubviews objectAtIndex:0]); |
| 462 EXPECT_EQ(@selector(hideAccountManagement:), [link action]); | 467 EXPECT_EQ(@selector(hideAccountManagement:), [link action]); |
| 463 EXPECT_EQ(controller(), [link target]); | 468 EXPECT_EQ(controller(), [link target]); |
| 464 } | 469 } |
| OLD | NEW |