1 // Copyright (c) 2013 The Chromium 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 CRAZY_LINKER_SYSTEM_MOCK_H 6 #define CRAZY_LINKER_SYSTEM_MOCK_H 7 8 #include <stdint.h> 9 10 namespace crazy { 11 12 class SystemMock { 13 public: 14 // Create a new mock system instance and make ScopedFileDescriptor use it. 15 // There can be only one mock system active at a given time. 16 SystemMock(); 17 18 // Destroy a mock system instance. 19 ~SystemMock(); 20 21 // Add a regular file to the mock file system. |path| is the entry's 22 // path, and |data| and |data_size| are the data there. The data must 23 // stay valid until the mock file system is destroyed. 24 void AddRegularFile(const char* path, const char* data, size_t data_size); 25 26 void AddEnvVariable(const char* var_name, const char* var_value); 27 28 void SetCurrentDir(const char* path); 29 }; 30 31 } // namespace crazy 32 33 #endif // CRAZY_LINKER_SYSTEM_MOCK_H 34