| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "base/ref_counted.h" | 5 #include "base/ref_counted.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #import "chrome/browser/autofill/autofill_address_model_mac.h" | 8 #import "chrome/browser/autofill/autofill_address_model_mac.h" |
| 9 #import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h" | 9 #import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h" |
| 10 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" | 10 #import "chrome/browser/autofill/autofill_credit_card_model_mac.h" |
| 11 #import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h" | 11 #import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h" |
| 12 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h" | 12 #import "chrome/browser/autofill/autofill_dialog_controller_mac.h" |
| 13 #include "chrome/browser/autofill/autofill_profile.h" | 13 #include "chrome/browser/autofill/autofill_profile.h" |
| 14 #include "chrome/browser/autofill/personal_data_manager.h" | 14 #include "chrome/browser/autofill/personal_data_manager.h" |
| 15 #include "chrome/browser/prefs/pref_service.h" | 15 #include "chrome/browser/prefs/pref_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/ui/cocoa/browser_test_helper.h" | 17 #include "chrome/browser/ui/cocoa/browser_test_helper.h" |
| 18 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 18 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/test/testing_browser_process.h" |
| 20 #include "chrome/test/testing_pref_service.h" | 21 #include "chrome/test/testing_pref_service.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 // Simulated delay (in milliseconds) for web data loading. | 26 // Simulated delay (in milliseconds) for web data loading. |
| 26 const float kWebDataLoadDelayMilliseconds = 10.0; | 27 const float kWebDataLoadDelayMilliseconds = 10.0; |
| 27 | 28 |
| 28 // Mock PersonalDataManager that gives back canned profiles and credit cards | 29 // Mock PersonalDataManager that gives back canned profiles and credit cards |
| 29 // as well as simulating delayed loading of web data using the | 30 // as well as simulating delayed loading of web data using the |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 [controller_ runModelessDialog]; | 155 [controller_ runModelessDialog]; |
| 155 } | 156 } |
| 156 | 157 |
| 157 std::vector<AutoFillProfile*>& profiles() { | 158 std::vector<AutoFillProfile*>& profiles() { |
| 158 return helper_.test_profile_->test_manager_->test_profiles_; | 159 return helper_.test_profile_->test_manager_->test_profiles_; |
| 159 } | 160 } |
| 160 std::vector<CreditCard*>& credit_cards() { | 161 std::vector<CreditCard*>& credit_cards() { |
| 161 return helper_.test_profile_->test_manager_->test_credit_cards_; | 162 return helper_.test_profile_->test_manager_->test_credit_cards_; |
| 162 } | 163 } |
| 163 | 164 |
| 165 ScopedTestingBrowserProcess browser_process_; |
| 166 |
| 164 BrowserMock helper_; | 167 BrowserMock helper_; |
| 165 AutoFillDialogObserverMock observer_; | 168 AutoFillDialogObserverMock observer_; |
| 166 AutoFillDialogController* controller_; // weak reference | 169 AutoFillDialogController* controller_; // weak reference |
| 167 AutoFillProfile* imported_profile_; // weak reference | 170 AutoFillProfile* imported_profile_; // weak reference |
| 168 CreditCard* imported_credit_card_; // weak reference | 171 CreditCard* imported_credit_card_; // weak reference |
| 169 | 172 |
| 170 private: | 173 private: |
| 171 DISALLOW_COPY_AND_ASSIGN(AutoFillDialogControllerTest); | 174 DISALLOW_COPY_AND_ASSIGN(AutoFillDialogControllerTest); |
| 172 }; | 175 }; |
| 173 | 176 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 | 720 |
| 718 // Observer should not have been notified. | 721 // Observer should not have been notified. |
| 719 ASSERT_FALSE(observer_.hit_); | 722 ASSERT_FALSE(observer_.hit_); |
| 720 | 723 |
| 721 // Auxiliary profiles setting should have been saved. | 724 // Auxiliary profiles setting should have been saved. |
| 722 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean( | 725 ASSERT_TRUE(helper_.profile()->GetPrefs()->GetBoolean( |
| 723 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 726 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
| 724 } | 727 } |
| 725 | 728 |
| 726 } // namespace | 729 } // namespace |
| OLD | NEW |