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

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

Issue 15645004: [rAC] Allow sub-views to trigger layout reflow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review issues. 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/memory/scoped_nsobject.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 10 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 protected: 43 protected:
44 scoped_nsobject<AutofillSectionContainer> container_; 44 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 ASSERT_EQ(2U, [[[container_ view] subviews] count]);
54
55 bool hasLayoutView = false; 53 bool hasLayoutView = false;
56 bool hasTextField = false; 54 bool hasTextField = false;
57 bool hasSuggestButton = false; 55 bool hasSuggestButton = false;
58 56
59 NSView* sectionView = nil; 57 ASSERT_EQ(3U, [[[container_ view] subviews] count]);
60 for (NSView* view in [[container_ view] subviews]) { 58 for (NSView* view in [[container_ view] subviews]) {
61 if ([view isKindOfClass:[MenuButton class]])
62 hasSuggestButton = true;
63 else
64 sectionView = view;
65 }
66
67 ASSERT_EQ(2U, [[sectionView subviews] count]);
68 for (NSView* view in [sectionView subviews]) {
69 if ([view isKindOfClass:[NSTextField class]]) { 59 if ([view isKindOfClass:[NSTextField class]]) {
70 hasTextField = true; 60 hasTextField = true;
71 } else if ([view isKindOfClass:[LayoutView class]]) { 61 } else if ([view isKindOfClass:[LayoutView class]]) {
72 hasLayoutView = true; 62 hasLayoutView = true;
63 } else if ([view isKindOfClass:[MenuButton class]]) {
64 hasSuggestButton = true;
73 } 65 }
74 } 66 }
75 67
76 EXPECT_TRUE(hasSuggestButton); 68 EXPECT_TRUE(hasSuggestButton);
77 EXPECT_TRUE(hasLayoutView); 69 EXPECT_TRUE(hasLayoutView);
78 EXPECT_TRUE(hasTextField); 70 EXPECT_TRUE(hasTextField);
79 } 71 }
80 72
81 TEST_F(AutofillSectionContainerTest, ModelsPopulateComboboxes) { 73 TEST_F(AutofillSectionContainerTest, ModelsPopulateComboboxes) {
82 using namespace autofill; 74 using namespace autofill;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 153 }
162 } 154 }
163 155
164 NSMenu* menu = [button attachedMenu]; 156 NSMenu* menu = [button attachedMenu];
165 // Expect _three_ items - popup menus need an empty first item. 157 // Expect _three_ items - popup menus need an empty first item.
166 ASSERT_EQ(3, [menu numberOfItems]); 158 ASSERT_EQ(3, [menu numberOfItems]);
167 159
168 EXPECT_NSEQ(@"a", [[menu itemAtIndex:1] title]); 160 EXPECT_NSEQ(@"a", [[menu itemAtIndex:1] title]);
169 EXPECT_NSEQ(@"b", [[menu itemAtIndex:2] title]); 161 EXPECT_NSEQ(@"b", [[menu itemAtIndex:2] title]);
170 } 162 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/autofill_section_container.mm ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698