| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/autofill/autofill_account_chooser.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_account_chooser.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" | 10 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 EXPECT_TRUE(hasIcon); | 75 EXPECT_TRUE(hasIcon); |
| 76 EXPECT_TRUE(hasLink); | 76 EXPECT_TRUE(hasLink); |
| 77 EXPECT_TRUE(hasPopup); | 77 EXPECT_TRUE(hasPopup); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Validate that the account menu is properly populated. | 80 // Validate that the account menu is properly populated. |
| 81 TEST_F(AutofillAccountChooserTest, PopulatesMenu) { | 81 TEST_F(AutofillAccountChooserTest, PopulatesMenu) { |
| 82 using namespace testing; | 82 using namespace testing; |
| 83 MenuDelegate delegate; | 83 MenuDelegate delegate; |
| 84 ui::SimpleMenuModel model(&delegate); | 84 ui::SimpleMenuModel model(&delegate); |
| 85 model.AddItem(1, ASCIIToUTF16("one")); | 85 model.AddItem(1, base::ASCIIToUTF16("one")); |
| 86 model.AddItem(2, ASCIIToUTF16("two")); | 86 model.AddItem(2, base::ASCIIToUTF16("two")); |
| 87 | 87 |
| 88 EXPECT_CALL(delegate_, MenuModelForAccountChooser()) | 88 EXPECT_CALL(delegate_, MenuModelForAccountChooser()) |
| 89 .WillOnce(Return(&model)); | 89 .WillOnce(Return(&model)); |
| 90 [view_ update]; | 90 [view_ update]; |
| 91 | 91 |
| 92 MenuButton* button = nil; | 92 MenuButton* button = nil; |
| 93 for (id view in [view_ subviews]) { | 93 for (id view in [view_ subviews]) { |
| 94 if ([view isKindOfClass:[MenuButton class]]) { | 94 if ([view isKindOfClass:[MenuButton class]]) { |
| 95 button = view; | 95 button = view; |
| 96 break; | 96 break; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 NSArray* items = [[button attachedMenu] itemArray]; | 100 NSArray* items = [[button attachedMenu] itemArray]; |
| 101 EXPECT_EQ(3U, [items count]); | 101 EXPECT_EQ(3U, [items count]); |
| 102 EXPECT_NSEQ(@"", [[items objectAtIndex:0] title]); | 102 EXPECT_NSEQ(@"", [[items objectAtIndex:0] title]); |
| 103 EXPECT_NSEQ(@"one", [[items objectAtIndex:1] title]); | 103 EXPECT_NSEQ(@"one", [[items objectAtIndex:1] title]); |
| 104 EXPECT_NSEQ(@"two", [[items objectAtIndex:2] title]); | 104 EXPECT_NSEQ(@"two", [[items objectAtIndex:2] title]); |
| 105 } | 105 } |
| OLD | NEW |