| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 directory->Rename("my_file", "my_new_file", Capture(&error)); | 96 directory->Rename("my_file", "my_new_file", Capture(&error)); |
| 97 ASSERT_TRUE(directory.WaitForIncomingResponse()); | 97 ASSERT_TRUE(directory.WaitForIncomingResponse()); |
| 98 EXPECT_EQ(FileError::OK, error); | 98 EXPECT_EQ(FileError::OK, error); |
| 99 | 99 |
| 100 // Opening my_file should fail. | 100 // Opening my_file should fail. |
| 101 | 101 |
| 102 error = FileError::FAILED; | 102 error = FileError::FAILED; |
| 103 directory->OpenFile("my_file", nullptr, kFlagRead | kFlagOpen, | 103 directory->OpenFile("my_file", nullptr, kFlagRead | kFlagOpen, |
| 104 Capture(&error)); | 104 Capture(&error)); |
| 105 ASSERT_TRUE(directory.WaitForIncomingResponse()); | 105 ASSERT_TRUE(directory.WaitForIncomingResponse()); |
| 106 EXPECT_EQ(FileError::FAILED, error); | 106 EXPECT_EQ(FileError::NOT_FOUND, error); |
| 107 | 107 |
| 108 // Opening my_new_file should succeed. | 108 // Opening my_new_file should succeed. |
| 109 error = FileError::FAILED; | 109 error = FileError::FAILED; |
| 110 directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen, | 110 directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen, |
| 111 Capture(&error)); | 111 Capture(&error)); |
| 112 ASSERT_TRUE(directory.WaitForIncomingResponse()); | 112 ASSERT_TRUE(directory.WaitForIncomingResponse()); |
| 113 EXPECT_EQ(FileError::OK, error); | 113 EXPECT_EQ(FileError::OK, error); |
| 114 | 114 |
| 115 // Delete my_new_file (no flags). | 115 // Delete my_new_file (no flags). |
| 116 directory->Delete("my_new_file", 0, Capture(&error)); | 116 directory->Delete("my_new_file", 0, Capture(&error)); |
| 117 ASSERT_TRUE(directory.WaitForIncomingResponse()); | 117 ASSERT_TRUE(directory.WaitForIncomingResponse()); |
| 118 EXPECT_EQ(FileError::OK, error); | 118 EXPECT_EQ(FileError::OK, error); |
| 119 | 119 |
| 120 // Opening my_new_file should fail. | 120 // Opening my_new_file should fail. |
| 121 error = FileError::FAILED; | 121 error = FileError::FAILED; |
| 122 directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen, | 122 directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen, |
| 123 Capture(&error)); | 123 Capture(&error)); |
| 124 ASSERT_TRUE(directory.WaitForIncomingResponse()); | 124 ASSERT_TRUE(directory.WaitForIncomingResponse()); |
| 125 EXPECT_EQ(FileError::FAILED, error); | 125 EXPECT_EQ(FileError::NOT_FOUND, error); |
| 126 } | 126 } |
| 127 | 127 |
| 128 TEST_F(DirectoryImplTest, CantOpenDirectoriesAsFiles) { | 128 TEST_F(DirectoryImplTest, CantOpenDirectoriesAsFiles) { |
| 129 DirectoryPtr directory; | 129 DirectoryPtr directory; |
| 130 GetTemporaryRoot(&directory); | 130 GetTemporaryRoot(&directory); |
| 131 FileError error; | 131 FileError error; |
| 132 | 132 |
| 133 { | 133 { |
| 134 // Create a directory called 'my_file' | 134 // Create a directory called 'my_file' |
| 135 DirectoryPtr my_file_directory; | 135 DirectoryPtr my_file_directory; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 151 ASSERT_TRUE(directory.WaitForIncomingResponse()); | 151 ASSERT_TRUE(directory.WaitForIncomingResponse()); |
| 152 EXPECT_EQ(FileError::NOT_A_FILE, error); | 152 EXPECT_EQ(FileError::NOT_A_FILE, error); |
| 153 } | 153 } |
| 154 } | 154 } |
| 155 | 155 |
| 156 | 156 |
| 157 // TODO(vtl): Test delete flags. | 157 // TODO(vtl): Test delete flags. |
| 158 | 158 |
| 159 } // namespace | 159 } // namespace |
| 160 } // namespace filesystem | 160 } // namespace filesystem |
| OLD | NEW |