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

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

Issue 1726773002: Refactor service tests in preparation of running on sky_shell (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/service/coverage_test.dart
diff --git a/runtime/observatory/tests/service/coverage_test.dart b/runtime/observatory/tests/service/coverage_test.dart
index 7a8ee93527227becfc6591f6f1f0623f95a0ca03..93b0da50ad2e7d9913b793b76e812a3b5161a1e2 100644
--- a/runtime/observatory/tests/service/coverage_test.dart
+++ b/runtime/observatory/tests/service/coverage_test.dart
@@ -6,8 +6,13 @@
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
+import 'service_test_common.dart';
import 'dart:developer';
+const int LINE_A = 20;
+const int LINE_B = 38;
+const int LINE_C = 136;
+
int globalVar = 100;
class MyClass {
@@ -60,7 +65,10 @@ hasStoppedAtBreakpoint,
expect(coverage['type'], equals('CodeCoverage'));
expect(coverage['coverage'].length, equals(1));
expect(coverage['coverage'][0]['hits'],
- equals([15, 1, 16, 0, 18, 1, 20, 1]));
+ equals([LINE_A, 1,
+ LINE_A + 1, 0,
+ LINE_A + 3, 1,
+ LINE_A + 5, 1]));
// Class
coverage = await isolate.invokeRpcNoUpgrade('_getCoverage',
@@ -68,8 +76,14 @@ hasStoppedAtBreakpoint,
expect(coverage['type'], equals('CodeCoverage'));
expect(coverage['coverage'].length, equals(1));
expect(coverage['coverage'][0]['hits'],
- equals([15, 1, 16, 0, 18, 1, 20, 1,
- 24, 1, 25, 1, 27, 0, 13, 0]));
+ equals([LINE_A, 1,
+ LINE_A + 1, 0,
+ LINE_A + 3, 1,
+ LINE_A + 5, 1,
+ LINE_A + 9, 1,
+ LINE_A + 10, 1,
+ LINE_A + 12, 0,
+ LINE_A - 2, 0]));
// Library
coverage = await isolate.invokeRpcNoUpgrade('_getCoverage',
@@ -77,10 +91,18 @@ hasStoppedAtBreakpoint,
expect(coverage['type'], equals('CodeCoverage'));
expect(coverage['coverage'].length, equals(4));
expect(coverage['coverage'][0]['hits'],
- equals([15, 1, 16, 0, 18, 1, 20, 1,
- 24, 1, 25, 1, 27, 0, 13, 0]));
+ equals([LINE_A, 1,
+ LINE_A + 1, 0,
+ LINE_A + 3, 1,
+ LINE_A + 5, 1,
+ LINE_A + 9, 1,
+ LINE_A + 10, 1,
+ LINE_A + 12, 0,
+ LINE_A - 2, 0]));
expect(coverage['coverage'][1]['hits'],
- equals([33, 1, 34, 1, 106, 2]));
+ equals([LINE_B, 1,
+ LINE_B + 1, 1,
+ LINE_C, 2]));
// Script
await cls.load();
@@ -89,10 +111,18 @@ hasStoppedAtBreakpoint,
expect(coverage['type'], equals('CodeCoverage'));
expect(coverage['coverage'].length, equals(4));
expect(coverage['coverage'][0]['hits'],
- equals([15, 1, 16, 0, 18, 1, 20, 1,
- 24, 1, 25, 1, 27, 0, 13, 0]));
+ equals([LINE_A, 1,
+ LINE_A + 1, 0,
+ LINE_A + 3, 1,
+ LINE_A + 5, 1,
+ LINE_A + 9, 1,
+ LINE_A + 10, 1,
+ LINE_A + 12, 0,
+ LINE_A - 2, 0]));
expect(coverage['coverage'][1]['hits'],
- equals([33, 1, 34, 1, 106, 2]));
+ equals([LINE_B, 1,
+ LINE_B + 1, 1,
+ LINE_C, 2]));
// Isolate
coverage = await isolate.invokeRpcNoUpgrade('_getCoverage', {});

Powered by Google App Engine
This is Rietveld 408576698