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

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

Issue 948203002: Change autofill credit card suggestion text on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android tests? (trouble testing locally :() Created 5 years, 9 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
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
906 std::vector<FormData> forms(1, form); 906 std::vector<FormData> forms(1, form);
907 FormsSeen(forms); 907 FormsSeen(forms);
908 908
909 const FormFieldData& field = form.fields[0]; 909 const FormFieldData& field = form.fields[0];
910 GetAutofillSuggestions(form, field); 910 GetAutofillSuggestions(form, field);
911 911
912 // No suggestions provided, so send an empty vector as the results. 912 // No suggestions provided, so send an empty vector as the results.
913 // This triggers the combined message send. 913 // This triggers the combined message send.
914 AutocompleteSuggestionsReturned(std::vector<base::string16>()); 914 AutocompleteSuggestionsReturned(std::vector<base::string16>());
915 915
916 #if defined(OS_ANDROID)
917 static const char* kVisaSuggestion = "Visa - 3456";
918 static const char* kMcSuggestion = "MasterCard - 8765";
919 #else
920 static const char* kVisaSuggestion = "*3456";
921 static const char* kMcSuggestion = "*8765";
922 #endif
923
916 // Test that we sent the right values to the external delegate. 924 // Test that we sent the right values to the external delegate.
917 external_delegate_->CheckSuggestions( 925 external_delegate_->CheckSuggestions(
918 kDefaultPageID, 926 kDefaultPageID,
919 Suggestion("Elvis Presley", "*3456", kVisaCard, 927 Suggestion("Elvis Presley", kVisaSuggestion, kVisaCard,
920 autofill_manager_->GetPackedCreditCardID(4)), 928 autofill_manager_->GetPackedCreditCardID(4)),
921 Suggestion("Buddy Holly", "*8765", kMasterCard, 929 Suggestion("Buddy Holly", kMcSuggestion, kMasterCard,
922 autofill_manager_->GetPackedCreditCardID(5))); 930 autofill_manager_->GetPackedCreditCardID(5)));
923 } 931 }
924 932
925 // Test that we return a warning explaining that credit card profile suggestions 933 // Test that we return a warning explaining that credit card profile suggestions
926 // are unavailable when the form is not https. 934 // are unavailable when the form is not https.
927 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsNonHTTPS) { 935 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsNonHTTPS) {
928 // Set up our form data. 936 // Set up our form data.
929 FormData form; 937 FormData form;
930 CreateTestCreditCardFormData(&form, false, false); 938 CreateTestCreditCardFormData(&form, false, false);
931 std::vector<FormData> forms(1, form); 939 std::vector<FormData> forms(1, form);
(...skipping 2015 matching lines...) Expand 10 before | Expand all | Expand 10 after
2947 // results. This triggers the combined message send. 2955 // results. This triggers the combined message send.
2948 AutocompleteSuggestionsReturned(std::vector<base::string16>()); 2956 AutocompleteSuggestionsReturned(std::vector<base::string16>());
2949 2957
2950 external_delegate_->CheckSuggestions( 2958 external_delegate_->CheckSuggestions(
2951 kDefaultPageID, 2959 kDefaultPageID,
2952 Suggestion("Visa - 3456", "04/12", kVisaCard, 2960 Suggestion("Visa - 3456", "04/12", kVisaCard,
2953 autofill_manager_->GetPackedCreditCardID(4))); 2961 autofill_manager_->GetPackedCreditCardID(4)));
2954 } 2962 }
2955 2963
2956 } // namespace autofill 2964 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698