1 /* 2 * Copyright (C) 2016 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 #ifndef NVRAM_TEST_FAKE_STORAGE_H_ 18 #define NVRAM_TEST_FAKE_STORAGE_H_ 19 20 #include <nvram/core/storage.h> 21 22 namespace nvram { 23 namespace storage { 24 25 // Setup the header storage read functions to return Status::kStorageError. 26 void SetHeaderReadError(bool error); 27 28 // Setup the header storage write functions to return Status::kStorageError. 29 void SetHeaderWriteError(bool error); 30 31 // Setup the storage read calls for space |index| to return 32 // Status::kStorageError. 33 void SetSpaceReadError(uint32_t index, bool error); 34 35 // Setup the storage write calls for space |index| to return 36 // Status::kStorageError. 37 void SetSpaceWriteError(uint32_t index, bool error); 38 39 // Clears all storage. 40 void Clear(); 41 42 } // namespace storage 43 } // namespace nvram 44 45 #endif // NVRAM_TEST_FAKE_STORAGE_H_ 46