Alex Deymo | aea4c1c | 2015-08-19 20:24:43 -0700 | [diff] [blame] | 1 | // |
| 2 | // Copyright (C) 2012 The Android Open Source Project |
| 3 | // |
| 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | // you may not use this file except in compliance with the License. |
| 6 | // You may obtain a copy of the License at |
| 7 | // |
| 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | // |
| 10 | // Unless required by applicable law or agreed to in writing, software |
| 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | // See the License for the specific language governing permissions and |
| 14 | // limitations under the License. |
| 15 | // |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 16 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 17 | #ifndef UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_ |
| 18 | #define UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_ |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 19 | |
Alex Vakulenko | d2779df | 2014-06-16 13:19:00 -0700 | [diff] [blame] | 20 | #include <string> |
| 21 | |
Alex Deymo | 8427b4a | 2014-11-05 14:00:32 -0800 | [diff] [blame] | 22 | #include <gmock/gmock.h> |
| 23 | |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 24 | #include "update_engine/omaha_request_action.h" |
| 25 | #include "update_engine/payload_state_interface.h" |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 26 | |
| 27 | namespace chromeos_update_engine { |
| 28 | |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 29 | class MockPayloadState: public PayloadStateInterface { |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 30 | public: |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 31 | bool Initialize(SystemState* system_state) { |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 32 | return true; |
| 33 | } |
| 34 | |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 35 | // Significant methods. |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 36 | MOCK_METHOD1(SetResponse, void(const OmahaResponse& response)); |
| 37 | MOCK_METHOD0(DownloadComplete, void()); |
| 38 | MOCK_METHOD1(DownloadProgress, void(size_t count)); |
Chris Sosa | be45bef | 2013-04-09 18:25:12 -0700 | [diff] [blame] | 39 | MOCK_METHOD0(UpdateResumed, void()); |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 40 | MOCK_METHOD0(UpdateRestarted, void()); |
David Zeuthen | 9a017f2 | 2013-04-11 16:10:26 -0700 | [diff] [blame] | 41 | MOCK_METHOD0(UpdateSucceeded, void()); |
David Zeuthen | a99981f | 2013-04-29 13:42:47 -0700 | [diff] [blame] | 42 | MOCK_METHOD1(UpdateFailed, void(ErrorCode error)); |
Alex Deymo | 4243291 | 2013-07-12 20:21:15 -0700 | [diff] [blame] | 43 | MOCK_METHOD0(ResetUpdateStatus, void()); |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 44 | MOCK_METHOD0(ShouldBackoffDownload, bool()); |
David Zeuthen | e4c58bf | 2013-06-18 17:26:50 -0700 | [diff] [blame] | 45 | MOCK_METHOD0(UpdateEngineStarted, void()); |
Chris Sosa | aa18e16 | 2013-06-20 13:20:30 -0700 | [diff] [blame] | 46 | MOCK_METHOD0(Rollback, void()); |
Alex Deymo | 4243291 | 2013-07-12 20:21:15 -0700 | [diff] [blame] | 47 | MOCK_METHOD1(ExpectRebootInNewVersion, |
| 48 | void(const std::string& target_version_uid)); |
David Zeuthen | bb8bdc7 | 2013-09-03 13:43:48 -0700 | [diff] [blame] | 49 | MOCK_METHOD0(P2PNewAttempt, void()); |
| 50 | MOCK_METHOD0(P2PAttemptAllowed, bool()); |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 51 | MOCK_METHOD1(SetUsingP2PForDownloading, void(bool value)); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 52 | MOCK_METHOD1(SetUsingP2PForSharing, void(bool value)); |
Gilad Arnold | 519cfc7 | 2014-10-02 10:34:54 -0700 | [diff] [blame] | 53 | MOCK_METHOD1(SetScatteringWaitPeriod, void(base::TimeDelta)); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 54 | MOCK_METHOD1(SetP2PUrl, void(const std::string&)); |
Sen Jiang | 6c73668 | 2017-03-10 15:01:36 -0800 | [diff] [blame] | 55 | MOCK_METHOD0(NextPayload, bool()); |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 56 | |
| 57 | // Getters. |
| 58 | MOCK_METHOD0(GetResponseSignature, std::string()); |
Alex Deymo | 820cc70 | 2013-06-28 15:43:46 -0700 | [diff] [blame] | 59 | MOCK_METHOD0(GetPayloadAttemptNumber, int()); |
| 60 | MOCK_METHOD0(GetFullPayloadAttemptNumber, int()); |
Jay Srinivasan | 53173b9 | 2013-05-17 17:13:01 -0700 | [diff] [blame] | 61 | MOCK_METHOD0(GetCurrentUrl, std::string()); |
Jay Srinivasan | 2b5a0f0 | 2012-12-19 17:25:56 -0800 | [diff] [blame] | 62 | MOCK_METHOD0(GetUrlFailureCount, uint32_t()); |
David Zeuthen | cc6f996 | 2013-04-18 11:57:24 -0700 | [diff] [blame] | 63 | MOCK_METHOD0(GetUrlSwitchCount, uint32_t()); |
David Zeuthen | a573d6f | 2013-06-14 16:13:36 -0700 | [diff] [blame] | 64 | MOCK_METHOD0(GetNumResponsesSeen, int()); |
Jay Srinivasan | 0826288 | 2012-12-28 19:29:43 -0800 | [diff] [blame] | 65 | MOCK_METHOD0(GetBackoffExpiryTime, base::Time()); |
David Zeuthen | 9a017f2 | 2013-04-11 16:10:26 -0700 | [diff] [blame] | 66 | MOCK_METHOD0(GetUpdateDuration, base::TimeDelta()); |
| 67 | MOCK_METHOD0(GetUpdateDurationUptime, base::TimeDelta()); |
Jay Srinivasan | 19409b7 | 2013-04-12 19:23:36 -0700 | [diff] [blame] | 68 | MOCK_METHOD1(GetCurrentBytesDownloaded, uint64_t(DownloadSource source)); |
| 69 | MOCK_METHOD1(GetTotalBytesDownloaded, uint64_t(DownloadSource source)); |
Chris Sosa | be45bef | 2013-04-09 18:25:12 -0700 | [diff] [blame] | 70 | MOCK_METHOD0(GetNumReboots, uint32_t()); |
Chris Sosa | aa18e16 | 2013-06-20 13:20:30 -0700 | [diff] [blame] | 71 | MOCK_METHOD0(GetRollbackVersion, std::string()); |
David Zeuthen | bb8bdc7 | 2013-09-03 13:43:48 -0700 | [diff] [blame] | 72 | MOCK_METHOD0(GetP2PNumAttempts, int()); |
| 73 | MOCK_METHOD0(GetP2PFirstAttemptTimestamp, base::Time()); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 74 | MOCK_CONST_METHOD0(GetUsingP2PForDownloading, bool()); |
| 75 | MOCK_CONST_METHOD0(GetUsingP2PForSharing, bool()); |
Gilad Arnold | 519cfc7 | 2014-10-02 10:34:54 -0700 | [diff] [blame] | 76 | MOCK_METHOD0(GetScatteringWaitPeriod, base::TimeDelta()); |
Gilad Arnold | 74b5f55 | 2014-10-07 08:17:16 -0700 | [diff] [blame] | 77 | MOCK_CONST_METHOD0(GetP2PUrl, std::string()); |
Jay Srinivasan | 6f6ea00 | 2012-12-14 11:26:28 -0800 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | } // namespace chromeos_update_engine |
| 81 | |
Gilad Arnold | cf175a0 | 2014-07-10 16:48:47 -0700 | [diff] [blame] | 82 | #endif // UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H_ |