summaryrefslogtreecommitdiffstats
path: root/chrome/browser/android/download/mock_download_controller_android.h
blob: d74e7dfe6c524ced40e82635016cc7efa6bdfffa (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 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 CHROME_BROWSER_ANDROID_DOWNLOAD_MOCK_DOWNLOAD_CONTROLLER_ANDROID_H_
#define CHROME_BROWSER_ANDROID_DOWNLOAD_MOCK_DOWNLOAD_CONTROLLER_ANDROID_H_

#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "content/public/browser/android/download_controller_android.h"

namespace content {
class DownloadItem;
class WebContents;
}  // namespace content

namespace chrome {
namespace android {

// Mock implementation of the DownloadControllerAndroid.
class MockDownloadControllerAndroid
    : public content::DownloadControllerAndroid {
 public:
  MockDownloadControllerAndroid();
  ~MockDownloadControllerAndroid() override;

  // DownloadControllerAndroid implementation.
  void CreateGETDownload(int render_process_id, int render_view_id,
                         int request_id) override;
  void OnDownloadStarted(content::DownloadItem* download_item) override;
  void StartContextMenuDownload(
      const content::ContextMenuParams& params,
      content::WebContents* web_contents,
      bool is_link, const std::string& extra_headers) override;
  void DangerousDownloadValidated(content::WebContents* web_contents,
                                  const std::string& download_guid,
                                  bool accept) override;
  void AcquireFileAccessPermission(
      content::WebContents* web_contents,
      const AcquireFileAccessPermissionCallback& callback) override;
  void SetApproveFileAccessRequestForTesting(bool approve) override;

 private:
  bool approve_file_access_request_;
  DISALLOW_COPY_AND_ASSIGN(MockDownloadControllerAndroid);
};

}  // namespace android
}  // namespace chrome


#endif  // CHROME_BROWSER_ANDROID_DOWNLOAD_MOCK_DOWNLOAD_CONTROLLER_ANDROID_H_