OLD | NEW |
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=--compile_all --error_on_bad_type --error_on_bad_override | 4 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override |
5 | 5 |
6 import 'package:observatory/service_io.dart'; | 6 import 'package:observatory/service_io.dart'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 | 10 |
11 int globalVar = 100; | 11 int globalVar = 100; |
12 | 12 |
13 class MyClass { | 13 class MyClass { |
14 static int staticVar = 1000; | 14 static int staticVar = 1000; |
15 | 15 |
16 static void printValue(int value) { | 16 static void printValue(int value) { |
17 print(value); // line 16 | 17 print(value); // line 17 |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 void testFunction() { | 21 void testFunction() { |
22 int i = 0; | 22 int i = 0; |
23 while (true) { | 23 while (true) { |
24 if (++i % 100000000 == 0) { | 24 if (++i % 100000000 == 0) { |
25 MyClass.printValue(10000); | 25 MyClass.printValue(10000); |
26 } | 26 } |
27 } | 27 } |
(...skipping 12 matching lines...) Expand all Loading... |
40 if (event.kind == ServiceEvent.kPauseBreakpoint) { | 40 if (event.kind == ServiceEvent.kPauseBreakpoint) { |
41 print('Breakpoint reached'); | 41 print('Breakpoint reached'); |
42 subscription.cancel(); | 42 subscription.cancel(); |
43 completer.complete(); | 43 completer.complete(); |
44 } | 44 } |
45 }); | 45 }); |
46 }); | 46 }); |
47 | 47 |
48 // Add the breakpoint. | 48 // Add the breakpoint. |
49 var script = isolate.rootLibrary.scripts[0]; | 49 var script = isolate.rootLibrary.scripts[0]; |
50 var line = 16; | 50 var line = 17; |
51 return isolate.addBreakpoint(script, line).then((ServiceObject bpt) { | 51 return isolate.addBreakpoint(script, line).then((ServiceObject bpt) { |
52 return completer.future; // Wait for breakpoint reached. | 52 return completer.future; // Wait for breakpoint reached. |
53 }); | 53 }); |
54 }); | 54 }); |
55 }, | 55 }, |
56 | 56 |
57 // Evaluate against library, class, and instance. | 57 // Evaluate against library, class, and instance. |
58 (Isolate isolate) { | 58 (Isolate isolate) { |
59 return isolate.getStack().then((ServiceMap stack) { | 59 return isolate.getStack().then((ServiceMap stack) { |
60 // Make sure we are in the right place. | 60 // Make sure we are in the right place. |
(...skipping 28 matching lines...) Expand all Loading... |
89 evals.add(instance.evaluate('this + frog').then((result) { | 89 evals.add(instance.evaluate('this + frog').then((result) { |
90 expect(result.type, equals('Error')); | 90 expect(result.type, equals('Error')); |
91 })); | 91 })); |
92 return Future.wait(evals); | 92 return Future.wait(evals); |
93 }); | 93 }); |
94 }, | 94 }, |
95 | 95 |
96 ]; | 96 ]; |
97 | 97 |
98 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 98 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
OLD | NEW |