OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef IOS_CHROME_BROWSER_NET_MOCK_IMAGE_FETCHER_H_ | 5 #ifndef IOS_CHROME_BROWSER_NET_IMAGE_FETCHER_MOCK_IMAGE_FETCHER_H_ |
6 #define IOS_CHROME_BROWSER_NET_MOCK_IMAGE_FETCHER_H_ | 6 #define IOS_CHROME_BROWSER_NET_IMAGE_FETCHER_MOCK_IMAGE_FETCHER_H_ |
7 | 7 |
8 #import "ios/chrome/browser/net/image_fetcher.h" | 8 #import "ios/chrome/browser/net/image_fetcher/image_fetcher.h" |
9 | 9 |
10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
11 | 11 |
12 // Mock the ImageFetcher utility class, which can be used to asynchronously | 12 // Mock the ImageFetcher utility class, which can be used to asynchronously |
13 // retrieve an image from an URL. | 13 // retrieve an image from an URL. |
14 class MockImageFetcher : public ImageFetcher { | 14 class MockImageFetcher : public ImageFetcher { |
15 public: | 15 public: |
16 explicit MockImageFetcher(const scoped_refptr<base::TaskRunner>& task_runner); | 16 explicit MockImageFetcher(const scoped_refptr<base::TaskRunner>& task_runner); |
17 ~MockImageFetcher() override; | 17 ~MockImageFetcher() override; |
18 | 18 |
19 MOCK_METHOD4(StartDownload, | 19 MOCK_METHOD4(StartDownload, |
20 void(const GURL& url, | 20 void(const GURL& url, |
21 ImageFetchedCallback callback, | 21 ImageFetchedCallback callback, |
22 const std::string& referrer, | 22 const std::string& referrer, |
23 net::URLRequest::ReferrerPolicy referrer_policy)); | 23 net::URLRequest::ReferrerPolicy referrer_policy)); |
24 MOCK_METHOD2(StartDownload, | 24 MOCK_METHOD2(StartDownload, |
25 void(const GURL& url, ImageFetchedCallback callback)); | 25 void(const GURL& url, ImageFetchedCallback callback)); |
26 MOCK_METHOD1(SetRequestContextGetter, | 26 MOCK_METHOD1(SetRequestContextGetter, |
27 void(const scoped_refptr<net::URLRequestContextGetter>& | 27 void(const scoped_refptr<net::URLRequestContextGetter>& |
28 request_context_getter)); | 28 request_context_getter)); |
29 }; | 29 }; |
30 | 30 |
31 #endif // IOS_CHROME_BROWSER_NET_MOCK_IMAGE_FETCHER_H_ | 31 #endif // IOS_CHROME_BROWSER_NET_IMAGE_FETCHER_MOCK_IMAGE_FETCHER_H_ |
OLD | NEW |