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

Side by Side Diff: chrome/browser/chromeos/drive/drive_resource_metadata_unittest.cc

Issue 11293247: Make DriveFeedProcessor asynchronous. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: remove drive_files.h from unittest Created 8 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/drive_resource_metadata.h" 5 #include "chrome/browser/chromeos/drive/drive_resource_metadata.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
14 #include "base/threading/sequenced_worker_pool.h" 14 #include "base/threading/sequenced_worker_pool.h"
15 #include "base/message_loop.h" 15 #include "base/message_loop.h"
16 #include "chrome/browser/chromeos/drive/drive.pb.h" 16 #include "chrome/browser/chromeos/drive/drive.pb.h"
17 #include "chrome/browser/chromeos/drive/drive_cache.h" 17 #include "chrome/browser/chromeos/drive/drive_cache.h"
18 #include "chrome/browser/chromeos/drive/drive_files.h"
19 #include "chrome/browser/chromeos/drive/drive_test_util.h" 18 #include "chrome/browser/chromeos/drive/drive_test_util.h"
20 #include "chrome/test/base/testing_profile.h" 19 #include "chrome/test/base/testing_profile.h"
21 #include "content/public/test/test_browser_thread.h" 20 #include "content/public/test/test_browser_thread.h"
22 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
23 22
24 namespace drive { 23 namespace drive {
25 namespace { 24 namespace {
26 25
27 // See drive.proto for the difference between the two URLs. 26 // See drive.proto for the difference between the two URLs.
28 const char kResumableEditMediaUrl[] = "http://resumable-edit-media/"; 27 const char kResumableEditMediaUrl[] = "http://resumable-edit-media/";
29 const char kResumableCreateMediaUrl[] = "http://resumable-create-media/"; 28 const char kResumableCreateMediaUrl[] = "http://resumable-create-media/";
30 29
31 // Callback for DriveResourceMetadata::InitFromDB. 30 // Callback for DriveResourceMetadata::InitFromDB.
32 void InitFromDBCallback(DriveFileError expected_error, 31 void CopyResultsFromInitFromDBCallback(DriveFileError* expected_error,
33 DriveFileError actual_error) { 32 DriveFileError actual_error) {
34 EXPECT_EQ(expected_error, actual_error); 33 *expected_error = actual_error;
34 }
35
36 void OnGetChangedDirectories(std::set<FilePath>* out_changed_directories,
37 const std::set<FilePath>& in_changed_directories) {
38 *out_changed_directories = in_changed_directories;
35 } 39 }
36 40
37 } // namespace 41 } // namespace
38 42
39 class DriveResourceMetadataTest : public testing::Test { 43 class DriveResourceMetadataTest : public testing::Test {
40 public: 44 public:
41 DriveResourceMetadataTest(); 45 DriveResourceMetadataTest();
42 46
43 protected: 47 protected:
48 // Creates a DriveEntryProto.
49 DriveEntryProto CreateDriveEntryProto(int sequence_id,
50 bool is_directory,
51 const std::string& parent_resource_id);
52
44 DriveResourceMetadata resource_metadata_; 53 DriveResourceMetadata resource_metadata_;
45 54
46 private: 55 private:
47 // Creates the following files/directories 56 // Creates the following files/directories
48 // drive/dir1/ 57 // drive/dir1/
49 // drive/dir2/ 58 // drive/dir2/
50 // drive/dir1/dir3/ 59 // drive/dir1/dir3/
51 // drive/dir1/file4 60 // drive/dir1/file4
52 // drive/dir1/file5 61 // drive/dir1/file5
53 // drive/dir2/file6 62 // drive/dir2/file6
54 // drive/dir2/file7 63 // drive/dir2/file7
55 // drive/dir2/file8 64 // drive/dir2/file8
56 // drive/dir1/dir3/file9 65 // drive/dir1/dir3/file9
57 // drive/dir1/dir3/file10 66 // drive/dir1/dir3/file10
58 void Init(); 67 void Init();
59 68
60 // Add a directory to |parent| and return that directory. The name and 69 // Add a DriveEntryProto to the metadata tree.
61 // resource_id are determined by the incrementing counter |sequence_id|. 70 void AddDriveEntryProto(int sequence_id,
62 DriveDirectory* AddDirectory(DriveDirectory* parent, int sequence_id); 71 bool is_directory,
63 72 const std::string& parent_resource_id);
64 // Add a file to |parent| and return that file. The name and
65 // resource_id are determined by the incrementing counter |sequence_id|.
66 DriveFile* AddFile(DriveDirectory* parent, int sequence_id);
67 73
68 MessageLoopForUI message_loop_; 74 MessageLoopForUI message_loop_;
69 content::TestBrowserThread ui_thread_; 75 content::TestBrowserThread ui_thread_;
70 }; 76 };
71 77
72 DriveResourceMetadataTest::DriveResourceMetadataTest() 78 DriveResourceMetadataTest::DriveResourceMetadataTest()
73 : ui_thread_(content::BrowserThread::UI, &message_loop_) { 79 : ui_thread_(content::BrowserThread::UI, &message_loop_) {
74 Init(); 80 Init();
75 } 81 }
76 82
77 void DriveResourceMetadataTest::Init() { 83 void DriveResourceMetadataTest::Init() {
78 resource_metadata_.InitializeRootEntry(kWAPIRootDirectoryResourceId); 84 resource_metadata_.InitializeRootEntry(kWAPIRootDirectoryResourceId);
79 85
80 int sequence_id = 1; 86 int sequence_id = 1;
81 DriveDirectory* dir1 = AddDirectory(resource_metadata_.root(), sequence_id++); 87 AddDriveEntryProto(sequence_id++, true, kWAPIRootDirectoryResourceId);
82 DriveDirectory* dir2 = AddDirectory(resource_metadata_.root(), sequence_id++); 88 AddDriveEntryProto(sequence_id++, true, kWAPIRootDirectoryResourceId);
83 DriveDirectory* dir3 = AddDirectory(dir1, sequence_id++); 89 AddDriveEntryProto(sequence_id++, true, "resource_id:dir1");
84 90
85 AddFile(dir1, sequence_id++); 91 AddDriveEntryProto(sequence_id++, false, "resource_id:dir1");
86 AddFile(dir1, sequence_id++); 92 AddDriveEntryProto(sequence_id++, false, "resource_id:dir1");
87 93
88 AddFile(dir2, sequence_id++); 94 AddDriveEntryProto(sequence_id++, false, "resource_id:dir2");
89 AddFile(dir2, sequence_id++); 95 AddDriveEntryProto(sequence_id++, false, "resource_id:dir2");
90 AddFile(dir2, sequence_id++); 96 AddDriveEntryProto(sequence_id++, false, "resource_id:dir2");
91 97
92 AddFile(dir3, sequence_id++); 98 AddDriveEntryProto(sequence_id++, false, "resource_id:dir3");
93 AddFile(dir3, sequence_id++); 99 AddDriveEntryProto(sequence_id++, false, "resource_id:dir3");
94 } 100 }
95 101
96 DriveDirectory* DriveResourceMetadataTest::AddDirectory(DriveDirectory* parent, 102 DriveEntryProto DriveResourceMetadataTest::CreateDriveEntryProto(
97 int sequence_id) { 103 int sequence_id,
98 scoped_ptr<DriveDirectory> dir = resource_metadata_.CreateDriveDirectory(); 104 bool is_directory,
99 const std::string dir_name = "dir" + base::IntToString(sequence_id); 105 const std::string& parent_resource_id) {
100 const std::string resource_id = std::string("dir_resource_id:") + dir_name; 106 DriveEntryProto entry_proto;
101 dir->set_title(dir_name); 107 const std::string sequence_id_str = base::IntToString(sequence_id);
102 dir->set_resource_id(resource_id); 108 const std::string title = (is_directory ? "dir" : "file") +
109 sequence_id_str;
110 const std::string resource_id = "resource_id:" + title;
111 entry_proto.set_title(title);
112 entry_proto.set_resource_id(resource_id);
113 entry_proto.set_parent_resource_id(parent_resource_id);
103 114
104 parent->AddEntry(dir.get()); 115 PlatformFileInfoProto* file_info = entry_proto.mutable_file_info();
116 file_info->set_is_directory(is_directory);
105 117
106 return dir.release(); 118 if (!is_directory) {
119 DriveFileSpecificInfo* file_specific_info =
120 entry_proto.mutable_file_specific_info();
121 file_info->set_size(sequence_id * 1024);
122 file_specific_info->set_file_md5(std::string("md5:") + title);
123 }
124 return entry_proto;
107 } 125 }
108 126
109 DriveFile* DriveResourceMetadataTest::AddFile(DriveDirectory* parent, 127 void DriveResourceMetadataTest::AddDriveEntryProto(
110 int sequence_id) { 128 int sequence_id,
111 scoped_ptr<DriveFile> file = resource_metadata_.CreateDriveFile(); 129 bool is_directory,
112 const std::string title = "file" + base::IntToString(sequence_id); 130 const std::string& parent_resource_id) {
113 const std::string resource_id = std::string("file_resource_id:") + title; 131 DriveEntryProto entry_proto = CreateDriveEntryProto(sequence_id,
114 file->set_title(title); 132 is_directory,
115 file->set_resource_id(resource_id); 133 parent_resource_id);
116 file->set_file_md5(std::string("file_md5:") + title); 134 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
135 FilePath drive_file_path;
117 136
118 parent->AddEntry(file.get()); 137 resource_metadata_.AddEntryToParent(
119 138 entry_proto,
120 return file.release(); 139 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
140 &error, &drive_file_path));
141 google_apis::test_util::RunBlockingPoolTask();
142 ASSERT_EQ(DRIVE_FILE_OK, error);
121 } 143 }
122 144
123 TEST_F(DriveResourceMetadataTest, VersionCheck) { 145 TEST_F(DriveResourceMetadataTest, VersionCheck) {
124 // Set up the root directory. 146 // Set up the root directory.
125 DriveRootDirectoryProto proto; 147 DriveRootDirectoryProto proto;
126 DriveEntryProto* mutable_entry = 148 DriveEntryProto* mutable_entry =
127 proto.mutable_drive_directory()->mutable_drive_entry(); 149 proto.mutable_drive_directory()->mutable_drive_entry();
128 mutable_entry->mutable_file_info()->set_is_directory(true); 150 mutable_entry->mutable_file_info()->set_is_directory(true);
129 mutable_entry->set_resource_id(kWAPIRootDirectoryResourceId); 151 mutable_entry->set_resource_id(kWAPIRootDirectoryResourceId);
130 mutable_entry->set_upload_url(kResumableCreateMediaUrl); 152 mutable_entry->set_upload_url(kResumableCreateMediaUrl);
(...skipping 20 matching lines...) Expand all
151 173
152 // Set a newer version, and serialize. 174 // Set a newer version, and serialize.
153 proto.set_version(kProtoVersion + 1); 175 proto.set_version(kProtoVersion + 1);
154 ASSERT_TRUE(proto.SerializeToString(&serialized_proto)); 176 ASSERT_TRUE(proto.SerializeToString(&serialized_proto));
155 // This should fail as the version is newer. 177 // This should fail as the version is newer.
156 ASSERT_FALSE(resource_metadata.ParseFromString(serialized_proto)); 178 ASSERT_FALSE(resource_metadata.ParseFromString(serialized_proto));
157 } 179 }
158 180
159 TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) { 181 TEST_F(DriveResourceMetadataTest, GetEntryByResourceId_RootDirectory) {
160 DriveResourceMetadata resource_metadata; 182 DriveResourceMetadata resource_metadata;
183
184 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
185 FilePath drive_file_path;
186 scoped_ptr<DriveEntryProto> entry_proto;
187
161 // Look up the root directory by its resource ID. 188 // Look up the root directory by its resource ID.
162 DriveEntry* entry = resource_metadata.GetEntryByResourceId( 189 resource_metadata.GetEntryInfoByResourceId(
163 kWAPIRootDirectoryResourceId); 190 kWAPIRootDirectoryResourceId,
164 ASSERT_FALSE(entry); 191 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
192 &error, &drive_file_path, &entry_proto));
193 google_apis::test_util::RunBlockingPoolTask();
194 ASSERT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
195
165 // Initialize root and look it up again. 196 // Initialize root and look it up again.
166 resource_metadata.InitializeRootEntry(kWAPIRootDirectoryResourceId); 197 resource_metadata.InitializeRootEntry(kWAPIRootDirectoryResourceId);
167 entry = resource_metadata.GetEntryByResourceId(
168 kWAPIRootDirectoryResourceId);
169 ASSERT_TRUE(entry);
170 198
171 EXPECT_EQ(kWAPIRootDirectoryResourceId, entry->resource_id()); 199 resource_metadata.GetEntryInfoByResourceId(
200 kWAPIRootDirectoryResourceId,
201 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
202 &error, &drive_file_path, &entry_proto));
203 google_apis::test_util::RunBlockingPoolTask();
204 EXPECT_EQ(DRIVE_FILE_OK, error);
205 ASSERT_TRUE(entry_proto.get());
206 EXPECT_EQ(kWAPIRootDirectoryResourceId, entry_proto->resource_id());
207 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive"), drive_file_path);
172 } 208 }
173 209
174 TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) { 210 TEST_F(DriveResourceMetadataTest, GetEntryInfoByResourceId) {
175 // Confirm that an existing file is found. 211 // Confirm that an existing file is found.
176 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 212 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
177 FilePath drive_file_path; 213 FilePath drive_file_path;
178 scoped_ptr<DriveEntryProto> entry_proto; 214 scoped_ptr<DriveEntryProto> entry_proto;
179 resource_metadata_.GetEntryInfoByResourceId( 215 resource_metadata_.GetEntryInfoByResourceId(
180 "file_resource_id:file4", 216 "resource_id:file4",
181 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 217 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
182 &error, &drive_file_path, &entry_proto)); 218 &error, &drive_file_path, &entry_proto));
183 google_apis::test_util::RunBlockingPoolTask(); 219 google_apis::test_util::RunBlockingPoolTask();
184 EXPECT_EQ(DRIVE_FILE_OK, error); 220 EXPECT_EQ(DRIVE_FILE_OK, error);
185 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path); 221 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file4"), drive_file_path);
186 ASSERT_TRUE(entry_proto.get()); 222 ASSERT_TRUE(entry_proto.get());
187 EXPECT_EQ("file4", entry_proto->base_name()); 223 EXPECT_EQ("file4", entry_proto->base_name());
188 224
189 // Confirm that a non existing file is not found. 225 // Confirm that a non existing file is not found.
190 error = DRIVE_FILE_ERROR_FAILED; 226 error = DRIVE_FILE_ERROR_FAILED;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 TestingProfile profile; 370 TestingProfile profile;
335 scoped_refptr<base::SequencedWorkerPool> pool = 371 scoped_refptr<base::SequencedWorkerPool> pool =
336 content::BrowserThread::GetBlockingPool(); 372 content::BrowserThread::GetBlockingPool();
337 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner = 373 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner =
338 pool->GetSequencedTaskRunner(pool->GetSequenceToken()); 374 pool->GetSequencedTaskRunner(pool->GetSequenceToken());
339 375
340 FilePath db_path(DriveCache::GetCacheRootPath(&profile). 376 FilePath db_path(DriveCache::GetCacheRootPath(&profile).
341 AppendASCII("meta").AppendASCII("resource_metadata.db")); 377 AppendASCII("meta").AppendASCII("resource_metadata.db"));
342 // InitFromDB should fail with DRIVE_FILE_ERROR_NOT_FOUND since the db 378 // InitFromDB should fail with DRIVE_FILE_ERROR_NOT_FOUND since the db
343 // doesn't exist. 379 // doesn't exist.
344 resource_metadata_.InitFromDB(db_path, blocking_task_runner, 380 DriveFileError db_error;
345 base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_NOT_FOUND)); 381 resource_metadata_.InitFromDB(
382 db_path,
383 blocking_task_runner,
384 base::Bind(&CopyResultsFromInitFromDBCallback, &db_error));
346 google_apis::test_util::RunBlockingPoolTask(); 385 google_apis::test_util::RunBlockingPoolTask();
386 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, db_error);
347 387
348 // Create a file system and write it to disk. 388 // Create a file system and write it to disk.
349 // We cannot call SaveToDB without first having called InitFromDB because 389 // We cannot call SaveToDB without first having called InitFromDB because
350 // InitFrom initializes the db_path and blocking_task_runner needed by 390 // InitFrom initializes the db_path and blocking_task_runner needed by
351 // SaveToDB. 391 // SaveToDB.
352 resource_metadata_.SaveToDB(); 392 resource_metadata_.SaveToDB();
353 google_apis::test_util::RunBlockingPoolTask(); 393 google_apis::test_util::RunBlockingPoolTask();
354 394
355 // InitFromDB should fail with DRIVE_FILE_ERROR_IN_USE. 395 // InitFromDB should fail with DRIVE_FILE_ERROR_IN_USE.
356 resource_metadata_.InitFromDB(db_path, blocking_task_runner, 396 resource_metadata_.InitFromDB(
357 base::Bind(&InitFromDBCallback, DRIVE_FILE_ERROR_IN_USE)); 397 db_path,
398 blocking_task_runner,
399 base::Bind(&CopyResultsFromInitFromDBCallback, &db_error));
358 google_apis::test_util::RunBlockingPoolTask(); 400 google_apis::test_util::RunBlockingPoolTask();
401 EXPECT_EQ(DRIVE_FILE_ERROR_IN_USE, db_error);
359 402
360 // InitFromDB should succeed. 403 // InitFromDB should succeed.
361 DriveResourceMetadata test_resource_metadata; 404 DriveResourceMetadata test_resource_metadata;
362 test_resource_metadata.InitializeRootEntry(kWAPIRootDirectoryResourceId); 405 test_resource_metadata.InitializeRootEntry(kWAPIRootDirectoryResourceId);
363 test_resource_metadata.InitFromDB(db_path, blocking_task_runner, 406 test_resource_metadata.InitFromDB(
364 base::Bind(&InitFromDBCallback, DRIVE_FILE_OK)); 407 db_path,
408 blocking_task_runner,
409 base::Bind(&CopyResultsFromInitFromDBCallback, &db_error));
365 google_apis::test_util::RunBlockingPoolTask(); 410 google_apis::test_util::RunBlockingPoolTask();
411 EXPECT_EQ(DRIVE_FILE_OK, db_error);
366 412
367 // Verify by checking for drive/dir2, which should have 3 children. 413 // Verify by checking for drive/dir2, which should have 3 children.
368 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 414 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
369 scoped_ptr<DriveEntryProtoVector> entries; 415 scoped_ptr<DriveEntryProtoVector> entries;
370 test_resource_metadata.ReadDirectoryByPath( 416 test_resource_metadata.ReadDirectoryByPath(
371 FilePath::FromUTF8Unsafe("drive/dir2"), 417 FilePath::FromUTF8Unsafe("drive/dir2"),
372 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, 418 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback,
373 &error, &entries)); 419 &error, &entries));
374 google_apis::test_util::RunBlockingPoolTask(); 420 google_apis::test_util::RunBlockingPoolTask();
375 EXPECT_EQ(DRIVE_FILE_OK, error); 421 EXPECT_EQ(DRIVE_FILE_OK, error);
376 ASSERT_TRUE(entries.get()); 422 ASSERT_TRUE(entries.get());
377 ASSERT_EQ(3U, entries->size()); 423 ASSERT_EQ(3U, entries->size());
378 } 424 }
379 425
380 TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) { 426 TEST_F(DriveResourceMetadataTest, RemoveEntryFromParent) {
381 // Make sure file9 is found. 427 // Make sure file9 is found.
382 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 428 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
383 FilePath drive_file_path; 429 FilePath drive_file_path;
384 const std::string file9_resource_id = "file_resource_id:file9"; 430 const std::string file9_resource_id = "resource_id:file9";
385 scoped_ptr<DriveEntryProto> entry_proto; 431 scoped_ptr<DriveEntryProto> entry_proto;
386 resource_metadata_.GetEntryInfoByResourceId( 432 resource_metadata_.GetEntryInfoByResourceId(
387 file9_resource_id, 433 file9_resource_id,
388 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 434 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
389 &error, &drive_file_path, &entry_proto)); 435 &error, &drive_file_path, &entry_proto));
390 google_apis::test_util::RunBlockingPoolTask(); 436 google_apis::test_util::RunBlockingPoolTask();
391 EXPECT_EQ(DRIVE_FILE_OK, error); 437 EXPECT_EQ(DRIVE_FILE_OK, error);
392 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), drive_file_path); 438 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"), drive_file_path);
393 ASSERT_TRUE(entry_proto.get()); 439 ASSERT_TRUE(entry_proto.get());
394 EXPECT_EQ("file9", entry_proto->base_name()); 440 EXPECT_EQ("file9", entry_proto->base_name());
(...skipping 10 matching lines...) Expand all
405 // file9 should no longer exist. 451 // file9 should no longer exist.
406 resource_metadata_.GetEntryInfoByResourceId( 452 resource_metadata_.GetEntryInfoByResourceId(
407 file9_resource_id, 453 file9_resource_id,
408 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 454 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
409 &error, &drive_file_path, &entry_proto)); 455 &error, &drive_file_path, &entry_proto));
410 google_apis::test_util::RunBlockingPoolTask(); 456 google_apis::test_util::RunBlockingPoolTask();
411 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 457 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
412 EXPECT_FALSE(entry_proto.get()); 458 EXPECT_FALSE(entry_proto.get());
413 459
414 // Look for dir3. 460 // Look for dir3.
415 const std::string dir3_resource_id = "dir_resource_id:dir3"; 461 const std::string dir3_resource_id = "resource_id:dir3";
416 resource_metadata_.GetEntryInfoByResourceId( 462 resource_metadata_.GetEntryInfoByResourceId(
417 dir3_resource_id, 463 dir3_resource_id,
418 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 464 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
419 &error, &drive_file_path, &entry_proto)); 465 &error, &drive_file_path, &entry_proto));
420 google_apis::test_util::RunBlockingPoolTask(); 466 google_apis::test_util::RunBlockingPoolTask();
421 EXPECT_EQ(DRIVE_FILE_OK, error); 467 EXPECT_EQ(DRIVE_FILE_OK, error);
422 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path); 468 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3"), drive_file_path);
423 ASSERT_TRUE(entry_proto.get()); 469 ASSERT_TRUE(entry_proto.get());
424 EXPECT_EQ("dir3", entry_proto->base_name()); 470 EXPECT_EQ("dir3", entry_proto->base_name());
425 471
(...skipping 18 matching lines...) Expand all
444 // Remove unknown resource_id using RemoveEntryFromParent. 490 // Remove unknown resource_id using RemoveEntryFromParent.
445 resource_metadata_.RemoveEntryFromParent( 491 resource_metadata_.RemoveEntryFromParent(
446 "foo", 492 "foo",
447 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 493 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
448 &error, &drive_file_path)); 494 &error, &drive_file_path));
449 google_apis::test_util::RunBlockingPoolTask(); 495 google_apis::test_util::RunBlockingPoolTask();
450 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 496 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
451 497
452 // Try removing root. This should fail. 498 // Try removing root. This should fail.
453 resource_metadata_.RemoveEntryFromParent( 499 resource_metadata_.RemoveEntryFromParent(
454 resource_metadata_.root()->resource_id(), 500 kWAPIRootDirectoryResourceId,
455 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 501 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
456 &error, &drive_file_path)); 502 &error, &drive_file_path));
457 google_apis::test_util::RunBlockingPoolTask(); 503 google_apis::test_util::RunBlockingPoolTask();
458 EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error); 504 EXPECT_EQ(DRIVE_FILE_ERROR_ACCESS_DENIED, error);
459 } 505 }
460 506
461 TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) { 507 TEST_F(DriveResourceMetadataTest, MoveEntryToDirectory) {
462 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 508 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
463 FilePath drive_file_path; 509 FilePath drive_file_path;
464 scoped_ptr<DriveEntryProto> entry_proto; 510 scoped_ptr<DriveEntryProto> entry_proto;
465 511
466 // Move file8 to drive/dir1. 512 // Move file8 to drive/dir1.
467 resource_metadata_.MoveEntryToDirectory( 513 resource_metadata_.MoveEntryToDirectory(
468 FilePath::FromUTF8Unsafe("drive/dir2/file8"), 514 FilePath::FromUTF8Unsafe("drive/dir2/file8"),
469 FilePath::FromUTF8Unsafe("drive/dir1"), 515 FilePath::FromUTF8Unsafe("drive/dir1"),
470 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 516 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
471 &error, &drive_file_path)); 517 &error, &drive_file_path));
472 google_apis::test_util::RunBlockingPoolTask(); 518 google_apis::test_util::RunBlockingPoolTask();
473 EXPECT_EQ(DRIVE_FILE_OK, error); 519 EXPECT_EQ(DRIVE_FILE_OK, error);
474 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); 520 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path);
475 521
476 // Look up the entry by its resource id and make sure it really moved. 522 // Look up the entry by its resource id and make sure it really moved.
477 resource_metadata_.GetEntryInfoByResourceId( 523 resource_metadata_.GetEntryInfoByResourceId(
478 "file_resource_id:file8", 524 "resource_id:file8",
479 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 525 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
480 &error, &drive_file_path, &entry_proto)); 526 &error, &drive_file_path, &entry_proto));
481 google_apis::test_util::RunBlockingPoolTask(); 527 google_apis::test_util::RunBlockingPoolTask();
482 EXPECT_EQ(DRIVE_FILE_OK, error); 528 EXPECT_EQ(DRIVE_FILE_OK, error);
483 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path); 529 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/file8"), drive_file_path);
484 530
485 // Move non-existent file to drive/dir1. This should fail. 531 // Move non-existent file to drive/dir1. This should fail.
486 resource_metadata_.MoveEntryToDirectory( 532 resource_metadata_.MoveEntryToDirectory(
487 FilePath::FromUTF8Unsafe("drive/dir2/file8"), 533 FilePath::FromUTF8Unsafe("drive/dir2/file8"),
488 FilePath::FromUTF8Unsafe("drive/dir1"), 534 FilePath::FromUTF8Unsafe("drive/dir1"),
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 FilePath::FromUTF8Unsafe("drive/file8"), 573 FilePath::FromUTF8Unsafe("drive/file8"),
528 FilePath::FromUTF8Unsafe("drive/dir2"), 574 FilePath::FromUTF8Unsafe("drive/dir2"),
529 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 575 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
530 &error, &drive_file_path)); 576 &error, &drive_file_path));
531 google_apis::test_util::RunBlockingPoolTask(); 577 google_apis::test_util::RunBlockingPoolTask();
532 EXPECT_EQ(DRIVE_FILE_OK, error); 578 EXPECT_EQ(DRIVE_FILE_OK, error);
533 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); 579 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path);
534 580
535 // Make sure file is still ok. 581 // Make sure file is still ok.
536 resource_metadata_.GetEntryInfoByResourceId( 582 resource_metadata_.GetEntryInfoByResourceId(
537 "file_resource_id:file8", 583 "resource_id:file8",
538 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 584 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
539 &error, &drive_file_path, &entry_proto)); 585 &error, &drive_file_path, &entry_proto));
540 google_apis::test_util::RunBlockingPoolTask(); 586 google_apis::test_util::RunBlockingPoolTask();
541 EXPECT_EQ(DRIVE_FILE_OK, error); 587 EXPECT_EQ(DRIVE_FILE_OK, error);
542 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path); 588 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file8"), drive_file_path);
543 } 589 }
544 590
545 TEST_F(DriveResourceMetadataTest, RenameEntry) { 591 TEST_F(DriveResourceMetadataTest, RenameEntry) {
546 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 592 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
547 FilePath drive_file_path; 593 FilePath drive_file_path;
548 scoped_ptr<DriveEntryProto> entry_proto; 594 scoped_ptr<DriveEntryProto> entry_proto;
549 595
550 // Rename file8 to file11. 596 // Rename file8 to file11.
551 resource_metadata_.RenameEntry( 597 resource_metadata_.RenameEntry(
552 FilePath::FromUTF8Unsafe("drive/dir2/file8"), 598 FilePath::FromUTF8Unsafe("drive/dir2/file8"),
553 "file11", 599 "file11",
554 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 600 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
555 &error, &drive_file_path)); 601 &error, &drive_file_path));
556 google_apis::test_util::RunBlockingPoolTask(); 602 google_apis::test_util::RunBlockingPoolTask();
557 EXPECT_EQ(DRIVE_FILE_OK, error); 603 EXPECT_EQ(DRIVE_FILE_OK, error);
558 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); 604 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path);
559 605
560 // Lookup the file by resource id to make sure the file actually got renamed. 606 // Lookup the file by resource id to make sure the file actually got renamed.
561 resource_metadata_.GetEntryInfoByResourceId( 607 resource_metadata_.GetEntryInfoByResourceId(
562 "file_resource_id:file8", 608 "resource_id:file8",
563 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback, 609 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
564 &error, &drive_file_path, &entry_proto)); 610 &error, &drive_file_path, &entry_proto));
565 google_apis::test_util::RunBlockingPoolTask(); 611 google_apis::test_util::RunBlockingPoolTask();
566 EXPECT_EQ(DRIVE_FILE_OK, error); 612 EXPECT_EQ(DRIVE_FILE_OK, error);
567 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path); 613 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2/file11"), drive_file_path);
568 614
569 // Rename to file7 to force a duplicate name. 615 // Rename to file7 to force a duplicate name.
570 resource_metadata_.RenameEntry( 616 resource_metadata_.RenameEntry(
571 FilePath::FromUTF8Unsafe("drive/dir2/file11"), 617 FilePath::FromUTF8Unsafe("drive/dir2/file11"),
572 "file7", 618 "file7",
(...skipping 17 matching lines...) Expand all
590 resource_metadata_.RenameEntry( 636 resource_metadata_.RenameEntry(
591 FilePath::FromUTF8Unsafe("drive/dir2/file11"), 637 FilePath::FromUTF8Unsafe("drive/dir2/file11"),
592 "file11", 638 "file11",
593 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 639 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
594 &error, &drive_file_path)); 640 &error, &drive_file_path));
595 google_apis::test_util::RunBlockingPoolTask(); 641 google_apis::test_util::RunBlockingPoolTask();
596 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error); 642 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
597 EXPECT_EQ(FilePath(), drive_file_path); 643 EXPECT_EQ(FilePath(), drive_file_path);
598 } 644 }
599 645
646 TEST_F(DriveResourceMetadataTest, RefreshEntryProto) {
647 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
648 FilePath drive_file_path;
649 scoped_ptr<DriveEntryProto> entry_proto;
650
651 // Get file9.
652 resource_metadata_.GetEntryInfoByPath(
653 FilePath::FromUTF8Unsafe("drive/dir1/dir3/file9"),
654 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
655 &error, &entry_proto));
656 google_apis::test_util::RunBlockingPoolTask();
657 EXPECT_EQ(DRIVE_FILE_OK, error);
658 ASSERT_TRUE(entry_proto.get());
659 EXPECT_EQ("file9", entry_proto->base_name());
660 ASSERT_TRUE(entry_proto->has_file_specific_info());
661 EXPECT_EQ("md5:file9", entry_proto->file_specific_info().file_md5());
662
663 // Rename it and change the file size.
664 DriveEntryProto file_entry_proto(*entry_proto);
665 const std::string updated_md5("md5:updated");
666 file_entry_proto.mutable_file_specific_info()->set_file_md5(updated_md5);
667 file_entry_proto.set_title("file100");
668 entry_proto.reset();
669 resource_metadata_.RefreshEntryProto(
670 file_entry_proto,
671 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
672 &error, &drive_file_path, &entry_proto));
673 google_apis::test_util::RunBlockingPoolTask();
674 EXPECT_EQ(DRIVE_FILE_OK, error);
675 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"),
676 drive_file_path);
677 ASSERT_TRUE(entry_proto.get());
678 EXPECT_EQ("file100", entry_proto->base_name());
679 ASSERT_TRUE(entry_proto->has_file_specific_info());
680 EXPECT_EQ(updated_md5, entry_proto->file_specific_info().file_md5());
681
682 // Make sure we get the same thing from GetEntryInfoByPath.
683 entry_proto.reset();
684 resource_metadata_.GetEntryInfoByPath(
685 FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"),
686 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
687 &error, &entry_proto));
688 google_apis::test_util::RunBlockingPoolTask();
689 EXPECT_EQ(DRIVE_FILE_OK, error);
690 ASSERT_TRUE(entry_proto.get());
691 EXPECT_EQ("file100", entry_proto->base_name());
692 ASSERT_TRUE(entry_proto->has_file_specific_info());
693 EXPECT_EQ(updated_md5, entry_proto->file_specific_info().file_md5());
694
695 // Get dir2.
696 entry_proto.reset();
697 resource_metadata_.GetEntryInfoByPath(
698 FilePath::FromUTF8Unsafe("drive/dir2"),
699 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
700 &error, &entry_proto));
701 google_apis::test_util::RunBlockingPoolTask();
702 EXPECT_EQ(DRIVE_FILE_OK, error);
703 ASSERT_TRUE(entry_proto.get());
704 EXPECT_EQ("dir2", entry_proto->base_name());
705 ASSERT_TRUE(entry_proto->file_info().is_directory());
706
707 // Change the name to dir100 and change the parent to drive/dir1/dir3.
708 DriveEntryProto dir_entry_proto(*entry_proto);
709 dir_entry_proto.set_title("dir100");
710 dir_entry_proto.set_parent_resource_id("resource_id:dir3");
711 entry_proto.reset();
712 resource_metadata_.RefreshEntryProto(
713 dir_entry_proto,
714 base::Bind(&test_util::CopyResultsFromGetEntryInfoWithFilePathCallback,
715 &error, &drive_file_path, &entry_proto));
716 google_apis::test_util::RunBlockingPoolTask();
717 EXPECT_EQ(DRIVE_FILE_OK, error);
718 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100"),
719 drive_file_path);
720 ASSERT_TRUE(entry_proto.get());
721 EXPECT_EQ("dir100", entry_proto->base_name());
722 EXPECT_TRUE(entry_proto->file_info().is_directory());
723 EXPECT_EQ("resource_id:dir2", entry_proto->resource_id());
724
725 // Make sure the children have moved over. Test file6.
726 entry_proto.reset();
727 resource_metadata_.GetEntryInfoByPath(
728 FilePath::FromUTF8Unsafe("drive/dir1/dir3/dir100/file6"),
729 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
730 &error, &entry_proto));
731 google_apis::test_util::RunBlockingPoolTask();
732 EXPECT_EQ(DRIVE_FILE_OK, error);
733 ASSERT_TRUE(entry_proto.get());
734 EXPECT_EQ("file6", entry_proto->base_name());
735
736 // Make sure dir2 no longer exists.
737 resource_metadata_.GetEntryInfoByPath(
738 FilePath::FromUTF8Unsafe("drive/dir2"),
739 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
740 &error, &entry_proto));
741 google_apis::test_util::RunBlockingPoolTask();
742 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
743 EXPECT_FALSE(entry_proto.get());
744 }
745
746 TEST_F(DriveResourceMetadataTest, AddEntryToParent) {
747 int sequence_id = 100;
748 DriveEntryProto file_entry_proto = CreateDriveEntryProto(
749 sequence_id++, false, "resource_id:dir3");
750
751 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
752 FilePath drive_file_path;
753
754 // Add to dir3.
755 resource_metadata_.AddEntryToParent(
756 file_entry_proto,
757 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
758 &error, &drive_file_path));
759 google_apis::test_util::RunBlockingPoolTask();
760 EXPECT_EQ(DRIVE_FILE_OK, error);
761 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir3/file100"),
762 drive_file_path);
763
764 // Adds to root when parent resource id is not specified.
765 DriveEntryProto file_entry_proto2 = CreateDriveEntryProto(
766 sequence_id++, false, "");
767
768 resource_metadata_.AddEntryToParent(
769 file_entry_proto2,
770 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
771 &error, &drive_file_path));
772 google_apis::test_util::RunBlockingPoolTask();
773 EXPECT_EQ(DRIVE_FILE_OK, error);
774 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/file101"), drive_file_path);
775
776 // Add a directory.
777 DriveEntryProto dir_entry_proto = CreateDriveEntryProto(
778 sequence_id++, true, "resource_id:dir1");
779
780 resource_metadata_.AddEntryToParent(
781 dir_entry_proto,
782 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
783 &error, &drive_file_path));
784 google_apis::test_util::RunBlockingPoolTask();
785 EXPECT_EQ(DRIVE_FILE_OK, error);
786 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir1/dir102"), drive_file_path);
787
788 // Add to an invalid parent.
789 DriveEntryProto file_entry_proto3 = CreateDriveEntryProto(
790 sequence_id++, false, "resource_id:invalid");
791
792 resource_metadata_.AddEntryToParent(
793 file_entry_proto3,
794 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
795 &error, &drive_file_path));
796 google_apis::test_util::RunBlockingPoolTask();
797 EXPECT_EQ(DRIVE_FILE_ERROR_NOT_FOUND, error);
798 }
799
800 TEST_F(DriveResourceMetadataTest, GetChangedDirectories) {
801 std::set<FilePath> changed_directories;
802
803 // file9: only drive/dir1/dir3 is affected.
804 resource_metadata_.GetChangedDirectories("resource_id:file9",
805 base::Bind(&OnGetChangedDirectories, &changed_directories));
806 google_apis::test_util::RunBlockingPoolTask();
807 EXPECT_EQ(1u, changed_directories.size());
808 EXPECT_EQ(1u, changed_directories.count(
809 FilePath::FromUTF8Unsafe("drive/dir1/dir3")));
810
811 // dir2: root and dir2 are affected.
812 resource_metadata_.GetChangedDirectories("resource_id:dir2",
813 base::Bind(&OnGetChangedDirectories, &changed_directories));
814 google_apis::test_util::RunBlockingPoolTask();
815 EXPECT_EQ(2u, changed_directories.size());
816 EXPECT_EQ(1u, changed_directories.count(
817 FilePath::FromUTF8Unsafe("drive")));
818 EXPECT_EQ(1u, changed_directories.count(
819 FilePath::FromUTF8Unsafe("drive/dir2")));
820
821 // dir1: root, dir1, and dir3 are affected.
822 resource_metadata_.GetChangedDirectories("resource_id:dir1",
823 base::Bind(&OnGetChangedDirectories, &changed_directories));
824 google_apis::test_util::RunBlockingPoolTask();
825 EXPECT_EQ(3u, changed_directories.size());
826 EXPECT_EQ(1u, changed_directories.count(
827 FilePath::FromUTF8Unsafe("drive")));
828 EXPECT_EQ(1u, changed_directories.count(
829 FilePath::FromUTF8Unsafe("drive/dir1")));
830 EXPECT_EQ(1u, changed_directories.count(
831 FilePath::FromUTF8Unsafe("drive/dir1/dir3")));
832 }
833
600 TEST_F(DriveResourceMetadataTest, TakeOverEntries) { 834 TEST_F(DriveResourceMetadataTest, TakeOverEntries) {
601 DriveFileError error = DRIVE_FILE_ERROR_FAILED; 835 DriveFileError error = DRIVE_FILE_ERROR_FAILED;
602 FilePath drive_file_path; 836 FilePath drive_file_path;
603 scoped_ptr<DriveEntryProto> entry_proto; 837 scoped_ptr<DriveEntryProto> entry_proto;
604 838
605 // Move files from dir1 to dir2. 839 // Move files from dir1 to dir2.
606 resource_metadata_.TakeOverEntries( 840 resource_metadata_.TakeOverEntries(
607 "dir_resource_id:dir1", 841 "resource_id:dir1",
608 "dir_resource_id:dir2", 842 "resource_id:dir2",
609 base::Bind(&test_util::CopyResultsFromFileMoveCallback, 843 base::Bind(&test_util::CopyResultsFromFileMoveCallback,
610 &error, &drive_file_path)); 844 &error, &drive_file_path));
611 google_apis::test_util::RunBlockingPoolTask(); 845 google_apis::test_util::RunBlockingPoolTask();
612 EXPECT_EQ(DRIVE_FILE_OK, error); 846 EXPECT_EQ(DRIVE_FILE_OK, error);
613 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2"), drive_file_path); 847 EXPECT_EQ(FilePath::FromUTF8Unsafe("drive/dir2"), drive_file_path);
614 848
615 // Check if the file move worked. file6 should now be in drive/dir2. 849 // Check if the file move worked. file6 should now be in drive/dir2.
616 resource_metadata_.GetEntryInfoByPath( 850 resource_metadata_.GetEntryInfoByPath(
617 FilePath::FromUTF8Unsafe("drive/dir2/file6"), 851 FilePath::FromUTF8Unsafe("drive/dir2/file6"),
618 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback, 852 base::Bind(&test_util::CopyResultsFromGetEntryInfoCallback,
(...skipping 29 matching lines...) Expand all
648 FilePath::FromUTF8Unsafe("drive/dir2"), 882 FilePath::FromUTF8Unsafe("drive/dir2"),
649 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback, 883 base::Bind(&test_util::CopyResultsFromReadDirectoryCallback,
650 &error, &entries)); 884 &error, &entries));
651 google_apis::test_util::RunBlockingPoolTask(); 885 google_apis::test_util::RunBlockingPoolTask();
652 EXPECT_EQ(DRIVE_FILE_OK, error); 886 EXPECT_EQ(DRIVE_FILE_OK, error);
653 ASSERT_TRUE(entries.get()); 887 ASSERT_TRUE(entries.get());
654 ASSERT_EQ(6U, entries->size()); 888 ASSERT_EQ(6U, entries->size());
655 } 889 }
656 890
657 } // namespace drive 891 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698