1# Copyright 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 5from mock_file_system import MockFileSystem 6from test_file_system import TestFileSystem 7from third_party.json_schema_compiler.memoize import memoize 8 9class FakeHostFileSystemProvider(object): 10 11 def __init__(self, file_system_data): 12 self._file_system_data = file_system_data 13 14 def GetTrunk(self): 15 return self.GetBranch('trunk') 16 17 @memoize 18 def GetBranch(self, branch): 19 return MockFileSystem(TestFileSystem(self._file_system_data[str(branch)])) 20