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

Unified Diff: runtime/observatory/tests/service/service_test_common.dart

Issue 2930993004: Address additional analysis issues in the observatory codebase. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « runtime/observatory/tests/service/get_native_allocation_samples_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/tests/service/service_test_common.dart
diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart
index c623234c8165016393e895513e728fa59395f8e2..1bd7250004f9380d9795779425cc925f61eb2606 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -5,7 +5,8 @@
library service_test_common;
import 'dart:async';
-import 'dart:io' show Platform;
+import 'dart:io' show File, Platform;
+
import 'package:observatory/models.dart' as M;
import 'package:observatory/service_common.dart';
import 'package:unittest/unittest.dart';
@@ -15,6 +16,29 @@ typedef Future VMTest(VM vm);
Map<String, StreamSubscription> streamSubscriptions = {};
+class ScriptLineParser {
rmacnak 2017/06/12 16:02:12 Awesome!
+ List<String> lines;
+
+ ScriptLineParser(Uri scriptUri) {
+ String content = new File(scriptUri.toFilePath()).readAsStringSync();
+ lines = content.split('\n');
+ }
+
+ int lineFor(String commentContent) {
+ String match1 = '// $commentContent';
+ String match2 = '/* $commentContent */';
+
+ for (int i = 0; i < lines.length; i++) {
+ if (lines[i].contains(match1) || lines[i].contains(match2)) {
+ // return the 1-based line number
+ return i + 1;
+ }
+ }
+
+ return -1;
+ }
+}
+
Future subscribeToStream(VM vm, String streamName, onEvent) async {
assert(streamSubscriptions[streamName] == null);
« no previous file with comments | « runtime/observatory/tests/service/get_native_allocation_samples_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698