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

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

Issue 11348273: [autofill] Fill in values on a successful run of interactive autocomplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: isherman@ review Created 8 years 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 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 EXPECT_EQ(FormStructureTest::Hash64Bit( 2056 EXPECT_EQ(FormStructureTest::Hash64Bit(
2057 std::string("https://login.facebook.com&&email&first")), 2057 std::string("https://login.facebook.com&&email&first")),
2058 form_structure->FormSignature()); 2058 form_structure->FormSignature());
2059 2059
2060 form.name = ASCIIToUTF16("login_form"); 2060 form.name = ASCIIToUTF16("login_form");
2061 form_structure.reset(new FormStructure(form)); 2061 form_structure.reset(new FormStructure(form));
2062 EXPECT_EQ(FormStructureTest::Hash64Bit( 2062 EXPECT_EQ(FormStructureTest::Hash64Bit(
2063 std::string("https://login.facebook.com&login_form&email&first")), 2063 std::string("https://login.facebook.com&login_form&email&first")),
2064 form_structure->FormSignature()); 2064 form_structure->FormSignature());
2065 } 2065 }
2066
2067 TEST(FormStructureTest, ToFormData) {
2068 FormData form;
2069 form.name = ASCIIToUTF16("the-name");
2070 form.method = ASCIIToUTF16("POST");
2071 form.origin = GURL("http://cool.com");
2072 form.action = form.origin.Resolve("/login");
2073
2074 FormFieldData field;
2075 field.label = ASCIIToUTF16("username");
2076 field.name = ASCIIToUTF16("username");
2077 field.form_control_type = "text";
2078 form.fields.push_back(field);
2079
2080 field.label = ASCIIToUTF16("password");
2081 field.name = ASCIIToUTF16("password");
2082 field.form_control_type = "password";
2083 form.fields.push_back(field);
2084
2085 field.label = string16();
2086 field.name = ASCIIToUTF16("Submit");
2087 field.form_control_type = "submit";
2088 form.fields.push_back(field);
2089
2090 EXPECT_EQ(form, FormStructure(form).ToFormData());
2091
2092 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always
2093 // false. This forces a future author that changes this to update this test.
2094 form.user_submitted = true;
2095 EXPECT_NE(form, FormStructure(form).ToFormData());
2096 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698