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

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: sync to head 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
« no previous file with comments | « chrome/browser/autofill/form_structure.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1525 1525
1526 // Check that we fail if there are only bad form(s). 1526 // Check that we fail if there are only bad form(s).
1527 ScopedVector<FormStructure> bad_forms; 1527 ScopedVector<FormStructure> bad_forms;
1528 bad_forms.push_back(new FormStructure(malformed_form, std::string())); 1528 bad_forms.push_back(new FormStructure(malformed_form, std::string()));
1529 EXPECT_FALSE(FormStructure::EncodeQueryRequest(bad_forms.get(), 1529 EXPECT_FALSE(FormStructure::EncodeQueryRequest(bad_forms.get(),
1530 &encoded_signatures, 1530 &encoded_signatures,
1531 &encoded_xml)); 1531 &encoded_xml));
1532 EXPECT_EQ(0U, encoded_signatures.size()); 1532 EXPECT_EQ(0U, encoded_signatures.size());
1533 EXPECT_EQ("", encoded_xml); 1533 EXPECT_EQ("", encoded_xml);
1534 1534
1535 // Check the behaviour with kEnableExperimentalFormFilling switch on. 1535 // Check the behaviour with autocheckout enabled.
1536 // Add the previous form but with flag set.
1537 ScopedVector<FormStructure> checkable_forms; 1536 ScopedVector<FormStructure> checkable_forms;
1538 checkable_forms.push_back( 1537 checkable_forms.push_back(
1539 new FormStructure(form, "https://www.abc.com/checkout")); 1538 new FormStructure(form, "https://www.sample1.com/query/path"));
1540 1539
1541 ASSERT_TRUE(FormStructure::EncodeQueryRequest(checkable_forms.get(), 1540 ASSERT_TRUE(FormStructure::EncodeQueryRequest(checkable_forms.get(),
1542 &encoded_signatures, 1541 &encoded_signatures,
1543 &encoded_xml)); 1542 &encoded_xml));
1544 const char * const kSignature3 = "7747357776717901584"; 1543 const char * const kSignature3 = "7747357776717901584";
1545 const char * const kResponse3 = 1544 const char * const kResponse3 =
1546 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><autofillquery " 1545 "<?xml version=\"1.0\" encoding=\"UTF-8\"?><autofillquery "
1547 "clientversion=\"6.1.1715.1442/en (GGLL)\" accepts=\"e\">" 1546 "clientversion=\"6.1.1715.1442/en (GGLL)\" accepts=\"a,e\" "
1548 "<form signature=\"7747357776717901584\"><field signature=\"412125936\"/>" 1547 "urlprefixsignature=\"7648393911063090788\">"
1548 "<form signature=\"7747357776717901584\">"
1549 "<field signature=\"412125936\"/>"
1549 "<field signature=\"1917667676\"/><field signature=\"2226358947\"/><field" 1550 "<field signature=\"1917667676\"/><field signature=\"2226358947\"/><field"
1550 " signature=\"747221617\"/><field signature=\"4108155786\"/><field " 1551 " signature=\"747221617\"/><field signature=\"4108155786\"/><field "
1551 "signature=\"3410250678\"/><field signature=\"509334676\"/><field " 1552 "signature=\"3410250678\"/><field signature=\"509334676\"/><field "
1552 "signature=\"509334676\"/><field signature=\"509334676\"/><field " 1553 "signature=\"509334676\"/><field signature=\"509334676\"/><field "
1553 "signature=\"509334676\"/><field signature=\"509334676\"/></form>" 1554 "signature=\"509334676\"/><field signature=\"509334676\"/></form>"
1554 "</autofillquery>"; 1555 "</autofillquery>";
1555 ASSERT_EQ(1U, encoded_signatures.size()); 1556 ASSERT_EQ(1U, encoded_signatures.size());
1556 EXPECT_EQ(kSignature3, encoded_signatures[0]); 1557 EXPECT_EQ(kSignature3, encoded_signatures[0]);
1557 EXPECT_EQ(kResponse3, encoded_xml); 1558 EXPECT_EQ(kResponse3, encoded_xml);
1558 } 1559 }
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2140 field.form_control_type = "submit"; 2141 field.form_control_type = "submit";
2141 form.fields.push_back(field); 2142 form.fields.push_back(field);
2142 2143
2143 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData()); 2144 EXPECT_EQ(form, FormStructure(form, std::string()).ToFormData());
2144 2145
2145 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always 2146 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always
2146 // false. This forces a future author that changes this to update this test. 2147 // false. This forces a future author that changes this to update this test.
2147 form.user_submitted = true; 2148 form.user_submitted = true;
2148 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData()); 2149 EXPECT_NE(form, FormStructure(form, std::string()).ToFormData());
2149 } 2150 }
OLDNEW
« no previous file with comments | « chrome/browser/autofill/form_structure.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698