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

Side by Side Diff: services/dart/dart_apptests/lib/src/file_apptests.dart

Issue 1539843004: Support some file operations in dart:io under mojo (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « services/dart/dart_apptests/lib/main.dart ('k') | services/files/directory_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 library file_apptests;
6
7 import 'dart:async';
8 import 'dart:convert';
9 import 'dart:io';
10
11 import 'package:mojo_apptest/apptest.dart';
12 import 'package:mojo/application.dart';
13 import 'package:mojo/bindings.dart';
14 import 'package:mojo/core.dart';
15
16 tests(Application application, String url) {
17 group('File Apptests', () {
18 test('Absolute path', () async {
19 String current = Directory.current.path;
20 for (String relative in ['abd', '..', '.', 'efg/hij', 'abc/']) {
21 if (current.endsWith('/')) {
22 expect(new File(relative).absolute.path, '$current$relative');
23 } else {
24 expect(new File(relative).absolute.path, '$current/$relative');
25 }
26 expect(new File(relative).absolute.isAbsolute, isTrue);
27 expect(new Directory(relative).absolute.path,
28 new Link(relative).absolute.path);
29 expect(new File(relative).absolute is File, isTrue);
30 expect(new Directory(relative).absolute is Directory, isTrue);
31 expect(new Link(relative).absolute is Link, isTrue);
32 }
33 for (String absolute in ['/abd', '/', '/./..\\', '/efg/hij', '/abc/']) {
34 expect(new File(absolute).absolute.path, absolute);
35 expect(new File(absolute).absolute.isAbsolute, isTrue);
36 }
37 });
38 test('File Constructor', () async {
39 expect(new File('blåbærgrød'), isNotNull);
40 expect(new File('foo.txt'), isNotNull);
41 });
42 test('Directory systemTemp', () async {
43 expect(Directory.systemTemp, isNotNull);
44 });
45 test('Directory create', () async {
46 Directory directory =
47 await Directory.systemTemp.createTemp('dart_directory_test');
48 Directory subDirectory = new Directory("${directory.path}/subdir");
49 expect('$directory'.contains(directory.path), isTrue);
50 expect(await subDirectory.exists(), isFalse);
51 await subDirectory.create();
52 expect(await subDirectory.exists(), isTrue);
53 File f = new File('${subDirectory.path}/file.txt');
54 File fLong = new File('${directory.path}/subdir/../subdir/file.txt');
55 expect(await f.exists(), isFalse);
56 await fLong.create();
57 expect(await f.exists(), isTrue);
58 });
59 });
60 }
OLDNEW
« no previous file with comments | « services/dart/dart_apptests/lib/main.dart ('k') | services/files/directory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698