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

Side by Side Diff: chrome/browser/chromeos/drive/sync/remove_performer_unittest.cc

Issue 102133008: drive: Call OnDirectoryChanged from EntryRevertPerformer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/drive/sync/remove_performer.h" 5 #include "chrome/browser/chromeos/drive/sync/remove_performer.h"
6 6
7 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h" 7 #include "chrome/browser/chromeos/drive/file_system/operation_test_base.h"
8 #include "chrome/browser/drive/fake_drive_service.h" 8 #include "chrome/browser/drive/fake_drive_service.h"
9 #include "google_apis/drive/gdata_wapi_parser.h" 9 #include "google_apis/drive/gdata_wapi_parser.h"
10 #include "google_apis/drive/test_util.h" 10 #include "google_apis/drive/test_util.h"
11 11
12 namespace drive { 12 namespace drive {
13 namespace internal { 13 namespace internal {
14 14
15 typedef file_system::OperationTestBase RemovePerformerTest; 15 typedef file_system::OperationTestBase RemovePerformerTest;
16 16
17 TEST_F(RemovePerformerTest, RemoveFile) { 17 TEST_F(RemovePerformerTest, RemoveFile) {
18 RemovePerformer performer(blocking_task_runner(), scheduler(), metadata()); 18 RemovePerformer performer(blocking_task_runner(), observer(), scheduler(),
19 metadata());
19 20
20 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt")); 21 base::FilePath file_in_root(FILE_PATH_LITERAL("drive/root/File 1.txt"));
21 base::FilePath file_in_subdir( 22 base::FilePath file_in_subdir(
22 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); 23 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt"));
23 24
24 // Remove a file in root. 25 // Remove a file in root.
25 ResourceEntry entry; 26 ResourceEntry entry;
26 FileError error = FILE_ERROR_FAILED; 27 FileError error = FILE_ERROR_FAILED;
27 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &entry)); 28 ASSERT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(file_in_root, &entry));
28 performer.Remove(entry.local_id(), 29 performer.Remove(entry.local_id(),
(...skipping 24 matching lines...) Expand all
53 54
54 // Try removing non-existing file. 55 // Try removing non-existing file.
55 error = FILE_ERROR_FAILED; 56 error = FILE_ERROR_FAILED;
56 performer.Remove("non-existing-id", 57 performer.Remove("non-existing-id",
57 google_apis::test_util::CreateCopyResultCallback(&error)); 58 google_apis::test_util::CreateCopyResultCallback(&error));
58 test_util::RunBlockingPoolTask(); 59 test_util::RunBlockingPoolTask();
59 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error); 60 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error);
60 } 61 }
61 62
62 TEST_F(RemovePerformerTest, RemoveShared) { 63 TEST_F(RemovePerformerTest, RemoveShared) {
63 RemovePerformer performer(blocking_task_runner(), scheduler(), metadata()); 64 RemovePerformer performer(blocking_task_runner(), observer(), scheduler(),
65 metadata());
64 66
65 const base::FilePath kPathInMyDrive(FILE_PATH_LITERAL( 67 const base::FilePath kPathInMyDrive(FILE_PATH_LITERAL(
66 "drive/root/shared.txt")); 68 "drive/root/shared.txt"));
67 const base::FilePath kPathInOther(FILE_PATH_LITERAL( 69 const base::FilePath kPathInOther(FILE_PATH_LITERAL(
68 "drive/other/shared.txt")); 70 "drive/other/shared.txt"));
69 71
70 // Prepare a shared file to the root folder. 72 // Prepare a shared file to the root folder.
71 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR; 73 google_apis::GDataErrorCode gdata_error = google_apis::GDATA_OTHER_ERROR;
72 scoped_ptr<google_apis::ResourceEntry> gdata_entry; 74 scoped_ptr<google_apis::ResourceEntry> gdata_entry;
73 fake_service()->AddNewFile( 75 fake_service()->AddNewFile(
(...skipping 28 matching lines...) Expand all
102 google_apis::test_util::CreateCopyResultCallback(&gdata_error, 104 google_apis::test_util::CreateCopyResultCallback(&gdata_error,
103 &gdata_entry)); 105 &gdata_entry));
104 test_util::RunBlockingPoolTask(); 106 test_util::RunBlockingPoolTask();
105 ASSERT_EQ(google_apis::HTTP_SUCCESS, gdata_error); 107 ASSERT_EQ(google_apis::HTTP_SUCCESS, gdata_error);
106 EXPECT_FALSE(gdata_entry->deleted()); // It's not deleted. 108 EXPECT_FALSE(gdata_entry->deleted()); // It's not deleted.
107 EXPECT_FALSE(gdata_entry->GetLinkByType(google_apis::Link::LINK_PARENT)); 109 EXPECT_FALSE(gdata_entry->GetLinkByType(google_apis::Link::LINK_PARENT));
108 } 110 }
109 111
110 } // namespace internal 112 } // namespace internal
111 } // namespace drive 113 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/sync/remove_performer.cc ('k') | chrome/browser/chromeos/drive/sync_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698