OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:convert'; | 6 import 'dart:convert'; |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
10 | 10 |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 }); | 146 }); |
147 expect(result['type'], equals('FSFileList')); | 147 expect(result['type'], equals('FSFileList')); |
148 expect(result['files'].length, equals(3)); | 148 expect(result['files'].length, equals(3)); |
149 | 149 |
150 // Delete DevFS. | 150 // Delete DevFS. |
151 result = await vm.invokeRpcNoUpgrade('_deleteDevFS', { | 151 result = await vm.invokeRpcNoUpgrade('_deleteDevFS', { |
152 'fsName': fsId, | 152 'fsName': fsId, |
153 }); | 153 }); |
154 expect(result['type'], equals('Success')); | 154 expect(result['type'], equals('Success')); |
155 }, | 155 }, |
156 | |
157 // Write a file with the ? character in the filename. | |
158 (VM vm) async { | |
159 var fsId = 'test'; | |
160 var filePath = '/foo/bar?dat'; | |
161 var fileContents = BASE64.encode(UTF8.encode('fileContents')); | |
162 | |
163 var result; | |
164 // Create DevFS. | |
165 result = await vm.invokeRpcNoUpgrade('_createDevFS', { 'fsName': fsId }); | |
166 expect(result['type'], equals('FileSystem')); | |
167 expect(result['name'], equals(fsId)); | |
168 expect(result['uri'], new isInstanceOf<String>()); | |
169 | |
170 // Write the file. | |
171 result = await vm.invokeRpcNoUpgrade('_writeDevFSFile', { | |
172 'fsName': fsId, | |
173 'path': filePath, | |
174 'fileContents': fileContents | |
175 }); | |
176 expect(result['type'], equals('Success')); | |
177 | |
178 // Read the file back. | |
179 result = await vm.invokeRpcNoUpgrade('_readDevFSFile', { | |
180 'fsName': fsId, | |
181 'path': filePath, | |
182 }); | |
183 expect(result['type'], equals('FSFile')); | |
184 expect(result['fileContents'], equals(fileContents)); | |
185 | |
186 // List all the files in the file system. | |
187 result = await vm.invokeRpcNoUpgrade('_listDevFSFiles', { | |
188 'fsName': fsId, | |
189 }); | |
190 expect(result['type'], equals('FSFileList')); | |
191 expect(result['files'].length, equals(1)); | |
192 expect(result['files'][0]['name'], equals('/foo/bar?dat')); | |
193 | |
194 // Delete DevFS. | |
195 result = await vm.invokeRpcNoUpgrade('_deleteDevFS', { | |
196 'fsName': fsId, | |
197 }); | |
198 expect(result['type'], equals('Success')); | |
199 }, | |
200 ]; | 156 ]; |
201 | 157 |
202 main(args) async => runVMTests(args, tests); | 158 main(args) async => runVMTests(args, tests); |
OLD | NEW |