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

Side by Side Diff: tests/standalone/io/file_uri_test.dart

Issue 59593002: Fix test failures on Windows (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « tests/standalone/io/directory_uri_test.dart ('k') | tests/standalone/io/link_uri_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 import 'dart:io'; 5 import 'dart:io';
6 6
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 void testFromUri() { 10 void testFromUri() {
11 asyncStart(); 11 asyncStart();
12 Directory originalWorkingDirectory = Directory.current;
12 Directory.systemTemp.createTemp('file_uri').then((temp) { 13 Directory.systemTemp.createTemp('file_uri').then((temp) {
13 String filename = temp.path + '/from_uri'; 14 String filename = temp.path + '/from_uri';
14 Uri fileUri = new Uri.file(filename); 15 Uri fileUri = new Uri.file(filename);
15 File file = new File.fromUri(fileUri); 16 File file = new File.fromUri(fileUri);
16 Expect.isTrue(fileUri.isAbsolute); 17 Expect.isTrue(fileUri.isAbsolute);
17 Expect.isTrue(fileUri.path.startsWith('/')); 18 Expect.isTrue(fileUri.path.startsWith('/'));
18 file.createSync(); 19 file.createSync();
19 Expect.isTrue(new File.fromUri(fileUri).existsSync()); 20 Expect.isTrue(new File.fromUri(fileUri).existsSync());
20 Expect.isTrue(new File.fromUri(Uri.base.resolveUri(fileUri)).existsSync()); 21 Expect.isTrue(new File.fromUri(Uri.base.resolveUri(fileUri)).existsSync());
21 Directory.current = temp.path; 22 Directory.current = temp.path;
22 Expect.isTrue(new File.fromUri(Uri.parse('from_uri')).existsSync()); 23 Expect.isTrue(new File.fromUri(Uri.parse('from_uri')).existsSync());
23 Expect.isTrue(new File.fromUri(Uri.base.resolve('from_uri')).existsSync()); 24 Expect.isTrue(new File.fromUri(Uri.base.resolve('from_uri')).existsSync());
25 Directory.current = originalWorkingDirectory;
24 file.deleteSync(); 26 file.deleteSync();
25 temp.deleteSync(recursive: true); 27 temp.deleteSync(recursive: true);
26 asyncEnd(); 28 asyncEnd();
27 }); 29 });
28 } 30 }
29 31
30 void testFromUriUnsupported() { 32 void testFromUriUnsupported() {
31 Expect.throws( 33 Expect.throws(
32 () => new File.fromUri( 34 () => new File.fromUri(
33 Uri.parse('http://localhost:8080/index.html')), 35 Uri.parse('http://localhost:8080/index.html')),
34 (e) => e is UnsupportedError); 36 (e) => e is UnsupportedError);
35 Expect.throws(() => new File.fromUri(Uri.parse('ftp://localhost/tmp/xxx')), 37 Expect.throws(() => new File.fromUri(Uri.parse('ftp://localhost/tmp/xxx')),
36 (e) => e is UnsupportedError); 38 (e) => e is UnsupportedError);
37 Expect.throws(() => new File.fromUri(Uri.parse('name#fragment')), 39 Expect.throws(() => new File.fromUri(Uri.parse('name#fragment')),
38 (e) => e is UnsupportedError); 40 (e) => e is UnsupportedError);
39 } 41 }
40 42
41 void main() { 43 void main() {
42 testFromUri(); 44 testFromUri();
43 testFromUriUnsupported(); 45 testFromUriUnsupported();
44 } 46 }
OLDNEW
« no previous file with comments | « tests/standalone/io/directory_uri_test.dart ('k') | tests/standalone/io/link_uri_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698