Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(725)

Unified Diff: runtime/observatory/tests/observatory_ui/mocks/repositories/script.dart

Issue 2212253002: Converted Observatory class-tree element (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Removed tmp code Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
}

Powered by Google App Engine
This is Rietveld 408576698