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 18 matching lines...) Expand all Loading... |
29 protected: | 29 protected: |
30 base::scoped_nsobject<AutofillAccountChooser> view_; | 30 base::scoped_nsobject<AutofillAccountChooser> view_; |
31 testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_; | 31 testing::NiceMock<autofill::MockAutofillDialogViewDelegate> delegate_; |
32 | 32 |
33 private: | 33 private: |
34 DISALLOW_COPY_AND_ASSIGN(AutofillAccountChooserTest); | 34 DISALLOW_COPY_AND_ASSIGN(AutofillAccountChooserTest); |
35 }; | 35 }; |
36 | 36 |
37 class MenuDelegate : public ui::SimpleMenuModel::Delegate { | 37 class MenuDelegate : public ui::SimpleMenuModel::Delegate { |
38 public: | 38 public: |
39 virtual bool IsCommandIdChecked(int command_id) const override { | 39 bool IsCommandIdChecked(int command_id) const override { return false; } |
| 40 |
| 41 bool IsCommandIdEnabled(int command_id) const override { return true; } |
| 42 |
| 43 bool GetAcceleratorForCommandId(int command_id, |
| 44 ui::Accelerator* accelerator) override { |
40 return false; | 45 return false; |
41 } | 46 } |
42 | 47 |
43 virtual bool IsCommandIdEnabled(int command_id) const override { | 48 void ExecuteCommand(int command_id, int event_flags) override {} |
44 return true; | |
45 } | |
46 | |
47 virtual bool GetAcceleratorForCommandId( | |
48 int command_id, | |
49 ui::Accelerator* accelerator) override { return false; } | |
50 | |
51 virtual void ExecuteCommand(int command_id, int event_flags) override {} | |
52 }; | 49 }; |
53 | 50 |
54 } // namespace | 51 } // namespace |
55 | 52 |
56 TEST_VIEW(AutofillAccountChooserTest, view_); | 53 TEST_VIEW(AutofillAccountChooserTest, view_); |
57 | 54 |
58 // Make sure account chooser has all required subviews | 55 // Make sure account chooser has all required subviews |
59 TEST_F(AutofillAccountChooserTest, SubViews) { | 56 TEST_F(AutofillAccountChooserTest, SubViews) { |
60 bool hasIcon = false; | 57 bool hasIcon = false; |
61 bool hasLink = false; | 58 bool hasLink = false; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 break; | 93 break; |
97 } | 94 } |
98 } | 95 } |
99 | 96 |
100 NSArray* items = [[button attachedMenu] itemArray]; | 97 NSArray* items = [[button attachedMenu] itemArray]; |
101 EXPECT_EQ(3U, [items count]); | 98 EXPECT_EQ(3U, [items count]); |
102 EXPECT_NSEQ(@"", [[items objectAtIndex:0] title]); | 99 EXPECT_NSEQ(@"", [[items objectAtIndex:0] title]); |
103 EXPECT_NSEQ(@"one", [[items objectAtIndex:1] title]); | 100 EXPECT_NSEQ(@"one", [[items objectAtIndex:1] title]); |
104 EXPECT_NSEQ(@"two", [[items objectAtIndex:2] title]); | 101 EXPECT_NSEQ(@"two", [[items objectAtIndex:2] title]); |
105 } | 102 } |
OLD | NEW |