summaryrefslogtreecommitdiffstats
path: root/ios/chrome/browser/net/mock_image_fetcher.h
blob: 2b12af90c82a8a06b9386edbc85288997661f1d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef IOS_CHROME_BROWSER_NET_MOCK_IMAGE_FETCHER_H_
#define IOS_CHROME_BROWSER_NET_MOCK_IMAGE_FETCHER_H_

#import "ios/chrome/browser/net/image_fetcher.h"

#include "testing/gmock/include/gmock/gmock.h"

namespace image_fetcher {

// Mock the ImageFetcher utility class, which can be used to asynchronously
// retrieve an image from an URL.
class MockImageFetcher : public ImageFetcher {
 public:
  explicit MockImageFetcher(const scoped_refptr<base::TaskRunner>& task_runner);
  ~MockImageFetcher() override;

  MOCK_METHOD4(StartDownload,
               void(const GURL& url,
                    ImageFetchedCallback callback,
                    const std::string& referrer,
                    net::URLRequest::ReferrerPolicy referrer_policy));
  MOCK_METHOD2(StartDownload,
               void(const GURL& url, ImageFetchedCallback callback));
  MOCK_METHOD1(SetRequestContextGetter,
               void(const scoped_refptr<net::URLRequestContextGetter>&
                        request_context_getter));
};

}  // namespace image_fetcher

#endif  // IOS_CHROME_BROWSER_NET_MOCK_IMAGE_FETCHER_H_