1 // 2 // Copyright (C) 2021 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 // 16 17 #pragma once 18 19 #include <memory> 20 21 #include <gmock/gmock.h> 22 #include <libsnapshot/snapshot_stats.h> 23 24 namespace android::snapshot { 25 26 class MockSnapshotMergeStats final : public ISnapshotMergeStats { 27 public: 28 virtual ~MockSnapshotMergeStats() = default; 29 // Called when merge starts or resumes. 30 MOCK_METHOD(bool, Start, (), (override)); 31 MOCK_METHOD(void, set_state, (android::snapshot::UpdateState), (override)); 32 MOCK_METHOD(void, set_boot_complete_time_ms, (uint32_t), (override)); 33 MOCK_METHOD(void, set_boot_complete_to_merge_start_time_ms, (uint32_t), (override)); 34 MOCK_METHOD(void, set_merge_failure_code, (MergeFailureCode), (override)); 35 MOCK_METHOD(void, set_source_build_fingerprint, (const std::string&), (override)); 36 MOCK_METHOD(uint64_t, cow_file_size, (), (override)); 37 MOCK_METHOD(uint64_t, total_cow_size_bytes, (), (override)); 38 MOCK_METHOD(uint64_t, estimated_cow_size_bytes, (), (override)); 39 MOCK_METHOD(uint32_t, boot_complete_time_ms, (), (override)); 40 MOCK_METHOD(uint32_t, boot_complete_to_merge_start_time_ms, (), (override)); 41 MOCK_METHOD(std::string, source_build_fingerprint, (), (override)); 42 MOCK_METHOD(MergeFailureCode, merge_failure_code, (), (override)); 43 MOCK_METHOD(std::unique_ptr<Result>, Finish, (), (override)); 44 MOCK_METHOD(bool, WriteState, (), (override)); 45 MOCK_METHOD(SnapshotMergeReport*, report, (), (override)); 46 47 using ISnapshotMergeStats::Result; 48 // Return nullptr if any failure. 49 }; 50 51 } // namespace android::snapshot 52