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

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

Issue 11539003: Pop up requestAutocomplete UI when autofill server hints chrome client that it is in a multipage au… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Addressed Albert's comments Created 7 years, 11 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 (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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 field.name = ASCIIToUTF16("Submit"); 80 field.name = ASCIIToUTF16("Submit");
81 field.form_control_type = "submit"; 81 field.form_control_type = "submit";
82 form.fields.push_back(field); 82 form.fields.push_back(field);
83 83
84 FormStructure form_structure(form); 84 FormStructure form_structure(form);
85 85
86 // All fields are counted. 86 // All fields are counted.
87 EXPECT_EQ(3U, form_structure.field_count()); 87 EXPECT_EQ(3U, form_structure.field_count());
88 } 88 }
89 89
90 TEST(FormStructureTest, AutofillFlowInfo) {
91 FormData form;
92 form.method = ASCIIToUTF16("post");
93
94 FormFieldData field;
95 field.label = ASCIIToUTF16("username");
96 field.name = ASCIIToUTF16("username");
97 field.form_control_type = "text";
98 form.fields.push_back(field);
99
100 FormStructure form_structure(form);
101
102 EXPECT_FALSE(form_structure.IsStartOfAutofillableFlow());
103 EXPECT_FALSE(form_structure.IsInAutofillableFlow());
Ilya Sherman 2013/01/15 06:31:52 Please add more thorough tests for these methods.
Raman Kakilate 2013/01/15 23:02:33 Added more tests.
104 }
105
90 TEST(FormStructureTest, AutofillCount) { 106 TEST(FormStructureTest, AutofillCount) {
91 FormData form; 107 FormData form;
92 form.method = ASCIIToUTF16("post"); 108 form.method = ASCIIToUTF16("post");
93 109
94 FormFieldData field; 110 FormFieldData field;
95 field.label = ASCIIToUTF16("username"); 111 field.label = ASCIIToUTF16("username");
96 field.name = ASCIIToUTF16("username"); 112 field.name = ASCIIToUTF16("username");
97 field.form_control_type = "text"; 113 field.form_control_type = "text";
98 form.fields.push_back(field); 114 form.fields.push_back(field);
99 115
(...skipping 1987 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 field.form_control_type = "submit"; 2103 field.form_control_type = "submit";
2088 form.fields.push_back(field); 2104 form.fields.push_back(field);
2089 2105
2090 EXPECT_EQ(form, FormStructure(form).ToFormData()); 2106 EXPECT_EQ(form, FormStructure(form).ToFormData());
2091 2107
2092 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always 2108 // Currently |FormStructure(form_data)ToFormData().user_submitted| is always
2093 // false. This forces a future author that changes this to update this test. 2109 // false. This forces a future author that changes this to update this test.
2094 form.user_submitted = true; 2110 form.user_submitted = true;
2095 EXPECT_NE(form, FormStructure(form).ToFormData()); 2111 EXPECT_NE(form, FormStructure(form).ToFormData());
2096 } 2112 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698