Index: runtime/observatory/tests/observatory_ui/mocks/repositories/script.dart |
diff --git a/runtime/observatory/tests/observatory_ui/mocks/repositories/script.dart b/runtime/observatory/tests/observatory_ui/mocks/repositories/script.dart |
index 7ab91142f1aca5134fa145d4d73443b62935d40d..78b96106e8a911bc49512a43a9934b06e449346c 100644 |
--- a/runtime/observatory/tests/observatory_ui/mocks/repositories/script.dart |
+++ b/runtime/observatory/tests/observatory_ui/mocks/repositories/script.dart |
@@ -4,16 +4,18 @@ |
part of mocks; |
-class ScriptRepositoryMock implements M.ScriptRepository { |
- final Map<String, M.Script> scripts; |
+typedef Future<M.Script> ScriptRepositoryMockCallback(String id); |
- bool _invoked = false; |
- bool get invoked => _invoked; |
+class ScriptRepositoryMock implements M.ScriptRepository { |
+ final ScriptRepositoryMockCallback _get; |
- ScriptRepositoryMock(this.scripts); |
+ ScriptRepositoryMock({ScriptRepositoryMockCallback getter}) |
+ : _get = getter; |
- Future<M.Script> get(String id) async { |
- _invoked = true; |
- return scripts[id]; |
+ Future<M.Script> get(String id){ |
+ if (_get != null) { |
+ return _get(id); |
+ } |
+ return new Future.value(null); |
} |
} |