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

Side by Side Diff: components/autofill/core/browser/autofill_download_unittest.cc

Issue 49303005: Parameterize the PrefService that AutofillDownloadManager uses. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 7 years, 1 month 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 <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/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // AutofillDownloadManager. Then it records responses to different initiated 57 // AutofillDownloadManager. Then it records responses to different initiated
58 // requests, which are verified later. To mock network requests 58 // requests, which are verified later. To mock network requests
59 // TestURLFetcherFactory is used, which creates URLFetchers that do not 59 // TestURLFetcherFactory is used, which creates URLFetchers that do not
60 // go over the wire, but allow calling back HTTP responses directly. 60 // go over the wire, but allow calling back HTTP responses directly.
61 // The responses in test are out of order and verify: successful query request, 61 // The responses in test are out of order and verify: successful query request,
62 // successful upload request, failed upload request. 62 // successful upload request, failed upload request.
63 class AutofillDownloadTest : public AutofillDownloadManager::Observer, 63 class AutofillDownloadTest : public AutofillDownloadManager::Observer,
64 public testing::Test { 64 public testing::Test {
65 public: 65 public:
66 AutofillDownloadTest() 66 AutofillDownloadTest()
67 : download_manager_(&profile_, this) { 67 : download_manager_(&profile_, profile_.GetPrefs(), this) {
68 } 68 }
69 69
70 void LimitCache(size_t cache_size) { 70 void LimitCache(size_t cache_size) {
71 download_manager_.set_max_form_cache_size(cache_size); 71 download_manager_.set_max_form_cache_size(cache_size);
72 } 72 }
73 73
74 // AutofillDownloadManager::Observer implementation. 74 // AutofillDownloadManager::Observer implementation.
75 virtual void OnLoadedServerPredictions( 75 virtual void OnLoadedServerPredictions(
76 const std::string& response_xml) OVERRIDE { 76 const std::string& response_xml) OVERRIDE {
77 ResponseData response; 77 ResponseData response;
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); 482 EXPECT_EQ(static_cast<size_t>(0), responses_.size());
483 483
484 fetcher = factory.GetFetcherByID(3); 484 fetcher = factory.GetFetcherByID(3);
485 ASSERT_TRUE(fetcher); 485 ASSERT_TRUE(fetcher);
486 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); 486 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0]));
487 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); 487 ASSERT_EQ(static_cast<size_t>(1), responses_.size());
488 EXPECT_EQ(responses[0], responses_.front().response); 488 EXPECT_EQ(responses[0], responses_.front().response);
489 } 489 }
490 490
491 } // namespace autofill 491 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_download.cc ('k') | components/autofill/core/browser/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698