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

Unified Diff: tests/html/fileapi_test.dart

Issue 11888013: Adding support checks for FileSystem APIs and making APIs not webkit-specific. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixing test. Created 7 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/fileapi_test.dart
diff --git a/tests/html/fileapi_test.dart b/tests/html/fileapi_test.dart
index f7155b615824eb1d92f5dd3c962daccc825302b2..df40fd008ba83941ec7b450761b8c26cb26bc808 100644
--- a/tests/html/fileapi_test.dart
+++ b/tests/html/fileapi_test.dart
@@ -1,6 +1,6 @@
library fileapi;
import '../../pkg/unittest/lib/unittest.dart';
-import '../../pkg/unittest/lib/html_config.dart';
+import '../../pkg/unittest/lib/html_individual_config.dart';
import 'dart:html';
void fail(message) {
@@ -12,68 +12,91 @@ void fail(message) {
FileSystem fs;
main() {
- useHtmlConfiguration();
- test('getFileSystem', () {
- window.webkitRequestFileSystem(Window.TEMPORARY, 100, expectAsync1(
- (FileSystem fileSystem) {
- fs = fileSystem;
- }),
- (e) {
- fail('Got file error: ${e.code}');
- });
- });
- group('getDirectory', () {
+ useHtmlIndividualConfiguration();
- 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));
- }));
+ group('supported', () {
+ test('supported', () {
+ expect(FileSystem.supported, true);
});
+ });
- 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}');
- });
+ getFileSystem() {
+ window.requestFileSystem(Window.TEMPORARY, 100,
+ expectAsync1((FileSystem fileSystem) {
+ fs = fileSystem;
+ }),
+ (e) {
+ fail('Got file error: ${e.code}');
+ });
+ }
+
+ group('unsupported throws', () {
+ test('requestFileSystem', () {
+ var expectation = FileSystem.supported ? returnsNormally : throws;
+ expect(() {
+ window.requestFileSystem(Window.TEMPORARY, 100, (_) {}, (_) {});
+ }, expectation);
});
});
- group('getFile', () {
+ group('getDirectory', () {
+ if (FileSystem.supported) {
+ test('getFileSystem', getFileSystem);
- 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('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}');
+ });
+ });
+ }
+ });
- test('fileCreate', () {
- fs.root.getFile(
- 'file4',
- options: {'create': true},
- successCallback: expectAsync1((FileEntry e) {
- expect(e.name, equals('file4'));
- expect(e.isFile, isTrue);
- }),
- errorCallback: (e) {
- fail('Got file error: ${e.code}');
- });
+ group('getFile', () {
+ if (FileSystem.supported) {
+ test('getFileSystem', getFileSystem);
+
+ 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, isTrue);
+ }),
+ errorCallback: (e) {
+ fail('Got file error: ${e.code}');
+ });
+ });
Emily Fortuna 2013/01/14 23:28:03 nit: I think this should be indented two spaces le
blois 2013/01/14 23:45:10 The joys of closures, changing these APIs to futur
+ }
});
}
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | tests/html/html.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698