From 08a2cb4cbfdceac827330fc7de34752d0b73efd4 Mon Sep 17 00:00:00 2001 From: "isherman@chromium.org" Date: Mon, 14 Feb 2011 22:59:43 +0000 Subject: Pull in a named constant from WebKit BUG=none TEST=none Review URL: http://codereview.chromium.org/6437001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74867 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/autofill/autofill_merge_unittest.cc | 7 +- .../renderer/autofill/form_manager_browsertest.cc | 398 +++++++++++---------- chrome/renderer/render_view_browsertest.cc | 15 +- 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