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 <list> | 7 #include <list> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // The responses in test are out of order and verify: successful query request, | 63 // The responses in test are out of order and verify: successful query request, |
64 // successful upload request, failed upload request. | 64 // successful upload request, failed upload request. |
65 class AutofillDownloadTest : public AutofillDownloadManager::Observer, | 65 class AutofillDownloadTest : public AutofillDownloadManager::Observer, |
66 public testing::Test { | 66 public testing::Test { |
67 public: | 67 public: |
68 AutofillDownloadTest() | 68 AutofillDownloadTest() |
69 : prefs_(test::PrefServiceForTesting()), | 69 : prefs_(test::PrefServiceForTesting()), |
70 request_context_(new net::TestURLRequestContextGetter( | 70 request_context_(new net::TestURLRequestContextGetter( |
71 base::MessageLoopProxy::current())), | 71 base::MessageLoopProxy::current())), |
72 download_manager_(&driver_, prefs_.get(), this) { | 72 download_manager_(&driver_, prefs_.get(), this) { |
73 driver_.SetURLRequestContext(request_context_); | 73 driver_.SetURLRequestContext(request_context_.get()); |
74 } | 74 } |
75 | 75 |
76 void LimitCache(size_t cache_size) { | 76 void LimitCache(size_t cache_size) { |
77 download_manager_.set_max_form_cache_size(cache_size); | 77 download_manager_.set_max_form_cache_size(cache_size); |
78 } | 78 } |
79 | 79 |
80 // AutofillDownloadManager::Observer implementation. | 80 // AutofillDownloadManager::Observer implementation. |
81 virtual void OnLoadedServerPredictions( | 81 virtual void OnLoadedServerPredictions( |
82 const std::string& response_xml) OVERRIDE { | 82 const std::string& response_xml) OVERRIDE { |
83 ResponseData response; | 83 ResponseData response; |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); | 488 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); |
489 | 489 |
490 fetcher = factory.GetFetcherByID(3); | 490 fetcher = factory.GetFetcherByID(3); |
491 ASSERT_TRUE(fetcher); | 491 ASSERT_TRUE(fetcher); |
492 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); | 492 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); |
493 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); | 493 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); |
494 EXPECT_EQ(responses[0], responses_.front().response); | 494 EXPECT_EQ(responses[0], responses_.front().response); |
495 } | 495 } |
496 | 496 |
497 } // namespace autofill | 497 } // namespace autofill |
OLD | NEW |