OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/form_structure.h" | 5 #include "components/autofill/core/browser/form_structure.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "components/autofill/core/browser/autofill_metrics.h" | 10 #include "components/autofill/core/browser/autofill_metrics.h" |
11 #include "components/autofill/core/common/form_data.h" | 11 #include "components/autofill/core/common/form_data.h" |
12 #include "components/autofill/core/common/form_field_data.h" | 12 #include "components/autofill/core/common/form_field_data.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "third_party/WebKit/public/web/WebInputElement.h" | 14 #include "third_party/WebKit/public/web/WebInputElement.h" |
15 #include "url/gurl.h" | 15 #include "url/gurl.h" |
16 | 16 |
| 17 using base::ASCIIToUTF16; |
17 using blink::WebInputElement; | 18 using blink::WebInputElement; |
18 | 19 |
19 namespace autofill { | 20 namespace autofill { |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Unlike the base AutofillMetrics, exposes copy and assignment constructors, | 23 // Unlike the base AutofillMetrics, exposes copy and assignment constructors, |
23 // which are handy for briefer test code. The AutofillMetrics class is | 24 // which are handy for briefer test code. The AutofillMetrics class is |
24 // stateless, so this is safe. | 25 // stateless, so this is safe. |
25 class TestAutofillMetrics : public AutofillMetrics { | 26 class TestAutofillMetrics : public AutofillMetrics { |
26 public: | 27 public: |
27 TestAutofillMetrics() {} | 28 TestAutofillMetrics() {} |
28 virtual ~TestAutofillMetrics() {} | 29 virtual ~TestAutofillMetrics() {} |
29 }; | 30 }; |
30 | 31 |
31 } // anonymous namespace | 32 } // anonymous namespace |
32 | 33 |
33 | 34 |
34 namespace content { | 35 namespace content { |
35 | 36 |
36 std::ostream& operator<<(std::ostream& os, const FormData& form) { | 37 std::ostream& operator<<(std::ostream& os, const FormData& form) { |
37 os << UTF16ToUTF8(form.name) | 38 os << base::UTF16ToUTF8(form.name) |
38 << " " | 39 << " " |
39 << UTF16ToUTF8(form.method) | 40 << base::UTF16ToUTF8(form.method) |
40 << " " | 41 << " " |
41 << form.origin.spec() | 42 << form.origin.spec() |
42 << " " | 43 << " " |
43 << form.action.spec() | 44 << form.action.spec() |
44 << " "; | 45 << " "; |
45 | 46 |
46 for (std::vector<FormFieldData>::const_iterator iter = | 47 for (std::vector<FormFieldData>::const_iterator iter = |
47 form.fields.begin(); | 48 form.fields.begin(); |
48 iter != form.fields.end(); ++iter) { | 49 iter != form.fields.end(); ++iter) { |
49 os << *iter | 50 os << *iter |
(...skipping 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2339 "<field signature=\"420638584\"/></form></autofillquery>"; | 2340 "<field signature=\"420638584\"/></form></autofillquery>"; |
2340 ASSERT_TRUE(FormStructure::EncodeQueryRequest(forms.get(), | 2341 ASSERT_TRUE(FormStructure::EncodeQueryRequest(forms.get(), |
2341 &encoded_signatures, | 2342 &encoded_signatures, |
2342 &encoded_xml)); | 2343 &encoded_xml)); |
2343 ASSERT_EQ(1U, encoded_signatures.size()); | 2344 ASSERT_EQ(1U, encoded_signatures.size()); |
2344 EXPECT_EQ(kSignature, encoded_signatures[0]); | 2345 EXPECT_EQ(kSignature, encoded_signatures[0]); |
2345 EXPECT_EQ(kResponse, encoded_xml); | 2346 EXPECT_EQ(kResponse, encoded_xml); |
2346 } | 2347 } |
2347 | 2348 |
2348 } // namespace autofill | 2349 } // namespace autofill |
OLD | NEW |