xref: /aosp_15_r20/external/federated-compute/fcp/client/cache/test_helpers.h (revision 14675a029014e728ec732f129a32e299b2da0601)
1*14675a02SAndroid Build Coastguard Worker // Copyright 2022 Google LLC
2*14675a02SAndroid Build Coastguard Worker //
3*14675a02SAndroid Build Coastguard Worker // Licensed under the Apache License, Version 2.0 (the "License");
4*14675a02SAndroid Build Coastguard Worker // you may not use this file except in compliance with the License.
5*14675a02SAndroid Build Coastguard Worker // You may obtain a copy of the License at
6*14675a02SAndroid Build Coastguard Worker //
7*14675a02SAndroid Build Coastguard Worker //      http://www.apache.org/licenses/LICENSE-2.0
8*14675a02SAndroid Build Coastguard Worker //
9*14675a02SAndroid Build Coastguard Worker // Unless required by applicable law or agreed to in writing, software
10*14675a02SAndroid Build Coastguard Worker // distributed under the License is distributed on an "AS IS" BASIS,
11*14675a02SAndroid Build Coastguard Worker // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*14675a02SAndroid Build Coastguard Worker // See the License for the specific language governing permissions and
13*14675a02SAndroid Build Coastguard Worker // limitations under the License.
14*14675a02SAndroid Build Coastguard Worker 
15*14675a02SAndroid Build Coastguard Worker #ifndef FCP_CLIENT_CACHE_TEST_HELPERS_H_
16*14675a02SAndroid Build Coastguard Worker #define FCP_CLIENT_CACHE_TEST_HELPERS_H_
17*14675a02SAndroid Build Coastguard Worker 
18*14675a02SAndroid Build Coastguard Worker #include "gmock/gmock.h"
19*14675a02SAndroid Build Coastguard Worker #include "gtest/gtest.h"
20*14675a02SAndroid Build Coastguard Worker #include "fcp/client/cache/resource_cache.h"
21*14675a02SAndroid Build Coastguard Worker 
22*14675a02SAndroid Build Coastguard Worker namespace fcp {
23*14675a02SAndroid Build Coastguard Worker namespace client {
24*14675a02SAndroid Build Coastguard Worker namespace cache {
25*14675a02SAndroid Build Coastguard Worker 
26*14675a02SAndroid Build Coastguard Worker // A mock `ResourceCache` implementation that can be used in tests.
27*14675a02SAndroid Build Coastguard Worker class MockResourceCache : public ResourceCache {
28*14675a02SAndroid Build Coastguard Worker  public:
29*14675a02SAndroid Build Coastguard Worker   MOCK_METHOD(absl::Status, Put,
30*14675a02SAndroid Build Coastguard Worker               (absl::string_view cache_id, const absl::Cord& resource,
31*14675a02SAndroid Build Coastguard Worker                const google::protobuf::Any& metadata, absl::Duration max_age),
32*14675a02SAndroid Build Coastguard Worker               (override));
33*14675a02SAndroid Build Coastguard Worker   MOCK_METHOD(absl::StatusOr<ResourceAndMetadata>, Get,
34*14675a02SAndroid Build Coastguard Worker               (absl::string_view cache_id,
35*14675a02SAndroid Build Coastguard Worker                std::optional<absl::Duration> max_age),
36*14675a02SAndroid Build Coastguard Worker               (override));
37*14675a02SAndroid Build Coastguard Worker };
38*14675a02SAndroid Build Coastguard Worker 
39*14675a02SAndroid Build Coastguard Worker }  // namespace cache
40*14675a02SAndroid Build Coastguard Worker }  // namespace client
41*14675a02SAndroid Build Coastguard Worker }  // namespace fcp
42*14675a02SAndroid Build Coastguard Worker 
43*14675a02SAndroid Build Coastguard Worker #endif  // FCP_CLIENT_CACHE_TEST_HELPERS_H_q
44