Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: components/autofill/core/common/form_data_unittest.cc

Issue 112433004: Update uses of UTF conversions in chrome_frame/, chromeos/, components/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/common/form_data.h" 5 #include "components/autofill/core/common/form_data.h"
6 6
7 #include "base/pickle.h" 7 #include "base/pickle.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace autofill { 11 namespace autofill {
12 12
13 TEST(FormDataTest, SerializeAndDeserialize) { 13 TEST(FormDataTest, SerializeAndDeserialize) {
14 FormData data; 14 FormData data;
15 data.name = ASCIIToUTF16("name"); 15 data.name = base::ASCIIToUTF16("name");
16 data.method = ASCIIToUTF16("POST"); 16 data.method = base::ASCIIToUTF16("POST");
17 data.origin = GURL("origin"); 17 data.origin = GURL("origin");
18 data.action = GURL("action"); 18 data.action = GURL("action");
19 data.user_submitted = true; 19 data.user_submitted = true;
20 20
21 FormFieldData field_data; 21 FormFieldData field_data;
22 field_data.label = ASCIIToUTF16("label"); 22 field_data.label = base::ASCIIToUTF16("label");
23 field_data.name = ASCIIToUTF16("name"); 23 field_data.name = base::ASCIIToUTF16("name");
24 field_data.value = ASCIIToUTF16("value"); 24 field_data.value = base::ASCIIToUTF16("value");
25 field_data.form_control_type = "password"; 25 field_data.form_control_type = "password";
26 field_data.autocomplete_attribute = "off"; 26 field_data.autocomplete_attribute = "off";
27 field_data.max_length = 200; 27 field_data.max_length = 200;
28 field_data.is_autofilled = true; 28 field_data.is_autofilled = true;
29 field_data.is_checked = true; 29 field_data.is_checked = true;
30 field_data.is_checkable = true; 30 field_data.is_checkable = true;
31 field_data.is_focusable = true; 31 field_data.is_focusable = true;
32 field_data.should_autocomplete = false; 32 field_data.should_autocomplete = false;
33 field_data.text_direction = base::i18n::RIGHT_TO_LEFT; 33 field_data.text_direction = base::i18n::RIGHT_TO_LEFT;
34 field_data.option_values.push_back(ASCIIToUTF16("First")); 34 field_data.option_values.push_back(base::ASCIIToUTF16("First"));
35 field_data.option_values.push_back(ASCIIToUTF16("Second")); 35 field_data.option_values.push_back(base::ASCIIToUTF16("Second"));
36 field_data.option_contents.push_back(ASCIIToUTF16("First")); 36 field_data.option_contents.push_back(base::ASCIIToUTF16("First"));
37 field_data.option_contents.push_back(ASCIIToUTF16("Second")); 37 field_data.option_contents.push_back(base::ASCIIToUTF16("Second"));
38 38
39 data.fields.push_back(field_data); 39 data.fields.push_back(field_data);
40 40
41 // Change a few fields. 41 // Change a few fields.
42 field_data.max_length = 150; 42 field_data.max_length = 150;
43 field_data.option_values.push_back(ASCIIToUTF16("Third")); 43 field_data.option_values.push_back(base::ASCIIToUTF16("Third"));
44 field_data.option_contents.push_back(ASCIIToUTF16("Third")); 44 field_data.option_contents.push_back(base::ASCIIToUTF16("Third"));
45 data.fields.push_back(field_data); 45 data.fields.push_back(field_data);
46 46
47 Pickle pickle; 47 Pickle pickle;
48 SerializeFormData(data, &pickle); 48 SerializeFormData(data, &pickle);
49 49
50 PickleIterator iter(pickle); 50 PickleIterator iter(pickle);
51 FormData actual; 51 FormData actual;
52 EXPECT_TRUE(DeserializeFormData(&iter, &actual)); 52 EXPECT_TRUE(DeserializeFormData(&iter, &actual));
53 53
54 EXPECT_EQ(actual, data); 54 EXPECT_EQ(actual, data);
55 } 55 }
56 56
57 } // namespace autofill 57 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/common/form_data.cc ('k') | components/autofill/core/common/form_field_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698