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

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc

Issue 10084018: Revert 132149 - gdata: Remove OnDirectoryChanged from MockGDataSyncClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 | chrome/browser/chromeos/gdata/mock_gdata_sync_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc
===================================================================
--- chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc (revision 132212)
+++ chrome/browser/chromeos/gdata/gdata_file_system_unittest.cc (working copy)
@@ -1309,6 +1309,9 @@
base::Bind(&CallbackHelper::FileOperationCallback,
callback_helper_.get());
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata/Directory 1"))))).Times(1);
+
file_system_->Move(src_file_path, dest_file_path, callback);
message_loop_.RunAllPending();
EXPECT_EQ(base::PLATFORM_FILE_OK, callback_helper_->last_error_);
@@ -1351,6 +1354,12 @@
base::Bind(&CallbackHelper::FileOperationCallback,
callback_helper_.get());
+ // Expect notification for both source and destination directories.
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata"))))).Times(1);
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata/Directory 1"))))).Times(1);
+
file_system_->Move(src_file_path, dest_file_path, callback);
message_loop_.RunAllPending();
EXPECT_EQ(base::PLATFORM_FILE_OK, callback_helper_->last_error_);
@@ -1395,6 +1404,12 @@
base::Bind(&CallbackHelper::FileOperationCallback,
callback_helper_.get());
+ // Expect notification for both source and destination directories.
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata"))))).Times(1);
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata/Directory 1"))))).Times(1);
+
file_system_->Move(src_file_path, dest_file_path, callback);
message_loop_.RunAllPending();
EXPECT_EQ(base::PLATFORM_FILE_OK, callback_helper_->last_error_);
@@ -1417,6 +1432,9 @@
LoadRootFeedDocument("root_feed.json");
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata"))))).Times(1);
+
AddDirectoryFromFile(dest_parent_path, "directory_entry_atom.json");
GDataFileBase* src_file = NULL;
@@ -1453,6 +1471,15 @@
base::Bind(&CallbackHelper::FileOperationCallback,
callback_helper_.get());
+ // Expect notification for both source and destination directories plus
+ // interim file path.
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata/Directory 1"))))).Times(1);
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata"))))).Times(1);
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata/New Folder 1"))))).Times(1);
+
file_system_->Move(src_file_path, dest_file_path, callback);
message_loop_.RunAllPending();
EXPECT_EQ(base::PLATFORM_FILE_OK, callback_helper_->last_error_);
@@ -1579,6 +1606,10 @@
std::string file_in_subdir_resource = file->AsGDataFile()->resource_id();
EXPECT_EQ(file, FindFileByResourceId(file_in_subdir_resource));
+ // Once for file in root and once for file...
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata"))))).Times(2);
+
// Remove first file in root.
EXPECT_TRUE(RemoveFile(file_in_root));
EXPECT_TRUE(FindFile(file_in_root) == NULL);
@@ -1611,12 +1642,18 @@
TEST_F(GDataFileSystemTest, CreateDirectory) {
LoadRootFeedDocument("root_feed.json");
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata"))))).Times(1);
+
// Create directory in root.
FilePath dir_path(FILE_PATH_LITERAL("gdata/New Folder 1"));
EXPECT_TRUE(FindFile(dir_path) == NULL);
AddDirectoryFromFile(dir_path, "directory_entry_atom.json");
EXPECT_TRUE(FindFile(dir_path) != NULL);
+ EXPECT_CALL(*mock_sync_client_, OnDirectoryChanged(
+ Eq(FilePath(FILE_PATH_LITERAL("gdata/New Folder 1"))))).Times(1);
+
// Create directory in a sub dirrectory.
FilePath subdir_path(FILE_PATH_LITERAL("gdata/New Folder 1/New Folder 2"));
EXPECT_TRUE(FindFile(subdir_path) == NULL);
« no previous file with comments | « no previous file | chrome/browser/chromeos/gdata/mock_gdata_sync_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698