| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_notification_container.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_notification_container.h" |
| 6 | 6 |
| 7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.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 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 TEST_F(AutofillNotificationContainerTest, Subviews) { | 34 TEST_F(AutofillNotificationContainerTest, Subviews) { |
| 35 // No subviews if there are no notifications. | 35 // No subviews if there are no notifications. |
| 36 EXPECT_EQ(0U, [[[container_ view] subviews] count]); | 36 EXPECT_EQ(0U, [[[container_ view] subviews] count]); |
| 37 | 37 |
| 38 // Single notification adds one subview. | 38 // Single notification adds one subview. |
| 39 std::vector<autofill::DialogNotification> notifications; | 39 std::vector<autofill::DialogNotification> notifications; |
| 40 notifications.push_back( | 40 notifications.push_back( |
| 41 autofill::DialogNotification( | 41 autofill::DialogNotification( |
| 42 autofill::DialogNotification::REQUIRED_ACTION, | 42 autofill::DialogNotification::REQUIRED_ACTION, |
| 43 ASCIIToUTF16("test"))); | 43 base::ASCIIToUTF16("test"))); |
| 44 ASSERT_FALSE(notifications[0].HasArrow()); | 44 ASSERT_FALSE(notifications[0].HasArrow()); |
| 45 [container_ setNotifications:notifications]; | 45 [container_ setNotifications:notifications]; |
| 46 | 46 |
| 47 EXPECT_EQ(1U, [[[container_ view] subviews] count]); | 47 EXPECT_EQ(1U, [[[container_ view] subviews] count]); |
| 48 | 48 |
| 49 // 2 notifications, one with arrow - 2 views. | 49 // 2 notifications, one with arrow - 2 views. |
| 50 notifications.push_back( | 50 notifications.push_back( |
| 51 autofill::DialogNotification( | 51 autofill::DialogNotification( |
| 52 autofill::DialogNotification::REQUIRED_ACTION, | 52 autofill::DialogNotification::REQUIRED_ACTION, |
| 53 ASCIIToUTF16("test"))); | 53 base::ASCIIToUTF16("test"))); |
| 54 ASSERT_FALSE(notifications[1].HasArrow()); | 54 ASSERT_FALSE(notifications[1].HasArrow()); |
| 55 [container_ setNotifications:notifications]; | 55 [container_ setNotifications:notifications]; |
| 56 | 56 |
| 57 EXPECT_EQ(2U, [[[container_ view] subviews] count]); | 57 EXPECT_EQ(2U, [[[container_ view] subviews] count]); |
| 58 | 58 |
| 59 // Just to exercise code path. | 59 // Just to exercise code path. |
| 60 [container_ performLayout]; | 60 [container_ performLayout]; |
| 61 } | 61 } |
| OLD | NEW |