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

Side by Side Diff: components/precache/core/fetcher_pool_unittest.cc

Issue 2378173002: Precache per-resource cap should be applied on network bytes used (Closed)
Patch Set: Created 4 years, 2 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/precache/core/fetcher_pool.h" 5 #include "components/precache/core/fetcher_pool.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <array> 8 #include <array>
9 #include <functional> 9 #include <functional>
10 #include <list> 10 #include <list>
(...skipping 21 matching lines...) Expand all
32 using net::URLRequestStatus; 32 using net::URLRequestStatus;
33 using ::testing::_; 33 using ::testing::_;
34 using ::testing::Invoke; 34 using ::testing::Invoke;
35 35
36 class MockURLFetcherDelegate : public net::URLFetcherDelegate { 36 class MockURLFetcherDelegate : public net::URLFetcherDelegate {
37 public: 37 public:
38 MockURLFetcherDelegate() {}; 38 MockURLFetcherDelegate() {};
39 virtual ~MockURLFetcherDelegate() {}; 39 virtual ~MockURLFetcherDelegate() {};
40 40
41 MOCK_METHOD1(OnURLFetchComplete, void(const URLFetcher*)); 41 MOCK_METHOD1(OnURLFetchComplete, void(const URLFetcher*));
42 MOCK_METHOD3(OnURLFetchDownloadProgress, 42 MOCK_METHOD4(OnURLFetchDownloadProgress,
43 void(const URLFetcher* source, int64_t current, int64_t total)); 43 void(const URLFetcher* source,
44 int64_t current,
45 int64_t total,
46 int64_t current_network_bytes));
44 MOCK_METHOD3(OnURLFetchUploadProgress, 47 MOCK_METHOD3(OnURLFetchUploadProgress,
45 void(const URLFetcher* source, int64_t current, int64_t total)); 48 void(const URLFetcher* source, int64_t current, int64_t total));
46 }; 49 };
47 50
48 TEST(FetcherPoolTest, AddDelete) { 51 TEST(FetcherPoolTest, AddDelete) {
49 // It also tests IsAvailable. 52 // It also tests IsAvailable.
50 base::MessageLoop loop; 53 base::MessageLoop loop;
51 MockURLFetcherDelegate delegate; 54 MockURLFetcherDelegate delegate;
52 std::unique_ptr<URLFetcher> url_fetcher( 55 std::unique_ptr<URLFetcher> url_fetcher(
53 new FakeURLFetcher(GURL("http://a.com"), &delegate, "irrelevant", HTTP_OK, 56 new FakeURLFetcher(GURL("http://a.com"), &delegate, "irrelevant", HTTP_OK,
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 214
212 base::RunLoop().RunUntilIdle(); 215 base::RunLoop().RunUntilIdle();
213 216
214 EXPECT_TRUE(pool.IsEmpty()); 217 EXPECT_TRUE(pool.IsEmpty());
215 EXPECT_TRUE(pool.IsAvailable()); 218 EXPECT_TRUE(pool.IsAvailable());
216 } 219 }
217 220
218 } // namespace 221 } // namespace
219 222
220 } // namespace precache 223 } // namespace precache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698