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.
5 #ifndef CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_
6 #define CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_
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"
18 class MockDownloadItem
: public DownloadItem
{
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(GetTabUrl
, const GURL
&());
45 MOCK_CONST_METHOD0(GetTabReferrerUrl
, const GURL
&());
46 MOCK_CONST_METHOD0(GetSuggestedFilename
, std::string());
47 MOCK_CONST_METHOD0(GetContentDisposition
, std::string());
48 MOCK_CONST_METHOD0(GetMimeType
, std::string());
49 MOCK_CONST_METHOD0(GetOriginalMimeType
, std::string());
50 MOCK_CONST_METHOD0(GetReferrerCharset
, std::string());
51 MOCK_CONST_METHOD0(GetRemoteAddress
, std::string());
52 MOCK_CONST_METHOD0(HasUserGesture
, bool());
53 MOCK_CONST_METHOD0(GetTransitionType
, PageTransition());
54 MOCK_CONST_METHOD0(GetLastModifiedTime
, const std::string
&());
55 MOCK_CONST_METHOD0(GetETag
, const std::string
&());
56 MOCK_CONST_METHOD0(IsSavePackageDownload
, bool());
57 MOCK_CONST_METHOD0(GetFullPath
, const base::FilePath
&());
58 MOCK_CONST_METHOD0(GetTargetFilePath
, const base::FilePath
&());
59 MOCK_CONST_METHOD0(GetForcedFilePath
, const base::FilePath
&());
60 MOCK_CONST_METHOD0(GetFileNameToReportUser
, base::FilePath());
61 MOCK_CONST_METHOD0(GetTargetDisposition
, TargetDisposition());
62 MOCK_CONST_METHOD0(GetHash
, const std::string
&());
63 MOCK_CONST_METHOD0(GetHashState
, const std::string
&());
64 MOCK_CONST_METHOD0(GetFileExternallyRemoved
, bool());
65 MOCK_METHOD1(DeleteFile
, void(const base::Callback
<void(bool)>&));
66 MOCK_CONST_METHOD0(IsDangerous
, bool());
67 MOCK_CONST_METHOD0(GetDangerType
, DownloadDangerType());
68 MOCK_CONST_METHOD1(TimeRemaining
, bool(base::TimeDelta
*));
69 MOCK_CONST_METHOD0(CurrentSpeed
, int64());
70 MOCK_CONST_METHOD0(PercentComplete
, int());
71 MOCK_CONST_METHOD0(AllDataSaved
, bool());
72 MOCK_CONST_METHOD0(GetTotalBytes
, int64());
73 MOCK_CONST_METHOD0(GetReceivedBytes
, int64());
74 MOCK_CONST_METHOD0(GetStartTime
, base::Time());
75 MOCK_CONST_METHOD0(GetEndTime
, base::Time());
76 MOCK_METHOD0(CanShowInFolder
, bool());
77 MOCK_METHOD0(CanOpenDownload
, bool());
78 MOCK_METHOD0(ShouldOpenFileBasedOnExtension
, bool());
79 MOCK_CONST_METHOD0(GetOpenWhenComplete
, bool());
80 MOCK_METHOD0(GetAutoOpened
, bool());
81 MOCK_CONST_METHOD0(GetOpened
, bool());
82 MOCK_CONST_METHOD0(GetBrowserContext
, BrowserContext
*());
83 MOCK_CONST_METHOD0(GetWebContents
, WebContents
*());
84 MOCK_METHOD1(OnContentCheckCompleted
, void(DownloadDangerType
));
85 MOCK_METHOD1(SetOpenWhenComplete
, void(bool));
86 MOCK_METHOD1(SetIsTemporary
, void(bool));
87 MOCK_METHOD1(SetOpened
, void(bool));
88 MOCK_METHOD1(SetDisplayName
, void(const base::FilePath
&));
89 MOCK_CONST_METHOD1(DebugString
, std::string(bool));
92 } // namespace content
94 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_