Index: tools/telemetry/telemetry/unittest_util/system_stub.py |
diff --git a/tools/telemetry/telemetry/unittest_util/system_stub.py b/tools/telemetry/telemetry/unittest_util/system_stub.py |
index 31f71f81d67d8218110062a3d3c54bbb78118757..61f739f727d7755779d8019418e1b5514d8cc8d7 100644 |
--- a/tools/telemetry/telemetry/unittest_util/system_stub.py |
+++ b/tools/telemetry/telemetry/unittest_util/system_stub.py |
@@ -285,6 +285,17 @@ class CloudStorageModuleStub(object): |
self, self.INTERNAL_BUCKET, remote_path, local_path, True) |
return result |
+ def GetFilesInDirectoryIfChanged(self, directory, bucket): |
+ if os.path.splitdrive(directory)[1] == '/': |
+ raise ValueError('Trying to serve root directory from HTTP server.') |
+ for dirpath, _, filenames in os.walk(directory): |
+ for filename in filenames: |
+ path, extension = os.path.splitext( |
+ os.path.join(dirpath, filename)) |
+ if extension != '.sha1': |
+ continue |
+ self.GetIfChanged(path, bucket) |
+ |
def CalculateHash(self, file_path): |
return self.local_file_hashes[file_path] |
@@ -389,6 +400,10 @@ class OsModuleStub(object): |
def splitext(path): |
return os.path.splitext(path) |
+ @staticmethod |
+ def splitdrive(path): |
+ return os.path.splitdrive(path) |
+ |
X_OK = os.X_OK |
pathsep = os.pathsep |
@@ -402,6 +417,7 @@ class OsModuleStub(object): |
self.program_files = None |
self.program_files_x86 = None |
self.devnull = os.devnull |
+ self._directory = {} |
def access(self, path, _): |
return path in self.path.files |
@@ -424,6 +440,10 @@ class OsModuleStub(object): |
def chdir(self, path): |
pass |
+ def walk(self, top): |
+ for dir_name in self._directory: |
+ yield top, dir_name, self._directory[dir_name] |
+ |
class PerfControlModuleStub(object): |
class PerfControlStub(object): |