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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 Time t1 = Time::Now(); | 133 Time t1 = Time::Now(); |
134 | 134 |
135 // Simulate the submission of a handful of entries in a field called "Name", | 135 // Simulate the submission of a handful of entries in a field called "Name", |
136 // some more often than others. | 136 // some more often than others. |
137 AutofillChangeList changes; | 137 AutofillChangeList changes; |
138 FormFieldData field; | 138 FormFieldData field; |
139 field.name = ASCIIToUTF16("Name"); | 139 field.name = ASCIIToUTF16("Name"); |
140 field.value = ASCIIToUTF16("Superman"); | 140 field.value = ASCIIToUTF16("Superman"); |
141 base::Time now = base::Time::Now(); | 141 base::Time now = base::Time::Now(); |
142 base::TimeDelta two_seconds = base::TimeDelta::FromSeconds(2); | 142 base::TimeDelta two_seconds = base::TimeDelta::FromSeconds(2); |
| 143 EXPECT_FALSE(table_->HasFormElements()); |
143 EXPECT_TRUE(table_->AddFormFieldValue(field, &changes)); | 144 EXPECT_TRUE(table_->AddFormFieldValue(field, &changes)); |
| 145 EXPECT_TRUE(table_->HasFormElements()); |
144 std::vector<base::string16> v; | 146 std::vector<base::string16> v; |
145 for (int i = 0; i < 5; i++) { | 147 for (int i = 0; i < 5; i++) { |
146 field.value = ASCIIToUTF16("Clark Kent"); | 148 field.value = ASCIIToUTF16("Clark Kent"); |
147 EXPECT_TRUE(table_->AddFormFieldValueTime(field, &changes, | 149 EXPECT_TRUE(table_->AddFormFieldValueTime(field, &changes, |
148 now + i * two_seconds)); | 150 now + i * two_seconds)); |
149 } | 151 } |
150 for (int i = 0; i < 3; i++) { | 152 for (int i = 0; i < 3; i++) { |
151 field.value = ASCIIToUTF16("Clark Sutter"); | 153 field.value = ASCIIToUTF16("Clark Sutter"); |
152 EXPECT_TRUE(table_->AddFormFieldValueTime(field, &changes, | 154 EXPECT_TRUE(table_->AddFormFieldValueTime(field, &changes, |
153 now + i * two_seconds)); | 155 now + i * two_seconds)); |
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 ASSERT_EQ(expected_entries.size(), entry_set.size()); | 1326 ASSERT_EQ(expected_entries.size(), entry_set.size()); |
1325 AutofillEntrySetIterator it; | 1327 AutofillEntrySetIterator it; |
1326 for (it = entry_set.begin(); it != entry_set.end(); it++) { | 1328 for (it = entry_set.begin(); it != entry_set.end(); it++) { |
1327 expected_entries.erase(*it); | 1329 expected_entries.erase(*it); |
1328 } | 1330 } |
1329 | 1331 |
1330 EXPECT_EQ(0U, expected_entries.size()); | 1332 EXPECT_EQ(0U, expected_entries.size()); |
1331 } | 1333 } |
1332 | 1334 |
1333 } // namespace autofill | 1335 } // namespace autofill |
OLD | NEW |