Files
sdk/tests/html/fileapi_test.dart
T
vsm@google.com a1d9180d98 New cross frame base types.
Local types (LocalWindow, LocalLocation, LocalHistory) now subtype the corresponding "safe" base type.  The _CrossFrameImpl classes implement the safe types.

This also fills out Location and History for dart2js.

Note for dart2js, I still need to trap returned windows.  That's a separate bug.

BUG=3836

Review URL: https://codereview.chromium.org//11047021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13252 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-04 18:16:03 +00:00

80 lines
1.9 KiB
Dart

#library('fileapi');
#import('../../pkg/unittest/unittest.dart');
#import('../../pkg/unittest/html_config.dart');
#import('dart:html');
void fail(message) {
guardAsync(() {
Expect.fail(message);
});
}
DOMFileSystem fs;
main() {
useHtmlConfiguration();
test('getFileSystem', () {
window.webkitRequestFileSystem(LocalWindow.TEMPORARY, 100, expectAsync1(
(DOMFileSystem fileSystem) {
fs = fileSystem;
}),
(e) {
fail('Got file error: ${e.code}');
});
});
group('getDirectory', () {
test('directoryDoesntExist', () {
fs.root.getDirectory(
'directory2',
options: {},
successCallback: (e) {
fail('Should not be reached');
},
errorCallback: expectAsync1((FileError e) {
expect(e.code, equals(FileError.NOT_FOUND_ERR));
}));
});
test('directoryCreate', () {
fs.root.getDirectory(
'directory3',
options: {'create': true},
successCallback: expectAsync1((DirectoryEntry e) {
expect(e.name, equals('directory3'));
}),
errorCallback: (e) {
fail('Got file error: ${e.code}');
});
});
});
group('getFile', () {
test('fileDoesntExist', () {
fs.root.getFile(
'file2',
options: {},
successCallback: (e) {
fail('Should not be reached');
},
errorCallback: expectAsync1((FileError e) {
expect(e.code, equals(FileError.NOT_FOUND_ERR));
}));
});
test('fileCreate', () {
fs.root.getFile(
'file4',
options: {'create': true},
successCallback: expectAsync1((FileEntry e) {
expect(e.name, equals('file4'));
expect(e.isFile, equals(true));
}),
errorCallback: (e) {
fail('Got file error: ${e.code}');
});
});
});
}