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

Unified Diff: chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc

Issue 408143014: Rename OperationObserver to OperationDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
diff --git a/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
index 5d4fa1ccbb00ef26f68ab7d540ee9992c4829ac0..64187b67607dfe50de5c5633991594f5c72e7811 100644
--- a/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
+++ b/chrome/browser/chromeos/drive/file_system/copy_operation_unittest.cc
@@ -41,7 +41,7 @@ class CopyOperationTest : public OperationTestBase {
OperationTestBase::SetUp();
operation_.reset(new CopyOperation(
blocking_task_runner(),
- observer(),
+ delegate(),
scheduler(),
metadata(),
cache(),
@@ -76,12 +76,12 @@ TEST_F(CopyOperationTest, TransferFileFromLocalToRemote_RegularFile) {
// TransferFileFromLocalToRemote stores a copy of the local file in the cache,
// marks it dirty and requests the observer to upload the file.
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(remote_dest_path, &entry));
- EXPECT_EQ(1U, observer()->updated_local_ids().count(entry.local_id()));
+ EXPECT_EQ(1U, delegate()->updated_local_ids().count(entry.local_id()));
EXPECT_TRUE(entry.file_specific_info().cache_state().is_present());
EXPECT_TRUE(entry.file_specific_info().cache_state().is_dirty());
- EXPECT_EQ(1U, observer()->get_changed_files().size());
- EXPECT_TRUE(observer()->get_changed_files().count(remote_dest_path));
+ EXPECT_EQ(1U, delegate()->get_changed_files().size());
+ EXPECT_TRUE(delegate()->get_changed_files().count(remote_dest_path));
}
TEST_F(CopyOperationTest, TransferFileFromLocalToRemote_Overwrite) {
@@ -108,12 +108,12 @@ TEST_F(CopyOperationTest, TransferFileFromLocalToRemote_Overwrite) {
// TransferFileFromLocalToRemote stores a copy of the local file in the cache,
// marks it dirty and requests the observer to upload the file.
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(remote_dest_path, &entry));
- EXPECT_EQ(1U, observer()->updated_local_ids().count(entry.local_id()));
+ EXPECT_EQ(1U, delegate()->updated_local_ids().count(entry.local_id()));
EXPECT_TRUE(entry.file_specific_info().cache_state().is_present());
EXPECT_TRUE(entry.file_specific_info().cache_state().is_dirty());
- EXPECT_EQ(1U, observer()->get_changed_files().size());
- EXPECT_TRUE(observer()->get_changed_files().count(remote_dest_path));
+ EXPECT_EQ(1U, delegate()->get_changed_files().size());
+ EXPECT_TRUE(delegate()->get_changed_files().count(remote_dest_path));
}
TEST_F(CopyOperationTest,
@@ -144,8 +144,8 @@ TEST_F(CopyOperationTest,
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(remote_dest_path, &entry));
- EXPECT_EQ(1U, observer()->get_changed_files().size());
- EXPECT_TRUE(observer()->get_changed_files().count(remote_dest_path));
+ EXPECT_EQ(1U, delegate()->get_changed_files().size());
+ EXPECT_TRUE(delegate()->get_changed_files().count(remote_dest_path));
// New copy is created.
EXPECT_NE("document:5_document_resource_id", entry.resource_id());
}
@@ -177,10 +177,10 @@ TEST_F(CopyOperationTest, TransferFileFromLocalToRemote_OrphanHostedDocument) {
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(remote_dest_path, &entry));
EXPECT_EQ(ResourceEntry::DIRTY, entry.metadata_edit_state());
- EXPECT_TRUE(observer()->updated_local_ids().count(entry.local_id()));
+ EXPECT_TRUE(delegate()->updated_local_ids().count(entry.local_id()));
- EXPECT_EQ(1U, observer()->get_changed_files().size());
- EXPECT_TRUE(observer()->get_changed_files().count(remote_dest_path));
+ EXPECT_EQ(1U, delegate()->get_changed_files().size());
+ EXPECT_TRUE(delegate()->get_changed_files().count(remote_dest_path));
// The original document got new parent.
EXPECT_EQ("document:orphan_doc_1", entry.resource_id());
}
@@ -221,8 +221,8 @@ TEST_F(CopyOperationTest, TransferFileFromLocalToRemote_NewHostedDocument) {
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(remote_dest_path, &entry));
- EXPECT_EQ(1U, observer()->get_changed_files().size());
- EXPECT_TRUE(observer()->get_changed_files().count(remote_dest_path));
+ EXPECT_EQ(1U, delegate()->get_changed_files().size());
+ EXPECT_TRUE(delegate()->get_changed_files().count(remote_dest_path));
// The original document got new parent.
EXPECT_EQ(new_gdoc_entry->file_id(), entry.resource_id());
}
@@ -244,7 +244,7 @@ TEST_F(CopyOperationTest, CopyNotExistingFile) {
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(src_path, &entry));
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry));
- EXPECT_TRUE(observer()->get_changed_files().empty());
+ EXPECT_TRUE(delegate()->get_changed_files().empty());
}
TEST_F(CopyOperationTest, CopyFileToNonExistingDirectory) {
@@ -266,7 +266,7 @@ TEST_F(CopyOperationTest, CopyFileToNonExistingDirectory) {
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &entry));
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry));
- EXPECT_TRUE(observer()->get_changed_files().empty());
+ EXPECT_TRUE(delegate()->get_changed_files().empty());
}
// Test the case where the parent of the destination path is an existing file,
@@ -292,7 +292,7 @@ TEST_F(CopyOperationTest, CopyFileToInvalidPath) {
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(src_path, &entry));
EXPECT_EQ(FILE_ERROR_NOT_FOUND, GetLocalResourceEntry(dest_path, &entry));
- EXPECT_TRUE(observer()->get_changed_files().empty());
+ EXPECT_TRUE(delegate()->get_changed_files().empty());
}
TEST_F(CopyOperationTest, CopyDirtyFile) {
@@ -334,10 +334,10 @@ TEST_F(CopyOperationTest, CopyDirtyFile) {
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(dest_path, &dest_entry));
EXPECT_EQ(ResourceEntry::DIRTY, dest_entry.metadata_edit_state());
- EXPECT_EQ(1u, observer()->updated_local_ids().size());
- EXPECT_TRUE(observer()->updated_local_ids().count(dest_entry.local_id()));
- EXPECT_EQ(1u, observer()->get_changed_files().size());
- EXPECT_TRUE(observer()->get_changed_files().count(dest_path));
+ EXPECT_EQ(1u, delegate()->updated_local_ids().size());
+ EXPECT_TRUE(delegate()->updated_local_ids().count(dest_entry.local_id()));
+ EXPECT_EQ(1u, delegate()->get_changed_files().size());
+ EXPECT_TRUE(delegate()->get_changed_files().count(dest_path));
// Copied cache file should be dirty.
EXPECT_TRUE(dest_entry.file_specific_info().cache_state().is_dirty());
@@ -379,10 +379,10 @@ TEST_F(CopyOperationTest, CopyFileOverwriteFile) {
ResourceEntry new_dest_entry;
EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(dest_path, &new_dest_entry));
- EXPECT_EQ(1u, observer()->updated_local_ids().size());
- EXPECT_TRUE(observer()->updated_local_ids().count(old_dest_entry.local_id()));
- EXPECT_EQ(1u, observer()->get_changed_files().size());
- EXPECT_TRUE(observer()->get_changed_files().count(dest_path));
+ EXPECT_EQ(1u, delegate()->updated_local_ids().size());
+ EXPECT_TRUE(delegate()->updated_local_ids().count(old_dest_entry.local_id()));
+ EXPECT_EQ(1u, delegate()->get_changed_files().size());
+ EXPECT_TRUE(delegate()->get_changed_files().count(dest_path));
}
TEST_F(CopyOperationTest, CopyFileOverwriteDirectory) {
@@ -472,7 +472,7 @@ TEST_F(CopyOperationTest, WaitForSyncComplete) {
// This should result in waiting for the directory to sync.
std::string waited_local_id;
FileOperationCallback pending_callback;
- observer()->set_wait_for_sync_complete_handler(
+ delegate()->set_wait_for_sync_complete_handler(
base::Bind(&CopyWaitForSyncCompleteArguments,
&waited_local_id, &pending_callback));

Powered by Google App Engine
This is Rietveld 408576698