summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/autofill/autofill_merge_unittest.cc7
-rw-r--r--chrome/renderer/autofill/form_manager_browsertest.cc398
-rw-r--r--chrome/renderer/render_view_browsertest.cc15
3 files changed, 210 insertions, 210 deletions
diff --git a/chrome/browser/autofill/autofill_merge_unittest.cc b/chrome/browser/autofill/autofill_merge_unittest.cc
index 1c72032..a1548a0 100644
--- a/chrome/browser/autofill/autofill_merge_unittest.cc
+++ b/chrome/browser/autofill/autofill_merge_unittest.cc
@@ -15,14 +15,11 @@
#include "chrome/browser/autofill/personal_data_manager.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
#include "webkit/glue/form_data.h"
namespace {
-// TODO(isherman): Pull in the equivalent named constant from WebKit, without
-// breaking the shared-lib build.
-const int kDefaultMaxLength = 0x80000;
-
const FilePath::CharType kTestName[] = FILE_PATH_LITERAL("merge");
const FilePath::CharType kFileNamePattern[] = FILE_PATH_LITERAL("*.in");
@@ -184,7 +181,7 @@ void AutoFillMergeTest::MergeProfiles(const std::string& profiles,
field_type,
value,
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebKit::WebInputElement::defaultMaxLength(),
false);
form.fields.push_back(field);
}
diff --git a/chrome/renderer/autofill/form_manager_browsertest.cc b/chrome/renderer/autofill/form_manager_browsertest.cc
index 3e7fc9f..47115a7 100644
--- a/chrome/renderer/autofill/form_manager_browsertest.cc
+++ b/chrome/renderer/autofill/form_manager_browsertest.cc
@@ -38,13 +38,6 @@ using autofill::FormManager;
using webkit_glue::FormData;
using webkit_glue::FormField;
-namespace {
-
-// TODO(isherman): Pull this as a named constant from WebKit
-const int kDefaultMaxLength = 0x80000;
-
-} // namespace
-
class FormManagerTest : public RenderViewTest {
public:
FormManagerTest() : RenderViewTest() {}
@@ -82,7 +75,7 @@ class FormManagerTest : public RenderViewTest {
names[i],
values[i],
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false);
EXPECT_TRUE(fields[i].StrictlyEqualsHack(expected))
<< "Expected \"" << expected << "\", got \"" << fields[i] << "\"";
@@ -107,7 +100,6 @@ class FormManagerTest : public RenderViewTest {
ExpectLabels(html, labels, names, values);
}
-
private:
DISALLOW_COPY_AND_ASSIGN(FormManagerTest);
};
@@ -125,22 +117,24 @@ TEST_F(FormManagerTest, WebFormControlElementToFormField) {
FormManager::WebFormControlElementToFormField(element,
FormManager::EXTRACT_NONE,
&result1);
- EXPECT_TRUE(result1.StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("element"),
- string16(),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
+ EXPECT_TRUE(result1.StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("element"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
FormField result2;
FormManager::WebFormControlElementToFormField(element,
FormManager::EXTRACT_VALUE,
&result2);
- EXPECT_TRUE(result2.StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("element"),
- ASCIIToUTF16("value"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
+ EXPECT_TRUE(result2.StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("element"),
+ ASCIIToUTF16("value"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
}
// We should be able to extract a text field with autocomplete="off".
@@ -157,12 +151,13 @@ TEST_F(FormManagerTest, WebFormControlElementToFormFieldAutocompleteOff) {
FormManager::WebFormControlElementToFormField(element,
FormManager::EXTRACT_VALUE,
&result);
- EXPECT_TRUE(result.StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("element"),
- ASCIIToUTF16("value"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
+ EXPECT_TRUE(result.StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("element"),
+ ASCIIToUTF16("value"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
}
// We should be able to extract a text field with maxlength specified.
@@ -201,12 +196,13 @@ TEST_F(FormManagerTest, WebFormControlElementToFormFieldAutofilled) {
FormManager::WebFormControlElementToFormField(element,
FormManager::EXTRACT_VALUE,
&result);
- EXPECT_TRUE(result.StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("element"),
- ASCIIToUTF16("value"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- true)));
+ EXPECT_TRUE(result.StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("element"),
+ ASCIIToUTF16("value"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ true)));
}
// We should be able to extract a <select> field.
@@ -370,14 +366,14 @@ TEST_F(FormManagerTest, WebFormElementToFormData) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("John"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[2].StrictlyEqualsHack(
FormField(string16(),
@@ -417,21 +413,21 @@ TEST_F(FormManagerTest, ExtractForms) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("John"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("john@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
}
@@ -472,21 +468,21 @@ TEST_F(FormManagerTest, ExtractMultipleForms) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("John"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("john@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
@@ -502,21 +498,21 @@ TEST_F(FormManagerTest, ExtractMultipleForms) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("Jack"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Adams"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("jack@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
}
@@ -599,21 +595,21 @@ TEST_F(FormManagerTest, GetFormsAutocomplete) {
ASCIIToUTF16("middlename"),
ASCIIToUTF16("Jack"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("john@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
}
@@ -649,21 +645,21 @@ TEST_F(FormManagerTest, GetFormsElementsEnabled) {
ASCIIToUTF16("middlename"),
ASCIIToUTF16("Jack"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("jack@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
}
@@ -705,21 +701,21 @@ TEST_F(FormManagerTest, FindForm) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("John"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("john@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
}
@@ -764,35 +760,35 @@ TEST_F(FormManagerTest, FillForm) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("notempty"),
ASCIIToUTF16("Hi"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("noautocomplete"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[3]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("notenabled"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[4]);
@@ -876,35 +872,35 @@ TEST_F(FormManagerTest, PreviewForm) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("notempty"),
ASCIIToUTF16("Hi"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("noautocomplete"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[3]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("notenabled"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[4]);
@@ -1563,21 +1559,21 @@ TEST_F(FormManagerTest, FillFormNegativeMaxLength) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
@@ -1602,21 +1598,21 @@ TEST_F(FormManagerTest, FillFormNegativeMaxLength) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("Brother"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields2[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Jonathan"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields2[2].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("brotherj@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
}
@@ -1656,7 +1652,7 @@ TEST_F(FormManagerTest, FillFormMoreFormDataFields) {
ASCIIToUTF16("prefix"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false);
form->fields.insert(form->fields.begin(), field1);
@@ -1664,7 +1660,7 @@ TEST_F(FormManagerTest, FillFormMoreFormDataFields) {
ASCIIToUTF16("hidden"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false);
form->fields.insert(form->fields.begin() + 2, field2);
@@ -1672,7 +1668,7 @@ TEST_F(FormManagerTest, FillFormMoreFormDataFields) {
ASCIIToUTF16("second"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false);
form->fields.insert(form->fields.begin() + 4, field3);
@@ -1680,7 +1676,7 @@ TEST_F(FormManagerTest, FillFormMoreFormDataFields) {
ASCIIToUTF16("postfix"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false);
form->fields.insert(form->fields.begin() + 6, field4);
@@ -1708,24 +1704,27 @@ TEST_F(FormManagerTest, FillFormMoreFormDataFields) {
const std::vector<FormField>& fields = form2.fields;
ASSERT_EQ(3U, fields.size());
- EXPECT_TRUE(fields[0].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("firstname"),
- ASCIIToUTF16("Brother"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[1].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("middlename"),
- ASCIIToUTF16("Joseph"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[2].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("lastname"),
- ASCIIToUTF16("Jonathan"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
+ EXPECT_TRUE(fields[0].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("firstname"),
+ ASCIIToUTF16("Brother"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[1].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("middlename"),
+ ASCIIToUTF16("Joseph"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[2].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("lastname"),
+ ASCIIToUTF16("Jonathan"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
}
// This test sends a FormData object to FillForm with fewer fields than are in
@@ -1784,48 +1783,55 @@ TEST_F(FormManagerTest, FillFormFewerFormDataFields) {
const std::vector<FormField>& fields = form2.fields;
ASSERT_EQ(7U, fields.size());
- EXPECT_TRUE(fields[0].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("prefix"),
- string16(),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[1].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("firstname"),
- ASCIIToUTF16("Brother"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[2].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("hidden"),
- string16(),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[3].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("middlename"),
- ASCIIToUTF16("Joseph"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[4].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("second"),
- string16(),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[5].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("lastname"),
- ASCIIToUTF16("Jonathan"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[6].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("postfix"),
- string16(),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
+ EXPECT_TRUE(fields[0].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("prefix"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[1].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("firstname"),
+ ASCIIToUTF16("Brother"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[2].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("hidden"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[3].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("middlename"),
+ ASCIIToUTF16("Joseph"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[4].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("second"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[5].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("lastname"),
+ ASCIIToUTF16("Jonathan"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[6].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("postfix"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
}
// This test sends a FormData object to FillForm with a field changed from
@@ -1885,19 +1891,19 @@ TEST_F(FormManagerTest, FillFormChangedFormDataFields) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("Brother"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[1].StrictlyEqualsHack(FormField(string16(),
ASCIIToUTF16("middlename"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[2].StrictlyEqualsHack(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Jonathan"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
}
@@ -1951,30 +1957,34 @@ TEST_F(FormManagerTest, FillFormExtraFieldInCache) {
const std::vector<FormField>& fields = form2.fields;
ASSERT_EQ(4U, fields.size());
- EXPECT_TRUE(fields[0].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("firstname"),
- ASCIIToUTF16("Brother"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[1].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("middlename"),
- ASCIIToUTF16("Joseph"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[2].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("lastname"),
- ASCIIToUTF16("Jonathan"),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
- EXPECT_TRUE(fields[3].StrictlyEqualsHack(FormField(string16(),
- ASCIIToUTF16("postfix"),
- string16(),
- ASCIIToUTF16("text"),
- kDefaultMaxLength,
- false)));
+ EXPECT_TRUE(fields[0].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("firstname"),
+ ASCIIToUTF16("Brother"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[1].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("middlename"),
+ ASCIIToUTF16("Joseph"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[2].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("lastname"),
+ ASCIIToUTF16("Jonathan"),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
+ EXPECT_TRUE(fields[3].StrictlyEqualsHack(
+ FormField(string16(),
+ ASCIIToUTF16("postfix"),
+ string16(),
+ ASCIIToUTF16("text"),
+ WebInputElement::defaultMaxLength(),
+ false)));
}
TEST_F(FormManagerTest, FillFormEmptyName) {
@@ -2014,21 +2024,21 @@ TEST_F(FormManagerTest, FillFormEmptyName) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
@@ -2052,21 +2062,21 @@ TEST_F(FormManagerTest, FillFormEmptyName) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("Wyatt"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Earp"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("wyatt@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[2]);
}
@@ -2114,21 +2124,21 @@ TEST_F(FormManagerTest, FillFormEmptyFormNames) {
ASCIIToUTF16("apple"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("banana"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("cantelope"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
@@ -2152,21 +2162,21 @@ TEST_F(FormManagerTest, FillFormEmptyFormNames) {
ASCIIToUTF16("apple"),
ASCIIToUTF16("Red"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("banana"),
ASCIIToUTF16("Yellow"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("cantelope"),
ASCIIToUTF16("Also Yellow"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[2]);
}
@@ -2207,28 +2217,28 @@ TEST_F(FormManagerTest, ThreePartPhone) {
ASCIIToUTF16("dayphone1"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(ASCIIToUTF16("-"),
ASCIIToUTF16("dayphone2"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(ASCIIToUTF16("-"),
ASCIIToUTF16("dayphone3"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
EXPECT_EQ(FormField(ASCIIToUTF16("ext.:"),
ASCIIToUTF16("dayphone4"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[3]);
}
@@ -2301,7 +2311,7 @@ TEST_F(FormManagerTest, MaxLengthFields) {
ASCIIToUTF16("default1"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[4]);
// When invalid |size|, default is returned.
@@ -2309,7 +2319,7 @@ TEST_F(FormManagerTest, MaxLengthFields) {
ASCIIToUTF16("invalid1"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[5]);
}
@@ -2357,21 +2367,21 @@ TEST_F(FormManagerTest, FillFormNonEmptyField) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields[2]);
@@ -2395,21 +2405,21 @@ TEST_F(FormManagerTest, FillFormNonEmptyField) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("Wyatt"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[0]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Earp"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[1]);
EXPECT_EQ(FormField(string16(),
ASCIIToUTF16("email"),
ASCIIToUTF16("wyatt@example.com"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false),
fields2[2]);
@@ -2470,28 +2480,28 @@ TEST_F(FormManagerTest, ClearFormWithNode) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields2[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("lastname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields2[2].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("noAC"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields2[3].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("notenabled"),
ASCIIToUTF16("no clear"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
// Verify that the cursor position has been updated.
@@ -2555,14 +2565,14 @@ TEST_F(FormManagerTest, ClearFormWithNodeContainingSelectOne) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields2[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("lastname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields2[2].StrictlyEqualsHack(
FormField(string16(),
@@ -2885,14 +2895,14 @@ TEST_F(FormManagerTest, SelectOneAsText) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("John"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[2].StrictlyEqualsHack(
FormField(string16(),
@@ -2918,14 +2928,14 @@ TEST_F(FormManagerTest, SelectOneAsText) {
ASCIIToUTF16("firstname"),
ASCIIToUTF16("John"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("lastname"),
ASCIIToUTF16("Smith"),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false)));
EXPECT_TRUE(fields[2].StrictlyEqualsHack(
FormField(string16(),
diff --git a/chrome/renderer/render_view_browsertest.cc b/chrome/renderer/render_view_browsertest.cc
index 0b81bec..73d2446 100644
--- a/chrome/renderer/render_view_browsertest.cc
+++ b/chrome/renderer/render_view_browsertest.cc
@@ -40,13 +40,6 @@ using WebKit::WebURLError;
using webkit_glue::FormData;
using webkit_glue::FormField;
-namespace {
-
-// TODO(isherman): Pull this as a named constant from WebKit
-const int kDefaultMaxLength = 0x80000;
-
-} // namespace
-
// Test that we get form state change notifications when input fields change.
TEST_F(RenderViewTest, OnNavStateChanged) {
// Don't want any delay for form state sync changes. This will still post a
@@ -1045,14 +1038,14 @@ TEST_F(RenderViewTest, SendForms) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false))) << forms[0].fields[0];
EXPECT_TRUE(forms[0].fields[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("middlename"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false))) << forms[0].fields[1];
EXPECT_TRUE(forms[0].fields[2].StrictlyEqualsHack(
FormField(string16(),
@@ -1092,14 +1085,14 @@ TEST_F(RenderViewTest, SendForms) {
ASCIIToUTF16("firstname"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false))) << form2.fields[0];
EXPECT_TRUE(form2.fields[1].StrictlyEqualsHack(
FormField(string16(),
ASCIIToUTF16("middlename"),
string16(),
ASCIIToUTF16("text"),
- kDefaultMaxLength,
+ WebInputElement::defaultMaxLength(),
false))) << form2.fields[1];
EXPECT_TRUE(form2.fields[2].StrictlyEqualsHack(
FormField(string16(),