• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_
6 #define CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_
7 
8 #include "base/callback.h"
9 #include "base/time/time.h"
10 #include "content/public/browser/download_interrupt_reasons.h"
11 #include "content/public/browser/download_item.h"
12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "url/gurl.h"
15 
16 namespace content {
17 
18 class MockDownloadItem : public DownloadItem {
19  public:
20   MockDownloadItem();
21   virtual ~MockDownloadItem();
22   MOCK_METHOD1(AddObserver, void(DownloadItem::Observer*));
23   MOCK_METHOD1(RemoveObserver, void(DownloadItem::Observer*));
24   MOCK_METHOD0(UpdateObservers, void());
25   MOCK_METHOD0(ValidateDangerousDownload, void());
26   MOCK_METHOD1(StealDangerousDownload, void(const AcquireFileCallback&));
27   MOCK_METHOD0(Pause, void());
28   MOCK_METHOD0(Resume, void());
29   MOCK_METHOD1(Cancel, void(bool));
30   MOCK_METHOD0(Remove, void());
31   MOCK_METHOD0(OpenDownload, void());
32   MOCK_METHOD0(ShowDownloadInShell, void());
33   MOCK_CONST_METHOD0(GetId, uint32());
34   MOCK_CONST_METHOD0(GetState, DownloadState());
35   MOCK_CONST_METHOD0(GetLastReason, DownloadInterruptReason());
36   MOCK_CONST_METHOD0(IsPaused, bool());
37   MOCK_CONST_METHOD0(IsTemporary, bool());
38   MOCK_CONST_METHOD0(CanResume, bool());
39   MOCK_CONST_METHOD0(IsDone, bool());
40   MOCK_CONST_METHOD0(GetURL, const GURL&());
41   MOCK_CONST_METHOD0(GetUrlChain, const std::vector<GURL>&());
42   MOCK_CONST_METHOD0(GetOriginalUrl, const GURL&());
43   MOCK_CONST_METHOD0(GetReferrerUrl, const GURL&());
44   MOCK_CONST_METHOD0(GetSuggestedFilename, std::string());
45   MOCK_CONST_METHOD0(GetContentDisposition, std::string());
46   MOCK_CONST_METHOD0(GetMimeType, std::string());
47   MOCK_CONST_METHOD0(GetOriginalMimeType, std::string());
48   MOCK_CONST_METHOD0(GetReferrerCharset, std::string());
49   MOCK_CONST_METHOD0(GetRemoteAddress, std::string());
50   MOCK_CONST_METHOD0(HasUserGesture, bool());
51   MOCK_CONST_METHOD0(GetTransitionType, PageTransition());
52   MOCK_CONST_METHOD0(GetLastModifiedTime, const std::string&());
53   MOCK_CONST_METHOD0(GetETag, const std::string&());
54   MOCK_CONST_METHOD0(IsSavePackageDownload, bool());
55   MOCK_CONST_METHOD0(GetFullPath, const base::FilePath&());
56   MOCK_CONST_METHOD0(GetTargetFilePath, const base::FilePath&());
57   MOCK_CONST_METHOD0(GetForcedFilePath, const base::FilePath&());
58   MOCK_CONST_METHOD0(GetFileNameToReportUser, base::FilePath());
59   MOCK_CONST_METHOD0(GetTargetDisposition, TargetDisposition());
60   MOCK_CONST_METHOD0(GetHash, const std::string&());
61   MOCK_CONST_METHOD0(GetHashState, const std::string&());
62   MOCK_CONST_METHOD0(GetFileExternallyRemoved, bool());
63   MOCK_METHOD0(DeleteFile, void());
64   MOCK_CONST_METHOD0(IsDangerous, bool());
65   MOCK_CONST_METHOD0(GetDangerType, DownloadDangerType());
66   MOCK_CONST_METHOD1(TimeRemaining, bool(base::TimeDelta*));
67   MOCK_CONST_METHOD0(CurrentSpeed, int64());
68   MOCK_CONST_METHOD0(PercentComplete, int());
69   MOCK_CONST_METHOD0(AllDataSaved, bool());
70   MOCK_CONST_METHOD0(GetTotalBytes, int64());
71   MOCK_CONST_METHOD0(GetReceivedBytes, int64());
72   MOCK_CONST_METHOD0(GetStartTime, base::Time());
73   MOCK_CONST_METHOD0(GetEndTime, base::Time());
74   MOCK_METHOD0(CanShowInFolder, bool());
75   MOCK_METHOD0(CanOpenDownload, bool());
76   MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool());
77   MOCK_CONST_METHOD0(GetOpenWhenComplete, bool());
78   MOCK_METHOD0(GetAutoOpened, bool());
79   MOCK_CONST_METHOD0(GetOpened, bool());
80   MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*());
81   MOCK_CONST_METHOD0(GetWebContents, WebContents*());
82   MOCK_METHOD1(OnContentCheckCompleted, void(DownloadDangerType));
83   MOCK_METHOD1(SetOpenWhenComplete, void(bool));
84   MOCK_METHOD1(SetIsTemporary, void(bool));
85   MOCK_METHOD1(SetOpened, void(bool));
86   MOCK_METHOD1(SetDisplayName, void(const base::FilePath&));
87   MOCK_CONST_METHOD1(DebugString, std::string(bool));
88 };
89 
90 }  // namespace content
91 
92 #endif  // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_
93