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

Unified Diff: content/browser/fileapi/file_system_operation_impl_unittest.cc

Issue 491813002: Modify test case to support streaming operation in sandbox file system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 | « no previous file | content/browser/fileapi/obfuscated_file_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/fileapi/file_system_operation_impl_unittest.cc
diff --git a/content/browser/fileapi/file_system_operation_impl_unittest.cc b/content/browser/fileapi/file_system_operation_impl_unittest.cc
index afbe664aaf2b3233a9ded3ebfd43aab94a848997..d69a459bf891f5b2a9690b861e2bb1bf86edeb10 100644
--- a/content/browser/fileapi/file_system_operation_impl_unittest.cc
+++ b/content/browser/fileapi/file_system_operation_impl_unittest.cc
@@ -57,7 +57,8 @@ class FileSystemOperationImplTest
: public testing::Test {
public:
FileSystemOperationImplTest()
- : status_(kFileOperationStatusNotSet),
+ : message_loop_(base::MessageLoop::TYPE_IO),
+ status_(kFileOperationStatusNotSet),
weak_factory_(this) {}
protected:
@@ -277,7 +278,7 @@ class FileSystemOperationImplTest
}
private:
- base::MessageLoop message_loop_;
+ base::MessageLoopForIO message_loop_;
scoped_refptr<QuotaManager> quota_manager_;
scoped_refptr<QuotaManagerProxy> quota_manager_proxy_;
@@ -553,7 +554,11 @@ TEST_F(FileSystemOperationImplTest, TestCopyFailureSrcFileExistsDestDir) {
FileSystemOperationRunner::CopyProgressCallback(),
RecordStatusCallback());
base::RunLoop().RunUntilIdle();
- EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, status());
+ EXPECT_EQ(3, quota_manager_proxy()->notify_storage_accessed_count());
+
+ EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count());
+ EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count());
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, status());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -604,9 +609,8 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndOverwrite) {
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("dest"));
- EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count());
+ EXPECT_EQ(4, quota_manager_proxy()->notify_storage_accessed_count());
- EXPECT_EQ(1, change_observer()->get_and_reset_modify_file_count());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -620,9 +624,9 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcFileAndNew) {
base::RunLoop().RunUntilIdle();
EXPECT_EQ(base::File::FILE_OK, status());
EXPECT_TRUE(FileExists("new"));
- EXPECT_EQ(2, quota_manager_proxy()->notify_storage_accessed_count());
+ EXPECT_EQ(4, quota_manager_proxy()->notify_storage_accessed_count());
- EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count());
+ EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -642,8 +646,8 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirAndOverwrite) {
EXPECT_FALSE(DirectoryExists("dest/src"));
EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 3);
- EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count());
EXPECT_EQ(1, change_observer()->get_and_reset_create_directory_count());
+ EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count());
EXPECT_TRUE(change_observer()->HasNoChange());
}
@@ -684,9 +688,9 @@ TEST_F(FileSystemOperationImplTest, TestCopySuccessSrcDirRecursive) {
// For recursive copy we may record multiple read access.
EXPECT_GE(quota_manager_proxy()->notify_storage_accessed_count(), 1);
+ EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count());
EXPECT_EQ(2, change_observer()->get_and_reset_create_directory_count());
EXPECT_EQ(1, change_observer()->get_and_reset_remove_directory_count());
- EXPECT_EQ(1, change_observer()->get_and_reset_create_file_from_count());
EXPECT_TRUE(change_observer()->HasNoChange());
}
« no previous file with comments | « no previous file | content/browser/fileapi/obfuscated_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698