| 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" | 
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" | 
|  | 12 #include "chrome/common/form_data.h" | 
| 12 #include "chrome/renderer/autofill/form_autofill_util.h" | 13 #include "chrome/renderer/autofill/form_autofill_util.h" | 
| 13 #include "chrome/renderer/autofill/form_cache.h" | 14 #include "chrome/renderer/autofill/form_cache.h" | 
| 14 #include "chrome/test/base/chrome_render_view_test.h" | 15 #include "chrome/test/base/chrome_render_view_test.h" | 
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" | 
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h" | 
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
      .h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormControlElement
      .h" | 
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" | 
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 
| 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 
| 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSelectElement.h" | 
| 23 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 
| 24 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 
| 25 #include "webkit/forms/form_data.h" |  | 
| 26 #include "webkit/glue/web_io_operators.h" | 26 #include "webkit/glue/web_io_operators.h" | 
| 27 | 27 | 
| 28 using WebKit::WebDocument; | 28 using WebKit::WebDocument; | 
| 29 using WebKit::WebElement; | 29 using WebKit::WebElement; | 
| 30 using WebKit::WebFormControlElement; | 30 using WebKit::WebFormControlElement; | 
| 31 using WebKit::WebFormElement; | 31 using WebKit::WebFormElement; | 
| 32 using WebKit::WebFrame; | 32 using WebKit::WebFrame; | 
| 33 using WebKit::WebInputElement; | 33 using WebKit::WebInputElement; | 
| 34 using WebKit::WebSelectElement; | 34 using WebKit::WebSelectElement; | 
| 35 using WebKit::WebNode; | 35 using WebKit::WebNode; | 
| 36 using WebKit::WebString; | 36 using WebKit::WebString; | 
| 37 using WebKit::WebVector; | 37 using WebKit::WebVector; | 
| 38 | 38 | 
| 39 using autofill::ClearPreviewedFormWithElement; | 39 using autofill::ClearPreviewedFormWithElement; | 
| 40 using autofill::FillForm; | 40 using autofill::FillForm; | 
| 41 using autofill::FindFormAndFieldForInputElement; | 41 using autofill::FindFormAndFieldForInputElement; | 
| 42 using autofill::FormWithElementIsAutofilled; | 42 using autofill::FormWithElementIsAutofilled; | 
| 43 using autofill::FormCache; | 43 using autofill::FormCache; | 
| 44 using autofill::PreviewForm; | 44 using autofill::PreviewForm; | 
| 45 using autofill::WebFormControlElementToFormField; | 45 using autofill::WebFormControlElementToFormField; | 
| 46 | 46 | 
| 47 using webkit::forms::FormData; | 47 using chrome::FormData; | 
| 48 using webkit::forms::FormField; | 48 using chrome::FormField; | 
| 49 | 49 | 
| 50 class FormAutofillTest : public ChromeRenderViewTest { | 50 class FormAutofillTest : public ChromeRenderViewTest { | 
| 51  public: | 51  public: | 
| 52   FormAutofillTest() : ChromeRenderViewTest() {} | 52   FormAutofillTest() : ChromeRenderViewTest() {} | 
| 53   virtual ~FormAutofillTest() {} | 53   virtual ~FormAutofillTest() {} | 
| 54 | 54 | 
| 55   void ExpectLabels(const char* html, | 55   void ExpectLabels(const char* html, | 
| 56                     const std::vector<string16>& labels, | 56                     const std::vector<string16>& labels, | 
| 57                     const std::vector<string16>& names, | 57                     const std::vector<string16>& names, | 
| 58                     const std::vector<string16>& values) { | 58                     const std::vector<string16>& values) { | 
| (...skipping 2875 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2934   expected.form_control_type = ASCIIToUTF16("text"); | 2934   expected.form_control_type = ASCIIToUTF16("text"); | 
| 2935   expected.max_length = WebInputElement::defaultMaxLength(); | 2935   expected.max_length = WebInputElement::defaultMaxLength(); | 
| 2936   EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); | 2936   EXPECT_FORM_FIELD_EQUALS(expected, fields[1]); | 
| 2937 | 2937 | 
| 2938   expected.name = ASCIIToUTF16("country"); | 2938   expected.name = ASCIIToUTF16("country"); | 
| 2939   expected.value = ASCIIToUTF16("AL"); | 2939   expected.value = ASCIIToUTF16("AL"); | 
| 2940   expected.form_control_type = ASCIIToUTF16("select-one"); | 2940   expected.form_control_type = ASCIIToUTF16("select-one"); | 
| 2941   expected.max_length = 0; | 2941   expected.max_length = 0; | 
| 2942   EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); | 2942   EXPECT_FORM_FIELD_EQUALS(expected, fields[2]); | 
| 2943 } | 2943 } | 
| OLD | NEW | 
|---|