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

Side by Side Diff: runtime/observatory/tests/service/eval_test.dart

Issue 2767533002: Revert "Fix observatory tests broken by running dartfmt." (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:developer'; 7 import 'dart:developer';
8 import 'package:observatory/service_io.dart'; 8 import 'package:observatory/service_io.dart';
9 import 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 import 'service_test_common.dart'; 10 import 'service_test_common.dart';
(...skipping 12 matching lines...) Expand all
23 void testFunction() { 23 void testFunction() {
24 int i = 0; 24 int i = 0;
25 while (true) { 25 while (true) {
26 if (++i % 100000000 == 0) { 26 if (++i % 100000000 == 0) {
27 MyClass.method(10000); 27 MyClass.method(10000);
28 } 28 }
29 } 29 }
30 } 30 }
31 31
32 var tests = [ 32 var tests = [
33 hasStoppedAtBreakpoint, 33
34 hasStoppedAtBreakpoint,
34 35
35 // Evaluate against library, class, and instance. 36 // Evaluate against library, class, and instance.
36 (Isolate isolate) { 37 (Isolate isolate) {
37 return isolate.getStack().then((ServiceMap stack) { 38 return isolate.getStack().then((ServiceMap stack) {
38 // Make sure we are in the right place. 39 // Make sure we are in the right place.
39 expect(stack.type, equals('Stack')); 40 expect(stack.type, equals('Stack'));
40 expect(stack['frames'].length, greaterThanOrEqualTo(2)); 41 expect(stack['frames'].length, greaterThanOrEqualTo(2));
41 expect(stack['frames'][0].function.name, equals('method')); 42 expect(stack['frames'][0].function.name, equals('method'));
42 expect(stack['frames'][0].function.dartOwner.name, equals('MyClass')); 43 expect(stack['frames'][0].function.dartOwner.name, equals('MyClass'));
43 44
44 var lib = isolate.rootLibrary; 45 var lib = isolate.rootLibrary;
45 var cls = stack['frames'][0].function.dartOwner; 46 var cls = stack['frames'][0].function.dartOwner;
46 var instance = stack['frames'][0].variables[0]['value']; 47 var instance = stack['frames'][0].variables[0]['value'];
47 48
48 List evals = []; 49 List evals = [];
49 evals.add(lib.evaluate('globalVar + 5').then((result) { 50 evals.add(lib.evaluate('globalVar + 5').then((result) {
50 print(result); 51 print(result);
51 expect(result.valueAsString, equals('105')); 52 expect(result.valueAsString, equals('105'));
52 })); 53 }));
53 evals.add(lib.evaluate('globalVar + staticVar + 5').then((result) { 54 evals.add(lib.evaluate('globalVar + staticVar + 5').then((result) {
54 expect(result.type, equals('Error')); 55 expect(result.type, equals('Error'));
55 })); 56 }));
56 evals.add(cls.evaluate('globalVar + staticVar + 5').then((result) { 57 evals.add(cls.evaluate('globalVar + staticVar + 5').then((result) {
57 print(result); 58 print(result);
58 expect(result.valueAsString, equals('1105')); 59 expect(result.valueAsString, equals('1105'));
59 })); 60 }));
60 evals.add(cls.evaluate('this + 5').then((result) { 61 evals.add(cls.evaluate('this + 5').then((result) {
61 expect(result.type, equals('Error')); 62 expect(result.type, equals('Error'));
62 })); 63 }));
63 evals.add(instance.evaluate('this + 5').then((result) { 64 evals.add(instance.evaluate('this + 5').then((result) {
64 print(result); 65 print(result);
65 expect(result.valueAsString, equals('10005')); 66 expect(result.valueAsString, equals('10005'));
66 })); 67 }));
67 evals.add(instance.evaluate('this + frog').then((result) { 68 evals.add(instance.evaluate('this + frog').then((result) {
68 expect(result.type, equals('Error')); 69 expect(result.type, equals('Error'));
69 })); 70 }));
70 return Future.wait(evals); 71 return Future.wait(evals);
71 }); 72 });
72 }, 73 },
74
73 ]; 75 ];
74 76
75 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); 77 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698