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

Side by Side Diff: chrome/browser/autofill/form_structure_unittest.cc

Issue 11953100: Add url prefix to AutofillQuery requests when autocheckout enabled, and set accepts="a" (autochecko… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pass accepts="a,e" and urlprefixsignature down to autofillserv. Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/autofill/form_structure.h" 5 #include "chrome/browser/autofill/form_structure.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/autofill/autofill_metrics.h" 10 #include "chrome/browser/autofill/autofill_metrics.h"
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 1567
1568 // Check that we fail if there are only bad form(s). 1568 // Check that we fail if there are only bad form(s).
1569 ScopedVector<FormStructure> bad_forms; 1569 ScopedVector<FormStructure> bad_forms;
1570 bad_forms.push_back(new FormStructure(malformed_form, std::string())); 1570 bad_forms.push_back(new FormStructure(malformed_form, std::string()));
1571 EXPECT_FALSE(FormStructure::EncodeQueryRequest(bad_forms.get(), 1571 EXPECT_FALSE(FormStructure::EncodeQueryRequest(bad_forms.get(),
1572 &encoded_signatures, 1572 &encoded_signatures,
1573 &encoded_xml)); 1573 &encoded_xml));
1574 EXPECT_EQ(0U, encoded_signatures.size()); 1574 EXPECT_EQ(0U, encoded_signatures.size());
1575 EXPECT_EQ("", encoded_xml); 1575 EXPECT_EQ("", encoded_xml);
1576 1576
1577 // Check the behaviour with kEnableExperimentalFormFilling switch on. 1577 // Check the behaviour with autocheckout enabled.
1578 // Add the previous form but with flag set.
1579 ScopedVector<FormStructure> checkable_forms; 1578 ScopedVector<FormStructure> checkable_forms;
1580 checkable_forms.push_back( 1579 checkable_forms.push_back(
1581 new FormStructure(form, "https://www.abc.com/checkout")); 1580 new FormStructure(form, "https://www.sample1.com/query/path"));
1582 1581
1583 ASSERT_TRUE(FormStructure::EncodeQueryRequest(checkable_forms.get(), 1582 ASSERT_TRUE(FormStructure::EncodeQueryRequest(checkable_forms.get(),
1584 &encoded_signatures, 1583 &encoded_signatures,
1585 &encoded_xml)); 1584 &encoded_xml));
1586 const char * const kSignature3 = "7747357776717901584"; 1585 const char * const kSignature3 = "7747357776717901584";
1587 const char * const kResponse3 = 1586 const char * const kResponse3 =
1588 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><autofillquery " 1587 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><autofillquery "
1589 "clientversion=\"6.1.1715.1442/en (GGLL)\" accepts=\"e\">" 1588 "clientversion=\"6.1.1715.1442/en (GGLL)\" accepts=\"a,e\" "
1590 "<form signature=\"7747357776717901584\"><field signature=\"412125936\"/>" 1589 "urlprefixsignature=\"7648393911063090788\">"
1590 "<form signature=\"7747357776717901584\">"
1591 "<field signature=\"412125936\"/>"
1591 "<field signature=\"1917667676\"/><field signature=\"2226358947\"/><field" 1592 "<field signature=\"1917667676\"/><field signature=\"2226358947\"/><field"
1592 " signature=\"747221617\"/><field signature=\"4108155786\"/><field " 1593 " signature=\"747221617\"/><field signature=\"4108155786\"/><field "
1593 "signature=\"3410250678\"/><field signature=\"509334676\"/><field " 1594 "signature=\"3410250678\"/><field signature=\"509334676\"/><field "
1594 "signature=\"509334676\"/><field signature=\"509334676\"/><field " 1595 "signature=\"509334676\"/><field signature=\"509334676\"/><field "
1595 "signature=\"509334676\"/><field signature=\"509334676\"/></form>" 1596 "signature=\"509334676\"/><field signature=\"509334676\"/></form>"
1596 "</autofillquery>"; 1597 "</autofillquery>";
1597 ASSERT_EQ(1U, encoded_signatures.size()); 1598 ASSERT_EQ(1U, encoded_signatures.size());
1598 EXPECT_EQ(kSignature3, encoded_signatures[0]); 1599 EXPECT_EQ(kSignature3, encoded_signatures[0]);
1599 EXPECT_EQ(kResponse3, encoded_xml); 1600 EXPECT_EQ(kResponse3, encoded_xml);
1600 } 1601 }
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2182 field.form_control_type = "submit"; 2183 field.form_control_type = "submit";
2183 form.fields.push_back(field); 2184 form.fields.push_back(field);
2184 2185
2185 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData()); 2186 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData());
2186 2187
2187 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always 2188 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always
2188 // false. This forces a future author that changes this to update this test. 2189 // false. This forces a future author that changes this to update this test.
2189 form.user_submitted = true; 2190 form.user_submitted = true;
2190 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData()); 2191 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData());
2191 } 2192 }
OLDNEW
« chrome/browser/autofill/form_structure.cc ('K') | « chrome/browser/autofill/form_structure.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698