blob: 8d1edf5c22c0439c550c1a4220b222c7fb3fd349 [file] [log] [blame]
Jay Srinivasan6f6ea002012-12-14 11:26:28 -08001// 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 Srinivasan2b5a0f02012-12-19 17:25:56 -08009#include "update_engine/omaha_request_action.h"
10#include "update_engine/payload_state_interface.h"
Jay Srinivasan6f6ea002012-12-14 11:26:28 -080011
12namespace chromeos_update_engine {
13
Jay Srinivasan2b5a0f02012-12-19 17:25:56 -080014class MockPayloadState: public PayloadStateInterface {
Jay Srinivasan6f6ea002012-12-14 11:26:28 -080015 public:
Jay Srinivasan19409b72013-04-12 19:23:36 -070016 bool Initialize(SystemState* system_state) {
Jay Srinivasan2b5a0f02012-12-19 17:25:56 -080017 return true;
18 }
19
Jay Srinivasan08262882012-12-28 19:29:43 -080020 // Significant methods.
Jay Srinivasan2b5a0f02012-12-19 17:25:56 -080021 MOCK_METHOD1(SetResponse, void(const OmahaResponse& response));
22 MOCK_METHOD0(DownloadComplete, void());
23 MOCK_METHOD1(DownloadProgress, void(size_t count));
Chris Sosabe45bef2013-04-09 18:25:12 -070024 MOCK_METHOD0(UpdateResumed, void());
Jay Srinivasan19409b72013-04-12 19:23:36 -070025 MOCK_METHOD0(UpdateRestarted, void());
David Zeuthen9a017f22013-04-11 16:10:26 -070026 MOCK_METHOD0(UpdateSucceeded, void());
David Zeuthena99981f2013-04-29 13:42:47 -070027 MOCK_METHOD1(UpdateFailed, void(ErrorCode error));
Jay Srinivasan08262882012-12-28 19:29:43 -080028 MOCK_METHOD0(ShouldBackoffDownload, bool());
29
30 // Getters.
31 MOCK_METHOD0(GetResponseSignature, std::string());
Jay Srinivasan2b5a0f02012-12-19 17:25:56 -080032 MOCK_METHOD0(GetPayloadAttemptNumber, uint32_t());
Jay Srinivasan53173b92013-05-17 17:13:01 -070033 MOCK_METHOD0(GetCurrentUrl, std::string());
Jay Srinivasan2b5a0f02012-12-19 17:25:56 -080034 MOCK_METHOD0(GetUrlFailureCount, uint32_t());
David Zeuthencc6f9962013-04-18 11:57:24 -070035 MOCK_METHOD0(GetUrlSwitchCount, uint32_t());
David Zeuthena573d6f2013-06-14 16:13:36 -070036 MOCK_METHOD0(GetNumResponsesSeen, int());
Jay Srinivasan08262882012-12-28 19:29:43 -080037 MOCK_METHOD0(GetBackoffExpiryTime, base::Time());
David Zeuthen9a017f22013-04-11 16:10:26 -070038 MOCK_METHOD0(GetUpdateDuration, base::TimeDelta());
39 MOCK_METHOD0(GetUpdateDurationUptime, base::TimeDelta());
Jay Srinivasan19409b72013-04-12 19:23:36 -070040 MOCK_METHOD1(GetCurrentBytesDownloaded, uint64_t(DownloadSource source));
41 MOCK_METHOD1(GetTotalBytesDownloaded, uint64_t(DownloadSource source));
Chris Sosabe45bef2013-04-09 18:25:12 -070042 MOCK_METHOD0(GetNumReboots, uint32_t());
Jay Srinivasan6f6ea002012-12-14 11:26:28 -080043};
44
45} // namespace chromeos_update_engine
46
47#endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_PAYLOAD_STATE_H__