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