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

Unified Diff: tests/standalone/src/DirectoryTest.dart

Issue 8883017: Split File into File and RandomAccessFile. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments. Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/chat/chat_server_lib.dart ('k') | tests/standalone/src/FileInputStreamTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/DirectoryTest.dart
diff --git a/tests/standalone/src/DirectoryTest.dart b/tests/standalone/src/DirectoryTest.dart
index b5c8e5fd98475e4d27849ac730f1b23ee00ea908..f4de9f09be1faa8e4e25ec4fb7a0324b465e4281 100644
--- a/tests/standalone/src/DirectoryTest.dart
+++ b/tests/standalone/src/DirectoryTest.dart
@@ -19,13 +19,11 @@ class DirectoryTest {
f.createSync();
directory.dirHandler = (dir) {
- print(dir);
listedDir = true;
Expect.isTrue(dir.contains('subdir'));
};
directory.fileHandler = (f) {
- print(f);
listedFile = true;
Expect.isTrue(f.contains('subdir'));
Expect.isTrue(f.contains('file.txt'));
@@ -150,42 +148,41 @@ class DirectoryTest {
Expect.fail("testCreateTemp file.errorHandler called: $error");
};
file.createHandler = () {
+ file.openHandler = (RandomAccessFile openedFile) {
+ openedFile.writeList([65, 66, 67, 13], 0, 4);
+ openedFile.noPendingWriteHandler = () {
+ openedFile.length();
+ };
+ openedFile.lengthHandler = (int length) {
+ Expect.equals(4, length);
+ openedFile.close();
+ };
+ openedFile.closeHandler = () {
+ file.exists();
+ };
+ file.existsHandler = (bool exists) {
+ Expect.isTrue(exists);
+ // Try to delete the directory containing the file - should throw.
+ bool threw_exception = false;
+ try {
+ tempDirectory.deleteSync();
+ } catch (var e) {
+ Expect.isTrue(tempDirectory.existsSync());
+ threw_exception = true;
+ }
+ Expect.isTrue(threw_exception);
+ Expect.isTrue(tempDirectory.existsSync());
+
+ // Delete the file, and then delete the directory.
+ file.delete();
+ };
+ file.deleteHandler = () {
+ tempDirectory.deleteSync();
+ Expect.isFalse(tempDirectory.existsSync());
+ };
+ };
file.open(writable: true);
};
- file.openHandler = () {
- file.writeList([65, 66, 67, 13], 0, 4);
- };
- file.noPendingWriteHandler = () {
- file.length();
- };
- file.lengthHandler = (int length) {
- Expect.equals(4, length);
- file.close();
- };
- file.closeHandler = () {
- file.exists();
- };
- file.existsHandler = (bool exists) {
- Expect.isTrue(exists);
- // Try to delete the directory containing the file - should throw.
- bool threw_exception = false;
- try {
- tempDirectory.deleteSync();
- } catch (var e) {
- Expect.isTrue(tempDirectory.existsSync());
- threw_exception = true;
- }
- Expect.isTrue(threw_exception);
- Expect.isTrue(tempDirectory.existsSync());
-
- // Delete the file, and then delete the directory.
- file.delete();
- };
- file.deleteHandler = () {
- tempDirectory.deleteSync();
- Expect.isFalse(tempDirectory.existsSync());
- };
-
file.create();
};
tempDirectory.createTemp();
« no previous file with comments | « samples/chat/chat_server_lib.dart ('k') | tests/standalone/src/FileInputStreamTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698