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

Side by Side Diff: components/ntp_tiles/icon_cacher_impl_unittest.cc

Issue 2781473003: Add |SetImageDownloadLimit| to ImageFetcher to limit downloaded bytes (Closed)
Patch Set: Test fix: Mock pure virtual Setter in CrOS notification test 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ntp_tiles/icon_cacher_impl.h" 5 #include "components/ntp_tiles/icon_cacher_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 27 matching lines...) Expand all
38 38
39 namespace ntp_tiles { 39 namespace ntp_tiles {
40 namespace { 40 namespace {
41 41
42 class MockImageFetcher : public image_fetcher::ImageFetcher { 42 class MockImageFetcher : public image_fetcher::ImageFetcher {
43 public: 43 public:
44 MOCK_METHOD1(SetImageFetcherDelegate, 44 MOCK_METHOD1(SetImageFetcherDelegate,
45 void(image_fetcher::ImageFetcherDelegate* delegate)); 45 void(image_fetcher::ImageFetcherDelegate* delegate));
46 MOCK_METHOD1(SetDataUseServiceName, 46 MOCK_METHOD1(SetDataUseServiceName,
47 void(image_fetcher::ImageFetcher::DataUseServiceName name)); 47 void(image_fetcher::ImageFetcher::DataUseServiceName name));
48 MOCK_METHOD1(SetImageDownloadLimit,
49 void(base::Optional<int64_t> max_download_bytes));
48 MOCK_METHOD3(StartOrQueueNetworkRequest, 50 MOCK_METHOD3(StartOrQueueNetworkRequest,
49 void(const std::string& id, 51 void(const std::string& id,
50 const GURL& image_url, 52 const GURL& image_url,
51 const ImageFetcherCallback& callback)); 53 const ImageFetcherCallback& callback));
52 MOCK_METHOD1(SetDesiredImageFrameSize, void(const gfx::Size&)); 54 MOCK_METHOD1(SetDesiredImageFrameSize, void(const gfx::Size&));
53 MOCK_METHOD0(GetImageDecoder, image_fetcher::ImageDecoder*()); 55 MOCK_METHOD0(GetImageDecoder, image_fetcher::ImageDecoder*());
54 }; 56 };
55 57
56 class MockImageDecoder : public image_fetcher::ImageDecoder { 58 class MockImageDecoder : public image_fetcher::ImageDecoder {
57 public: 59 public:
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 Eq(gfx::Size(64, 64))); // Compares dimensions, not objects. 347 Eq(gfx::Size(64, 64))); // Compares dimensions, not objects.
346 348
347 // Let the fetcher continue and wait for the second call of the callback. 349 // Let the fetcher continue and wait for the second call of the callback.
348 fetch_loop.Run(); // Wait for the updated image. 350 fetch_loop.Run(); // Wait for the updated image.
349 EXPECT_THAT(GetCachedIconFor(site_.url, favicon_base::TOUCH_ICON).Size(), 351 EXPECT_THAT(GetCachedIconFor(site_.url, favicon_base::TOUCH_ICON).Size(),
350 Eq(gfx::Size(128, 128))); // Compares dimensions, not objects. 352 Eq(gfx::Size(128, 128))); // Compares dimensions, not objects.
351 } 353 }
352 354
353 } // namespace 355 } // namespace
354 } // namespace ntp_tiles 356 } // namespace ntp_tiles
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698