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 <list> | 5 #include <list> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 scoped_refptr<net::TestURLRequestContextGetter> request_context_; | 126 scoped_refptr<net::TestURLRequestContextGetter> request_context_; |
127 TestAutofillDriver driver_; | 127 TestAutofillDriver driver_; |
128 AutofillDownloadManager download_manager_; | 128 AutofillDownloadManager download_manager_; |
129 }; | 129 }; |
130 | 130 |
131 TEST_F(AutofillDownloadTest, QueryAndUploadTest) { | 131 TEST_F(AutofillDownloadTest, QueryAndUploadTest) { |
132 // Create and register factory. | 132 // Create and register factory. |
133 net::TestURLFetcherFactory factory; | 133 net::TestURLFetcherFactory factory; |
134 | 134 |
135 FormData form; | 135 FormData form; |
136 form.method = ASCIIToUTF16("post"); | |
137 | 136 |
138 FormFieldData field; | 137 FormFieldData field; |
139 field.label = ASCIIToUTF16("username"); | 138 field.label = ASCIIToUTF16("username"); |
140 field.name = ASCIIToUTF16("username"); | 139 field.name = ASCIIToUTF16("username"); |
141 field.form_control_type = "text"; | 140 field.form_control_type = "text"; |
142 form.fields.push_back(field); | 141 form.fields.push_back(field); |
143 | 142 |
144 field.label = ASCIIToUTF16("First Name"); | 143 field.label = ASCIIToUTF16("First Name"); |
145 field.name = ASCIIToUTF16("firstname"); | 144 field.name = ASCIIToUTF16("firstname"); |
146 field.form_control_type = "text"; | 145 field.form_control_type = "text"; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 *(form_structures[0]), true, ServerFieldTypeSet())); | 336 *(form_structures[0]), true, ServerFieldTypeSet())); |
338 fetcher = factory.GetFetcherByID(5); | 337 fetcher = factory.GetFetcherByID(5); |
339 EXPECT_EQ(NULL, fetcher); | 338 EXPECT_EQ(NULL, fetcher); |
340 } | 339 } |
341 | 340 |
342 TEST_F(AutofillDownloadTest, CacheQueryTest) { | 341 TEST_F(AutofillDownloadTest, CacheQueryTest) { |
343 // Create and register factory. | 342 // Create and register factory. |
344 net::TestURLFetcherFactory factory; | 343 net::TestURLFetcherFactory factory; |
345 | 344 |
346 FormData form; | 345 FormData form; |
347 form.method = ASCIIToUTF16("post"); | |
348 | 346 |
349 FormFieldData field; | 347 FormFieldData field; |
350 field.form_control_type = "text"; | 348 field.form_control_type = "text"; |
351 | 349 |
352 field.label = ASCIIToUTF16("username"); | 350 field.label = ASCIIToUTF16("username"); |
353 field.name = ASCIIToUTF16("username"); | 351 field.name = ASCIIToUTF16("username"); |
354 form.fields.push_back(field); | 352 form.fields.push_back(field); |
355 | 353 |
356 field.label = ASCIIToUTF16("First Name"); | 354 field.label = ASCIIToUTF16("First Name"); |
357 field.name = ASCIIToUTF16("firstname"); | 355 field.name = ASCIIToUTF16("firstname"); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); | 487 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); |
490 | 488 |
491 fetcher = factory.GetFetcherByID(3); | 489 fetcher = factory.GetFetcherByID(3); |
492 ASSERT_TRUE(fetcher); | 490 ASSERT_TRUE(fetcher); |
493 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); | 491 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); |
494 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); | 492 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); |
495 EXPECT_EQ(responses[0], responses_.front().response); | 493 EXPECT_EQ(responses[0], responses_.front().response); |
496 } | 494 } |
497 | 495 |
498 } // namespace autofill | 496 } // namespace autofill |
OLD | NEW |