Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 512933004: mac: Don't show "Access Address Book" prompt if Autofill is disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments from estade (remove mock function). Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #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/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 int id = PackGUIDs(empty, guid_pair); 2773 int id = PackGUIDs(empty, guid_pair);
2774 2774
2775 autofill_manager_->RemoveAutofillProfileOrCreditCard(id); 2775 autofill_manager_->RemoveAutofillProfileOrCreditCard(id);
2776 2776
2777 // TODO(csharp): Currently variants should not be deleted, but once they are 2777 // TODO(csharp): Currently variants should not be deleted, but once they are
2778 // update these expectations. 2778 // update these expectations.
2779 // http://crbug.com/124211 2779 // http://crbug.com/124211
2780 EXPECT_TRUE(autofill_manager_->GetProfileWithGUID(guid.c_str())); 2780 EXPECT_TRUE(autofill_manager_->GetProfileWithGUID(guid.c_str()));
2781 } 2781 }
2782 2782
2783 #if defined(OS_MACOSX) && !defined(OS_IOS)
2784 TEST_F(AutofillManagerTest, AccessAddressBookPrompt) {
2785 FormData form;
2786 test::CreateTestAddressFormData(&form);
2787 std::vector<FormData> forms(1, form);
2788 FormsSeen(forms);
2789 FormFieldData& field = form.fields[0];
2790
2791 field.should_autocomplete = false;
2792 EXPECT_FALSE(
2793 autofill_manager_->ShouldShowAccessAddressBookSuggestion(form, field));
2794
2795 field.should_autocomplete = true;
2796 EXPECT_TRUE(
2797 autofill_manager_->ShouldShowAccessAddressBookSuggestion(form, field));
2798 }
2799 #endif // defined(OS_MACOSX) && !defined(OS_IOS)
2800
2783 namespace { 2801 namespace {
2784 2802
2785 class MockAutofillClient : public TestAutofillClient { 2803 class MockAutofillClient : public TestAutofillClient {
2786 public: 2804 public:
2787 MockAutofillClient() {} 2805 MockAutofillClient() {}
2788 2806
2789 virtual ~MockAutofillClient() {} 2807 virtual ~MockAutofillClient() {}
2790 2808
2791 virtual void ShowRequestAutocompleteDialog( 2809 virtual void ShowRequestAutocompleteDialog(
2792 const FormData& form, 2810 const FormData& form,
(...skipping 23 matching lines...) Expand all
2816 test::CreateTestAddressFormData(&form); 2834 test::CreateTestAddressFormData(&form);
2817 std::vector<FormData> forms(1, form); 2835 std::vector<FormData> forms(1, form);
2818 FormsSeen(forms); 2836 FormsSeen(forms);
2819 const FormFieldData& field = form.fields[0]; 2837 const FormFieldData& field = form.fields[0];
2820 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2838 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2821 2839
2822 EXPECT_TRUE(external_delegate_->on_query_seen()); 2840 EXPECT_TRUE(external_delegate_->on_query_seen());
2823 } 2841 }
2824 2842
2825 } // namespace autofill 2843 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698