Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS 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 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 5 | #ifndef UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_ |
| 6 | #define UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_ |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 7 | |
Alex Vakulenko | d2779df | 2014-06-16 13:19:00 -0700 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 10 | #include "gmock/gmock.h" |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 11 | #include "update_engine/omaha_request_action.h" |
| 12 | #include "update_engine/payload_state_interface.h" |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 13 | |
| 14 | namespace chromeos_update_engine { |
| 15 | |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 16 | class MockPayloadState: public PayloadStateInterface { |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 17 | public: |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 18 | bool Initialize(SystemState* system_state) { |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 19 | return true; |
| 20 | } |
| 21 | |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 22 | // Significant methods. |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 23 | MOCK_METHOD1(SetResponse, void(const OmahaResponse& response)); |
| 24 | MOCK_METHOD0(DownloadComplete, void()); |
| 25 | MOCK_METHOD1(DownloadProgress, void(size_t count)); |
Chris Sosa | be45bef | 2013-04-09 18:25:12 -0700 | [diff] [blame] | 26 | MOCK_METHOD0(UpdateResumed, void()); |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 27 | MOCK_METHOD0(UpdateRestarted, void()); |
David Zeuthen | 9a017f2 | 2013-04-11 16:10:26 -0700 | [diff] [blame] | 28 | MOCK_METHOD0(UpdateSucceeded, void()); |
David Zeuthen | a99981f | 2013-04-29 13:42:47 -0700 | [diff] [blame] | 29 | MOCK_METHOD1(UpdateFailed, void(ErrorCode error)); |
Alex Deymo | 4243291 | 2013-07-12 20:21:15 -0700 | [diff] [blame] | 30 | MOCK_METHOD0(ResetUpdateStatus, void()); |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 31 | MOCK_METHOD0(ShouldBackoffDownload, bool()); |
David Zeuthen | e4c58bf | 2013-06-18 17:26:50 -0700 | [diff] [blame] | 32 | MOCK_METHOD0(UpdateEngineStarted, void()); |
Chris Sosa | aa18e16 | 2013-06-20 13:20:30 -0700 | [diff] [blame] | 33 | MOCK_METHOD0(Rollback, void()); |
Alex Deymo | 4243291 | 2013-07-12 20:21:15 -0700 | [diff] [blame] | 34 | MOCK_METHOD1(ExpectRebootInNewVersion, |
| 35 | void(const std::string& target_version_uid)); |
David Zeuthen | bb8bdc7 | 2013-09-03 13:43:48 -0700 | [diff] [blame] | 36 | MOCK_METHOD0(P2PNewAttempt, void()); |
| 37 | MOCK_METHOD0(P2PAttemptAllowed, bool()); |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 38 | MOCK_METHOD1(SetUsingP2PForDownloading, void(bool value)); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 39 | MOCK_METHOD1(SetUsingP2PForSharing, void(bool value)); |
Gilad Arnold | 519cfc7 | 2014-10-02 10:34:54 -0700 | [diff] [blame] | 40 | MOCK_METHOD1(SetScatteringWaitPeriod, void(base::TimeDelta)); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 41 | MOCK_METHOD1(SetP2PUrl, void(const std::string&)); |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 42 | |
| 43 | // Getters. |
| 44 | MOCK_METHOD0(GetResponseSignature, std::string()); |
Alex Deymo | 820cc70 | 2013-06-28 15:43:46 -0700 | [diff] [blame] | 45 | MOCK_METHOD0(GetPayloadAttemptNumber, int()); |
| 46 | MOCK_METHOD0(GetFullPayloadAttemptNumber, int()); |
Jay Srinivasan | 53173b9 | 2013-05-17 17:13:01 -0700 | [diff] [blame] | 47 | MOCK_METHOD0(GetCurrentUrl, std::string()); |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 48 | MOCK_METHOD0(GetUrlFailureCount, uint32_t()); |
David Zeuthen | cc6f996 | 2013-04-18 11:57:24 -0700 | [diff] [blame] | 49 | MOCK_METHOD0(GetUrlSwitchCount, uint32_t()); |
David Zeuthen | a573d6f | 2013-06-14 16:13:36 -0700 | [diff] [blame] | 50 | MOCK_METHOD0(GetNumResponsesSeen, int()); |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 51 | MOCK_METHOD0(GetBackoffExpiryTime, base::Time()); |
David Zeuthen | 9a017f2 | 2013-04-11 16:10:26 -0700 | [diff] [blame] | 52 | MOCK_METHOD0(GetUpdateDuration, base::TimeDelta()); |
| 53 | MOCK_METHOD0(GetUpdateDurationUptime, base::TimeDelta()); |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 54 | MOCK_METHOD1(GetCurrentBytesDownloaded, uint64_t(DownloadSource source)); |
| 55 | MOCK_METHOD1(GetTotalBytesDownloaded, uint64_t(DownloadSource source)); |
Chris Sosa | be45bef | 2013-04-09 18:25:12 -0700 | [diff] [blame] | 56 | MOCK_METHOD0(GetNumReboots, uint32_t()); |
Chris Sosa | aa18e16 | 2013-06-20 13:20:30 -0700 | [diff] [blame] | 57 | MOCK_METHOD0(GetRollbackVersion, std::string()); |
David Zeuthen | bb8bdc7 | 2013-09-03 13:43:48 -0700 | [diff] [blame] | 58 | MOCK_METHOD0(GetP2PNumAttempts, int()); |
| 59 | MOCK_METHOD0(GetP2PFirstAttemptTimestamp, base::Time()); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 60 | MOCK_CONST_METHOD0(GetUsingP2PForDownloading, bool()); |
| 61 | MOCK_CONST_METHOD0(GetUsingP2PForSharing, bool()); |
Gilad Arnold | 519cfc7 | 2014-10-02 10:34:54 -0700 | [diff] [blame] | 62 | MOCK_METHOD0(GetScatteringWaitPeriod, base::TimeDelta()); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 63 | MOCK_CONST_METHOD0(GetP2PUrl, std::string()); |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // namespace chromeos_update_engine |
| 67 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 68 | #endif // UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_ |