| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 2605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2616 | 2616 |
| 2617 // Simulate form submission. We should not call into the PDM to try to save | 2617 // Simulate form submission. We should not call into the PDM to try to save |
| 2618 // the filled data, since the filled form is effectively missing an address. | 2618 // the filled data, since the filled form is effectively missing an address. |
| 2619 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); | 2619 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); |
| 2620 FormSubmitted(results); | 2620 FormSubmitted(results); |
| 2621 } | 2621 } |
| 2622 | 2622 |
| 2623 // Checks that resetting the auxiliary profile enabled preference does the right | 2623 // Checks that resetting the auxiliary profile enabled preference does the right |
| 2624 // thing on all platforms. | 2624 // thing on all platforms. |
| 2625 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { | 2625 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { |
| 2626 PrefServiceBase* prefs = PrefServiceBase::ForContext(profile()); | 2626 PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(profile()); |
| 2627 #if defined(OS_MACOSX) | 2627 #if defined(OS_MACOSX) |
| 2628 // Auxiliary profiles is implemented on Mac only. It enables Mac Address | 2628 // Auxiliary profiles is implemented on Mac only. It enables Mac Address |
| 2629 // Book integration. | 2629 // Book integration. |
| 2630 ASSERT_TRUE(prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled)); | 2630 ASSERT_TRUE(prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled)); |
| 2631 prefs->SetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled, false); | 2631 prefs->SetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled, false); |
| 2632 prefs->ClearPref(prefs::kAutofillAuxiliaryProfilesEnabled); | 2632 prefs->ClearPref(prefs::kAutofillAuxiliaryProfilesEnabled); |
| 2633 ASSERT_TRUE(prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled)); | 2633 ASSERT_TRUE(prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled)); |
| 2634 #else | 2634 #else |
| 2635 ASSERT_FALSE(prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled)); | 2635 ASSERT_FALSE(prefs->GetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled)); |
| 2636 prefs->SetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled, true); | 2636 prefs->SetBoolean(prefs::kAutofillAuxiliaryProfilesEnabled, true); |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2912 types.clear(); | 2912 types.clear(); |
| 2913 types.insert(UNKNOWN_TYPE); | 2913 types.insert(UNKNOWN_TYPE); |
| 2914 form.fields.push_back(field); | 2914 form.fields.push_back(field); |
| 2915 expected_types.push_back(types); | 2915 expected_types.push_back(types); |
| 2916 | 2916 |
| 2917 autofill_manager_->set_expected_submitted_field_types(expected_types); | 2917 autofill_manager_->set_expected_submitted_field_types(expected_types); |
| 2918 FormSubmitted(form); | 2918 FormSubmitted(form); |
| 2919 } | 2919 } |
| 2920 | 2920 |
| 2921 TEST_F(AutofillManagerTest, UpdatePasswordSyncState) { | 2921 TEST_F(AutofillManagerTest, UpdatePasswordSyncState) { |
| 2922 PrefServiceBase* prefs = PrefServiceBase::ForContext(profile()); | 2922 PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(profile()); |
| 2923 | 2923 |
| 2924 // Allow this test to control what should get synced. | 2924 // Allow this test to control what should get synced. |
| 2925 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); | 2925 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); |
| 2926 // Always set password generation enabled check box so we can test the | 2926 // Always set password generation enabled check box so we can test the |
| 2927 // behavior of password sync. | 2927 // behavior of password sync. |
| 2928 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true); | 2928 prefs->SetBoolean(prefs::kPasswordGenerationEnabled, true); |
| 2929 | 2929 |
| 2930 // Sync some things, but not passwords. Shouldn't send anything since | 2930 // Sync some things, but not passwords. Shouldn't send anything since |
| 2931 // password generation is disabled by default. | 2931 // password generation is disabled by default. |
| 2932 ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile( | 2932 ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 | 2970 |
| 2971 // When a new render_view is created, we send the state even if it's the | 2971 // When a new render_view is created, we send the state even if it's the |
| 2972 // same. | 2972 // same. |
| 2973 UpdatePasswordGenerationState(true); | 2973 UpdatePasswordGenerationState(true); |
| 2974 EXPECT_EQ(1u, autofill_manager_->GetSentStates().size()); | 2974 EXPECT_EQ(1u, autofill_manager_->GetSentStates().size()); |
| 2975 EXPECT_FALSE(autofill_manager_->GetSentStates()[0]); | 2975 EXPECT_FALSE(autofill_manager_->GetSentStates()[0]); |
| 2976 autofill_manager_->ClearSentStates(); | 2976 autofill_manager_->ClearSentStates(); |
| 2977 } | 2977 } |
| 2978 | 2978 |
| 2979 TEST_F(AutofillManagerTest, UpdatePasswordGenerationState) { | 2979 TEST_F(AutofillManagerTest, UpdatePasswordGenerationState) { |
| 2980 PrefServiceBase* prefs = PrefServiceBase::ForContext(profile()); | 2980 PrefServiceBase* prefs = PrefServiceBase::FromBrowserContext(profile()); |
| 2981 | 2981 |
| 2982 // Always set password sync enabled so we can test the behavior of password | 2982 // Always set password sync enabled so we can test the behavior of password |
| 2983 // generation. | 2983 // generation. |
| 2984 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); | 2984 prefs->SetBoolean(prefs::kSyncKeepEverythingSynced, false); |
| 2985 ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile( | 2985 ProfileSyncService* sync_service = ProfileSyncServiceFactory::GetForProfile( |
| 2986 profile()); | 2986 profile()); |
| 2987 sync_service->SetSyncSetupCompleted(); | 2987 sync_service->SetSyncSetupCompleted(); |
| 2988 syncer::ModelTypeSet preferred_set; | 2988 syncer::ModelTypeSet preferred_set; |
| 2989 preferred_set.Put(syncer::PASSWORDS); | 2989 preferred_set.Put(syncer::PASSWORDS); |
| 2990 sync_service->ChangePreferredDataTypes(preferred_set); | 2990 sync_service->ChangePreferredDataTypes(preferred_set); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3132 | 3132 |
| 3133 AutofillManager* autofill_manager = tab_contents()->autofill_manager(); | 3133 AutofillManager* autofill_manager = tab_contents()->autofill_manager(); |
| 3134 EXPECT_TRUE(autofill_manager->external_delegate()); | 3134 EXPECT_TRUE(autofill_manager->external_delegate()); |
| 3135 | 3135 |
| 3136 AutocompleteHistoryManager* autocomplete_history_manager = | 3136 AutocompleteHistoryManager* autocomplete_history_manager = |
| 3137 tab_contents()->autocomplete_history_manager(); | 3137 tab_contents()->autocomplete_history_manager(); |
| 3138 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); | 3138 EXPECT_TRUE(autocomplete_history_manager->external_delegate()); |
| 3139 } | 3139 } |
| 3140 | 3140 |
| 3141 #endif // OS_ANDROID | 3141 #endif // OS_ANDROID |
| OLD | NEW |