OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/autofill_download_manager.h" | 5 #include "components/autofill/core/browser/autofill_download_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <list> | 9 #include <list> |
| 10 #include <memory> |
10 #include <utility> | 11 #include <utility> |
11 | 12 |
12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
15 #include "base/test/histogram_tester.h" | 16 #include "base/test/histogram_tester.h" |
16 #include "base/test/test_timeouts.h" | 17 #include "base/test/test_timeouts.h" |
17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
18 #include "components/autofill/core/browser/autofill_field.h" | 19 #include "components/autofill/core/browser/autofill_field.h" |
19 #include "components/autofill/core/browser/autofill_metrics.h" | 20 #include "components/autofill/core/browser/autofill_metrics.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 field.label = ASCIIToUTF16("city"); | 395 field.label = ASCIIToUTF16("city"); |
395 field.name = ASCIIToUTF16("city"); | 396 field.name = ASCIIToUTF16("city"); |
396 field.form_control_type = "text"; | 397 field.form_control_type = "text"; |
397 form.fields.push_back(field); | 398 form.fields.push_back(field); |
398 | 399 |
399 field.label = base::string16(); | 400 field.label = base::string16(); |
400 field.name = ASCIIToUTF16("Submit"); | 401 field.name = ASCIIToUTF16("Submit"); |
401 field.form_control_type = "submit"; | 402 field.form_control_type = "submit"; |
402 form.fields.push_back(field); | 403 form.fields.push_back(field); |
403 | 404 |
404 scoped_ptr<FormStructure> form_structure(new FormStructure(form)); | 405 std::unique_ptr<FormStructure> form_structure(new FormStructure(form)); |
405 | 406 |
406 // Request with id 0. | 407 // Request with id 0. |
407 EXPECT_TRUE(download_manager_.StartUploadRequest( | 408 EXPECT_TRUE(download_manager_.StartUploadRequest( |
408 *form_structure, true, ServerFieldTypeSet(), std::string(), true)); | 409 *form_structure, true, ServerFieldTypeSet(), std::string(), true)); |
409 | 410 |
410 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 411 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
411 ASSERT_TRUE(fetcher); | 412 ASSERT_TRUE(fetcher); |
412 | 413 |
413 // Error incurs a retry after 1 second. | 414 // Error incurs a retry after 1 second. |
414 FakeOnURLFetchComplete(fetcher, net::HTTP_NOT_FOUND, "<html></html>"); | 415 FakeOnURLFetchComplete(fetcher, net::HTTP_NOT_FOUND, "<html></html>"); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 EXPECT_EQ(0U, responses_.size()); | 635 EXPECT_EQ(0U, responses_.size()); |
635 | 636 |
636 fetcher = factory.GetFetcherByID(3); | 637 fetcher = factory.GetFetcherByID(3); |
637 ASSERT_TRUE(fetcher); | 638 ASSERT_TRUE(fetcher); |
638 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); | 639 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); |
639 ASSERT_EQ(1U, responses_.size()); | 640 ASSERT_EQ(1U, responses_.size()); |
640 EXPECT_EQ(responses[0], responses_.front().response); | 641 EXPECT_EQ(responses[0], responses_.front().response); |
641 } | 642 } |
642 | 643 |
643 } // namespace autofill | 644 } // namespace autofill |
OLD | NEW |