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_main_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_main_container.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" | 8 #include "chrome/browser/ui/autofill/mock_autofill_dialog_view_delegate.h" |
9 #import "chrome/browser/ui/cocoa/autofill/autofill_section_view.h" | 9 #import "chrome/browser/ui/cocoa/autofill/autofill_section_view.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 bool hasCheckbox = false; | 43 bool hasCheckbox = false; |
44 bool hasCheckboxTooltip = false; | 44 bool hasCheckboxTooltip = false; |
45 bool hasNotificationContainer = false; | 45 bool hasNotificationContainer = false; |
46 | 46 |
47 // Should have account chooser, button strip, and details section. | 47 // Should have account chooser, button strip, and details section. |
48 EXPECT_EQ(7U, [[[container_ view] subviews] count]); | 48 EXPECT_EQ(7U, [[[container_ view] subviews] count]); |
49 for (NSView* view in [[container_ view] subviews]) { | 49 for (NSView* view in [[container_ view] subviews]) { |
50 NSArray* subviews = [view subviews]; | 50 NSArray* subviews = [view subviews]; |
51 if ([view isKindOfClass:[NSScrollView class]]) { | 51 if ([view isKindOfClass:[NSScrollView class]]) { |
52 hasDetailsContainer = true; | 52 hasDetailsContainer = true; |
| 53 } else if (view == [container_ saveInChromeTooltipForTesting]) { |
| 54 hasCheckboxTooltip = true; |
53 } else if ([subviews count] == 2) { | 55 } else if ([subviews count] == 2) { |
54 EXPECT_TRUE( | 56 EXPECT_TRUE( |
55 [[subviews objectAtIndex:0] isKindOfClass:[NSButton class]]); | 57 [[subviews objectAtIndex:0] isKindOfClass:[NSButton class]]); |
56 EXPECT_TRUE( | 58 EXPECT_TRUE( |
57 [[subviews objectAtIndex:1] isKindOfClass:[NSButton class]]); | 59 [[subviews objectAtIndex:1] isKindOfClass:[NSButton class]]); |
58 hasButtons = true; | 60 hasButtons = true; |
59 } else if ([view isKindOfClass:[NSImageView class]]) { | 61 } else if ([view isKindOfClass:[NSImageView class]]) { |
60 if (view == [container_ buttonStripImageForTesting]) | 62 if (view == [container_ buttonStripImageForTesting]) |
61 hasButtonStripImage = true; | 63 hasButtonStripImage = true; |
62 else if (view == [container_ saveInChromeTooltipForTesting]) | |
63 hasCheckboxTooltip = true; | |
64 else | 64 else |
65 EXPECT_TRUE(false); // Unknown image view; should not be reachable. | 65 EXPECT_TRUE(false); // Unknown image view; should not be reachable. |
66 } else if ([view isKindOfClass:[NSTextView class]]) { | 66 } else if ([view isKindOfClass:[NSTextView class]]) { |
67 hasTextView = true; | 67 hasTextView = true; |
68 } else if ([view isKindOfClass:[NSButton class]] && | 68 } else if ([view isKindOfClass:[NSButton class]] && |
69 view == [container_ saveInChromeCheckboxForTesting]) { | 69 view == [container_ saveInChromeCheckboxForTesting]) { |
70 hasCheckbox = true; | 70 hasCheckbox = true; |
71 } else { | 71 } else { |
72 // Assume by default this is the notification area view. | 72 // Assume by default this is the notification area view. |
73 // There is no way to easily verify that with more detail. | 73 // There is no way to easily verify that with more detail. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 NSImageView* tooltip = [container_ saveInChromeTooltipForTesting]; | 114 NSImageView* tooltip = [container_ saveInChromeTooltipForTesting]; |
115 ASSERT_TRUE(checkbox); | 115 ASSERT_TRUE(checkbox); |
116 ASSERT_TRUE(tooltip); | 116 ASSERT_TRUE(tooltip); |
117 | 117 |
118 EXPECT_TRUE([checkbox isHidden]); | 118 EXPECT_TRUE([checkbox isHidden]); |
119 EXPECT_TRUE([tooltip isHidden]); | 119 EXPECT_TRUE([tooltip isHidden]); |
120 [container_ modelChanged]; | 120 [container_ modelChanged]; |
121 EXPECT_FALSE([checkbox isHidden]); | 121 EXPECT_FALSE([checkbox isHidden]); |
122 EXPECT_FALSE([tooltip isHidden]); | 122 EXPECT_FALSE([tooltip isHidden]); |
123 } | 123 } |
OLD | NEW |