Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / content / public / test / mock_download_item.h
blob7d4ec363b980f798dbfd08bee02189619438d4fe
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/observer_list.h"
10 #include "base/time/time.h"
11 #include "content/public/browser/download_interrupt_reasons.h"
12 #include "content/public/browser/download_item.h"
13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "url/gurl.h"
17 namespace content {
19 class MockDownloadItem : public DownloadItem {
20 public:
21 MockDownloadItem();
22 ~MockDownloadItem() override;
24 // Management of observer lists is common in tests. So Add/RemoveObserver
25 // methods are not mocks. In addition, any registered observers will receive a
26 // OnDownloadDestroyed() notification when the mock is destroyed.
27 void AddObserver(Observer* observer) override;
28 void RemoveObserver(Observer* observer) override;
30 // Dispatches an OnDownloadOpened() notification to observers.
31 void NotifyObserversDownloadOpened();
32 // Dispatches an OnDownloadRemoved() notification to observers.
33 void NotifyObserversDownloadRemoved();
34 // Dispatches an OnDownloadUpdated() notification to observers.
35 void NotifyObserversDownloadUpdated();
37 MOCK_METHOD0(UpdateObservers, void());
38 MOCK_METHOD0(ValidateDangerousDownload, void());
39 MOCK_METHOD1(StealDangerousDownload, void(const AcquireFileCallback&));
40 MOCK_METHOD0(Pause, void());
41 MOCK_METHOD0(Resume, void());
42 MOCK_METHOD1(Cancel, void(bool));
43 MOCK_METHOD0(Remove, void());
44 MOCK_METHOD0(OpenDownload, void());
45 MOCK_METHOD0(ShowDownloadInShell, void());
46 MOCK_CONST_METHOD0(GetId, uint32());
47 MOCK_CONST_METHOD0(GetState, DownloadState());
48 MOCK_CONST_METHOD0(GetLastReason, DownloadInterruptReason());
49 MOCK_CONST_METHOD0(IsPaused, bool());
50 MOCK_CONST_METHOD0(IsTemporary, bool());
51 MOCK_CONST_METHOD0(CanResume, bool());
52 MOCK_CONST_METHOD0(IsDone, bool());
53 MOCK_CONST_METHOD0(GetURL, const GURL&());
54 MOCK_CONST_METHOD0(GetUrlChain, const std::vector<GURL>&());
55 MOCK_CONST_METHOD0(GetOriginalUrl, const GURL&());
56 MOCK_CONST_METHOD0(GetReferrerUrl, const GURL&());
57 MOCK_CONST_METHOD0(GetTabUrl, const GURL&());
58 MOCK_CONST_METHOD0(GetTabReferrerUrl, const GURL&());
59 MOCK_CONST_METHOD0(GetSuggestedFilename, std::string());
60 MOCK_CONST_METHOD0(GetContentDisposition, std::string());
61 MOCK_CONST_METHOD0(GetMimeType, std::string());
62 MOCK_CONST_METHOD0(GetOriginalMimeType, std::string());
63 MOCK_CONST_METHOD0(GetReferrerCharset, std::string());
64 MOCK_CONST_METHOD0(GetRemoteAddress, std::string());
65 MOCK_CONST_METHOD0(HasUserGesture, bool());
66 MOCK_CONST_METHOD0(GetTransitionType, ui::PageTransition());
67 MOCK_CONST_METHOD0(GetLastModifiedTime, const std::string&());
68 MOCK_CONST_METHOD0(GetETag, const std::string&());
69 MOCK_CONST_METHOD0(IsSavePackageDownload, bool());
70 MOCK_CONST_METHOD0(GetFullPath, const base::FilePath&());
71 MOCK_CONST_METHOD0(GetTargetFilePath, const base::FilePath&());
72 MOCK_CONST_METHOD0(GetForcedFilePath, const base::FilePath&());
73 MOCK_CONST_METHOD0(GetFileNameToReportUser, base::FilePath());
74 MOCK_CONST_METHOD0(GetTargetDisposition, TargetDisposition());
75 MOCK_CONST_METHOD0(GetHash, const std::string&());
76 MOCK_CONST_METHOD0(GetHashState, const std::string&());
77 MOCK_CONST_METHOD0(GetFileExternallyRemoved, bool());
78 MOCK_METHOD1(DeleteFile, void(const base::Callback<void(bool)>&));
79 MOCK_CONST_METHOD0(IsDangerous, bool());
80 MOCK_CONST_METHOD0(GetDangerType, DownloadDangerType());
81 MOCK_CONST_METHOD1(TimeRemaining, bool(base::TimeDelta*));
82 MOCK_CONST_METHOD0(CurrentSpeed, int64());
83 MOCK_CONST_METHOD0(PercentComplete, int());
84 MOCK_CONST_METHOD0(AllDataSaved, bool());
85 MOCK_CONST_METHOD0(GetTotalBytes, int64());
86 MOCK_CONST_METHOD0(GetReceivedBytes, int64());
87 MOCK_CONST_METHOD0(GetStartTime, base::Time());
88 MOCK_CONST_METHOD0(GetEndTime, base::Time());
89 MOCK_METHOD0(CanShowInFolder, bool());
90 MOCK_METHOD0(CanOpenDownload, bool());
91 MOCK_METHOD0(ShouldOpenFileBasedOnExtension, bool());
92 MOCK_CONST_METHOD0(GetOpenWhenComplete, bool());
93 MOCK_METHOD0(GetAutoOpened, bool());
94 MOCK_CONST_METHOD0(GetOpened, bool());
95 MOCK_CONST_METHOD0(GetBrowserContext, BrowserContext*());
96 MOCK_CONST_METHOD0(GetWebContents, WebContents*());
97 MOCK_METHOD1(OnContentCheckCompleted, void(DownloadDangerType));
98 MOCK_METHOD1(SetOpenWhenComplete, void(bool));
99 MOCK_METHOD1(SetIsTemporary, void(bool));
100 MOCK_METHOD1(SetOpened, void(bool));
101 MOCK_METHOD1(SetDisplayName, void(const base::FilePath&));
102 MOCK_CONST_METHOD1(DebugString, std::string(bool));
104 private:
105 base::ObserverList<Observer> observers_;
108 } // namespace content
110 #endif // CONTENT_PUBLIC_TEST_MOCK_DOWNLOAD_ITEM_H_