| 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=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--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 | 8 |
| 9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
| 10 | 10 |
| 11 var tests = [ | 11 var tests = [ |
| 12 (VM vm) async { | 12 (VM vm) async { |
| 13 var result = await vm.invokeRpcNoUpgrade('getFlagList', {}); | 13 var result = await vm.invokeRpcNoUpgrade('getFlagList', {}); |
| 14 expect(result['type'], equals('FlagList')); | 14 expect(result['type'], equals('FlagList')); |
| 15 // TODO(turnidge): Make this test a bit beefier. | 15 // TODO(turnidge): Make this test a bit beefier. |
| 16 }, | 16 }, |
| 17 | 17 |
| 18 // Modify a flag which does not exist. | 18 // Modify a flag which does not exist. |
| 19 (VM vm) async { | 19 (VM vm) async { |
| 20 // Modify a flag. | 20 // Modify a flag. |
| 21 var params = { | 21 var params = { |
| 22 'name': 'does_not_really_exist', | 22 'name' : 'does_not_really_exist', |
| 23 'value': 'true', | 23 'value' : 'true', |
| 24 }; | 24 }; |
| 25 var result = await vm.invokeRpcNoUpgrade('_setFlag', params); | 25 var result = await vm.invokeRpcNoUpgrade('_setFlag', params); |
| 26 expect(result['type'], equals('Error')); | 26 expect(result['type'], equals('Error')); |
| 27 expect(result['message'], equals('Cannot set flag: flag not found')); | 27 expect(result['message'], equals('Cannot set flag: flag not found')); |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 // Modify a flag with the wrong value type. | 30 // Modify a flag with the wrong value type. |
| 31 (VM vm) async { | 31 (VM vm) async { |
| 32 // Modify a flag. | 32 // Modify a flag. |
| 33 var params = { | 33 var params = { |
| 34 'name': 'trace_profiler', | 34 'name' : 'trace_profiler', |
| 35 'value': '123', | 35 'value' : '123', |
| 36 }; | 36 }; |
| 37 var result = await vm.invokeRpcNoUpgrade('_setFlag', params); | 37 var result = await vm.invokeRpcNoUpgrade('_setFlag', params); |
| 38 expect(result['type'], equals('Error')); | 38 expect(result['type'], equals('Error')); |
| 39 expect(result['message'], equals('Cannot set flag: invalid value')); | 39 expect(result['message'], equals('Cannot set flag: invalid value')); |
| 40 }, | 40 }, |
| 41 ]; | 41 ]; |
| 42 | 42 |
| 43 main(args) async => runVMTests(args, tests); | 43 main(args) async => runVMTests(args, tests); |
| OLD | NEW |