OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 ASSERT_EQ(labels.size(), fields.size()); | 88 ASSERT_EQ(labels.size(), fields.size()); |
89 for (size_t i = 0; i < labels.size(); ++i) { | 89 for (size_t i = 0; i < labels.size(); ++i) { |
90 int max_length = control_types[i] == "text" ? | 90 int max_length = control_types[i] == "text" ? |
91 WebInputElement::defaultMaxLength() : 0; | 91 WebInputElement::defaultMaxLength() : 0; |
92 FormFieldData expected; | 92 FormFieldData expected; |
93 expected.label = labels[i]; | 93 expected.label = labels[i]; |
94 expected.name = names[i]; | 94 expected.name = names[i]; |
95 expected.value = values[i]; | 95 expected.value = values[i]; |
96 expected.form_control_type = control_types[i]; | 96 expected.form_control_type = control_types[i]; |
97 expected.max_length = max_length; | 97 expected.max_length = max_length; |
98 SCOPED_TRACE(StringPrintf("i: %" PRIuS, i)); | 98 SCOPED_TRACE(base::StringPrintf("i: %" PRIuS, i)); |
99 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[i]); | 99 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[i]); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 void ExpectJohnSmithLabels(const char* html) { | 103 void ExpectJohnSmithLabels(const char* html) { |
104 std::vector<string16> labels, names, values; | 104 std::vector<string16> labels, names, values; |
105 | 105 |
106 labels.push_back(ASCIIToUTF16("First name:")); | 106 labels.push_back(ASCIIToUTF16("First name:")); |
107 names.push_back(ASCIIToUTF16("firstname")); | 107 names.push_back(ASCIIToUTF16("firstname")); |
108 values.push_back(ASCIIToUTF16("John")); | 108 values.push_back(ASCIIToUTF16("John")); |
(...skipping 2935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3044 expected.form_control_type = "text"; | 3044 expected.form_control_type = "text"; |
3045 expected.max_length = WebInputElement::defaultMaxLength(); | 3045 expected.max_length = WebInputElement::defaultMaxLength(); |
3046 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); | 3046 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[1]); |
3047 | 3047 |
3048 expected.name = ASCIIToUTF16("country"); | 3048 expected.name = ASCIIToUTF16("country"); |
3049 expected.value = ASCIIToUTF16("AL"); | 3049 expected.value = ASCIIToUTF16("AL"); |
3050 expected.form_control_type = "select-one"; | 3050 expected.form_control_type = "select-one"; |
3051 expected.max_length = 0; | 3051 expected.max_length = 0; |
3052 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); | 3052 EXPECT_FORM_FIELD_DATA_EQUALS(expected, fields[2]); |
3053 } | 3053 } |
OLD | NEW |