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

Side by Side Diff: components/suggestions/image_manager_unittest.cc

Issue 2781473003: Add |SetImageDownloadLimit| to ImageFetcher to limit downloaded bytes (Closed)
Patch Set: Add |SetImageDownloadLimit| to ImageDataFetcher Created 3 years, 8 months 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
OLDNEW
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/suggestions/image_manager.h" 5 #include "components/suggestions/image_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 class MockImageFetcher : public ImageFetcher { 47 class MockImageFetcher : public ImageFetcher {
48 public: 48 public:
49 MockImageFetcher() {} 49 MockImageFetcher() {}
50 virtual ~MockImageFetcher() {} 50 virtual ~MockImageFetcher() {}
51 MOCK_METHOD3(StartOrQueueNetworkRequest, 51 MOCK_METHOD3(StartOrQueueNetworkRequest,
52 void(const std::string&, 52 void(const std::string&,
53 const GURL&, 53 const GURL&,
54 const ImageFetcherCallback&)); 54 const ImageFetcherCallback&));
55 MOCK_METHOD1(SetImageFetcherDelegate, void(ImageFetcherDelegate*)); 55 MOCK_METHOD1(SetImageFetcherDelegate, void(ImageFetcherDelegate*));
56 MOCK_METHOD1(SetDataUseServiceName, void(DataUseServiceName)); 56 MOCK_METHOD1(SetDataUseServiceName, void(DataUseServiceName));
57 MOCK_METHOD1(SetImageDownloadLimit, void(int64_t max_download_bytes));
57 MOCK_METHOD1(SetDesiredImageFrameSize, void(const gfx::Size&)); 58 MOCK_METHOD1(SetDesiredImageFrameSize, void(const gfx::Size&));
58 MOCK_METHOD0(GetImageDecoder, image_fetcher::ImageDecoder*()); 59 MOCK_METHOD0(GetImageDecoder, image_fetcher::ImageDecoder*());
59 }; 60 };
60 61
61 class ImageManagerTest : public testing::Test { 62 class ImageManagerTest : public testing::Test {
62 public: 63 public:
63 ImageManagerTest() 64 ImageManagerTest()
64 : mock_image_fetcher_(NULL), 65 : mock_image_fetcher_(NULL),
65 num_callback_null_called_(0), 66 num_callback_null_called_(0),
66 num_callback_valid_called_(0) {} 67 num_callback_valid_called_(0) {}
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 image_manager_->GetImageForURL(GURL(kTestUrl1), 217 image_manager_->GetImageForURL(GURL(kTestUrl1),
217 base::Bind(&ImageManagerTest::OnImageAvailable, 218 base::Bind(&ImageManagerTest::OnImageAvailable,
218 base::Unretained(this), &run_loop)); 219 base::Unretained(this), &run_loop));
219 run_loop.Run(); 220 run_loop.Run();
220 221
221 EXPECT_EQ(0, num_callback_null_called_); 222 EXPECT_EQ(0, num_callback_null_called_);
222 EXPECT_EQ(1, num_callback_valid_called_); 223 EXPECT_EQ(1, num_callback_valid_called_);
223 } 224 }
224 225
225 } // namespace suggestions 226 } // namespace suggestions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698