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_controller.h" | 10 #include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h" |
11 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" | 11 #import "chrome/browser/ui/cocoa/hyperlink_button_cell.h" |
12 #import "chrome/browser/ui/cocoa/menu_button.h" | 12 #import "chrome/browser/ui/cocoa/menu_button.h" |
13 #include "testing/gtest_mac.h" | 13 #include "testing/gtest_mac.h" |
14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
15 #include "ui/base/models/simple_menu_model.h" | 15 #include "ui/base/models/simple_menu_model.h" |
16 #import "ui/base/test/ui_cocoa_test_helper.h" | 16 #import "ui/base/test/ui_cocoa_test_helper.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 class AutofillAccountChooserTest : public ui::CocoaTest { | 20 class AutofillAccountChooserTest : public ui::CocoaTest { |
21 public: | 21 public: |
22 AutofillAccountChooserTest() { | 22 AutofillAccountChooserTest() { |
23 NSRect frame = NSMakeRect(0, 0, 500, 200); | 23 NSRect frame = NSMakeRect(0, 0, 500, 200); |
24 view_.reset([[AutofillAccountChooser alloc] initWithFrame:frame | 24 view_.reset([[AutofillAccountChooser alloc] initWithFrame:frame |
25 controller:&controller_]); | 25 controller:&controller_]); |
26 [[test_window() contentView] addSubview:view_]; | 26 [[test_window() contentView] addSubview:view_]; |
27 } | 27 } |
28 | 28 |
29 protected: | 29 protected: |
30 scoped_nsobject<AutofillAccountChooser> view_; | 30 base::scoped_nsobject<AutofillAccountChooser> view_; |
31 testing::NiceMock<autofill::MockAutofillDialogController> controller_; | 31 testing::NiceMock<autofill::MockAutofillDialogController> controller_; |
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 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { |
40 return false; | 40 return false; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |