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

Side by Side Diff: chrome/browser/ui/cocoa/autofill/autofill_section_container_unittest.mm

Issue 17593006: mac: Update clients of scoped_nsobject.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: iwyu, scoped_nsprotocol Created 7 years, 6 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 (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_section_container.h" 5 #import "chrome/browser/ui/cocoa/autofill/autofill_section_container.h"
6 6
7 #include "base/mac/foundation_util.h" 7 #include "base/mac/foundation_util.h"
8 #include "base/memory/scoped_nsobject.h" 8 #include "base/mac/scoped_nsobject.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
11 #include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h" 11 #include "chrome/browser/ui/autofill/mock_autofill_dialog_controller.h"
12 #import "chrome/browser/ui/cocoa/autofill/layout_view.h" 12 #import "chrome/browser/ui/cocoa/autofill/layout_view.h"
13 #import "chrome/browser/ui/cocoa/menu_button.h" 13 #import "chrome/browser/ui/cocoa/menu_button.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "testing/gtest/include/gtest/gtest.h"
15 #include "testing/gtest_mac.h" 16 #include "testing/gtest_mac.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "testing/platform_test.h" 17 #include "testing/platform_test.h"
18 #include "ui/base/models/combobox_model.h" 18 #include "ui/base/models/combobox_model.h"
19 #include "ui/base/models/simple_menu_model.h" 19 #include "ui/base/models/simple_menu_model.h"
20 #import "ui/base/test/ui_cocoa_test_helper.h" 20 #import "ui/base/test/ui_cocoa_test_helper.h"
21 21
22 namespace { 22 namespace {
23 23
24 class AutofillSectionContainerTest : public ui::CocoaTest { 24 class AutofillSectionContainerTest : public ui::CocoaTest {
25 public: 25 public:
26 virtual void SetUp() { 26 virtual void SetUp() {
27 CocoaTest::SetUp(); 27 CocoaTest::SetUp();
28 container_.reset( 28 container_.reset(
29 [[AutofillSectionContainer alloc] 29 [[AutofillSectionContainer alloc]
30 initWithController:&controller_ 30 initWithController:&controller_
31 forSection:autofill::SECTION_CC]); 31 forSection:autofill::SECTION_CC]);
32 [[test_window() contentView] addSubview:[container_ view]]; 32 [[test_window() contentView] addSubview:[container_ view]];
33 } 33 }
34 34
35 void ResetContainer() { 35 void ResetContainer() {
36 container_.reset( 36 container_.reset(
37 [[AutofillSectionContainer alloc] 37 [[AutofillSectionContainer alloc]
38 initWithController:&controller_ 38 initWithController:&controller_
39 forSection:autofill::SECTION_CC]); 39 forSection:autofill::SECTION_CC]);
40 [[test_window() contentView] setSubviews:@[ [container_ view] ]]; 40 [[test_window() contentView] setSubviews:@[ [container_ view] ]];
41 } 41 }
42 42
43 protected: 43 protected:
44 scoped_nsobject<AutofillSectionContainer> container_; 44 base::scoped_nsobject<AutofillSectionContainer> container_;
45 testing::NiceMock<autofill::MockAutofillDialogController> controller_; 45 testing::NiceMock<autofill::MockAutofillDialogController> controller_;
46 }; 46 };
47 47
48 } // namespace 48 } // namespace
49 49
50 TEST_VIEW(AutofillSectionContainerTest, [container_ view]) 50 TEST_VIEW(AutofillSectionContainerTest, [container_ view])
51 51
52 TEST_F(AutofillSectionContainerTest, HasSubviews) { 52 TEST_F(AutofillSectionContainerTest, HasSubviews) {
53 bool hasLayoutView = false; 53 bool hasLayoutView = false;
54 bool hasTextField = false; 54 bool hasTextField = false;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 break; 156 break;
157 } 157 }
158 } 158 }
159 159
160 NSMenu* menu = [button attachedMenu]; 160 NSMenu* menu = [button attachedMenu];
161 // Expect _three_ items - popup menus need an empty first item. 161 // Expect _three_ items - popup menus need an empty first item.
162 ASSERT_EQ(3, [menu numberOfItems]); 162 ASSERT_EQ(3, [menu numberOfItems]);
163 163
164 EXPECT_NSEQ(@"a", [[menu itemAtIndex:1] title]); 164 EXPECT_NSEQ(@"a", [[menu itemAtIndex:1] title]);
165 EXPECT_NSEQ(@"b", [[menu itemAtIndex:2] title]); 165 EXPECT_NSEQ(@"b", [[menu itemAtIndex:2] title]);
166 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698