| 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_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/mac/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_view_delegate.h" |
| 12 #import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h" | 12 #import "chrome/browser/ui/cocoa/autofill/autofill_input_field.h" |
| 13 #import "chrome/browser/ui/cocoa/autofill/layout_view.h" | 13 #import "chrome/browser/ui/cocoa/autofill/layout_view.h" |
| 14 #import "chrome/browser/ui/cocoa/menu_button.h" | 14 #import "chrome/browser/ui/cocoa/menu_button.h" |
| 15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "testing/gtest_mac.h" | 17 #include "testing/gtest_mac.h" |
| 18 #include "testing/platform_test.h" | 18 #include "testing/platform_test.h" |
| 19 #include "ui/base/models/combobox_model.h" | 19 #include "ui/base/models/combobox_model.h" |
| 20 #include "ui/base/models/simple_menu_model.h" | 20 #include "ui/base/models/simple_menu_model.h" |
| 21 #import "ui/base/test/ui_cocoa_test_helper.h" | 21 #import "ui/base/test/ui_cocoa_test_helper.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 33 void ResetContainer() { | 33 void ResetContainer() { |
| 34 container_.reset( | 34 container_.reset( |
| 35 [[AutofillSectionContainer alloc] | 35 [[AutofillSectionContainer alloc] |
| 36 initWithController:&controller_ | 36 initWithController:&controller_ |
| 37 forSection:section_]); | 37 forSection:section_]); |
| 38 [[test_window() contentView] setSubviews:@[ [container_ view] ]]; | 38 [[test_window() contentView] setSubviews:@[ [container_ view] ]]; |
| 39 } | 39 } |
| 40 | 40 |
| 41 protected: | 41 protected: |
| 42 base::scoped_nsobject<AutofillSectionContainer> container_; | 42 base::scoped_nsobject<AutofillSectionContainer> container_; |
| 43 testing::NiceMock<autofill::MockAutofillDialogController> controller_; | 43 testing::NiceMock<autofill::MockAutofillDialogViewDelegate> controller_; |
| 44 autofill::DialogSection section_; | 44 autofill::DialogSection section_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 TEST_VIEW(AutofillSectionContainerTest, [container_ view]) | 49 TEST_VIEW(AutofillSectionContainerTest, [container_ view]) |
| 50 | 50 |
| 51 TEST_F(AutofillSectionContainerTest, HasSubviews) { | 51 TEST_F(AutofillSectionContainerTest, HasSubviews) { |
| 52 bool hasLayoutView = false; | 52 bool hasLayoutView = false; |
| 53 bool hasTextField = false; | 53 bool hasTextField = false; |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 EXPECT_TRUE([field invalid]); | 229 EXPECT_TRUE([field invalid]); |
| 230 field = [container_ getField:CREDIT_CARD_EXP_MONTH]; | 230 field = [container_ getField:CREDIT_CARD_EXP_MONTH]; |
| 231 EXPECT_FALSE([field invalid]); | 231 EXPECT_FALSE([field invalid]); |
| 232 | 232 |
| 233 | 233 |
| 234 [container_ validateFor:VALIDATE_FINAL]; | 234 [container_ validateFor:VALIDATE_FINAL]; |
| 235 field = [container_ getField:EMAIL_ADDRESS]; | 235 field = [container_ getField:EMAIL_ADDRESS]; |
| 236 EXPECT_FALSE([field invalid]); | 236 EXPECT_FALSE([field invalid]); |
| 237 field = [container_ getField:CREDIT_CARD_EXP_MONTH]; | 237 field = [container_ getField:CREDIT_CARD_EXP_MONTH]; |
| 238 EXPECT_TRUE([field invalid]); | 238 EXPECT_TRUE([field invalid]); |
| 239 } | 239 } |
| OLD | NEW |