OLD | NEW |
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 <errno.h> | 5 #include <errno.h> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 // Creates a proto file representing a filesystem with directories: | 993 // Creates a proto file representing a filesystem with directories: |
994 // drive, drive/Dir1, drive/Dir1/SubDir2 | 994 // drive, drive/Dir1, drive/Dir1/SubDir2 |
995 // and files | 995 // and files |
996 // drive/File1, drive/Dir1/File2, drive/Dir1/SubDir2/File3 | 996 // drive/File1, drive/Dir1/File2, drive/Dir1/SubDir2/File3 |
997 void SaveTestFileSystem() { | 997 void SaveTestFileSystem() { |
998 GDataRootDirectoryProto root; | 998 GDataRootDirectoryProto root; |
999 GDataDirectoryProto* root_dir = root.mutable_gdata_directory(); | 999 GDataDirectoryProto* root_dir = root.mutable_gdata_directory(); |
1000 GDataEntryProto* file_base = root_dir->mutable_gdata_entry(); | 1000 GDataEntryProto* file_base = root_dir->mutable_gdata_entry(); |
1001 PlatformFileInfoProto* platform_info = file_base->mutable_file_info(); | 1001 PlatformFileInfoProto* platform_info = file_base->mutable_file_info(); |
1002 file_base->set_title("drive"); | 1002 file_base->set_title("drive"); |
| 1003 file_base->set_resource_id(kGDataRootDirectoryResourceId); |
1003 platform_info->set_is_directory(true); | 1004 platform_info->set_is_directory(true); |
1004 | 1005 |
1005 // drive/File1 | 1006 // drive/File1 |
1006 GDataFileProto* file = root_dir->add_child_files(); | 1007 GDataFileProto* file = root_dir->add_child_files(); |
1007 file_base = file->mutable_gdata_entry(); | 1008 file_base = file->mutable_gdata_entry(); |
1008 platform_info = file_base->mutable_file_info(); | 1009 platform_info = file_base->mutable_file_info(); |
1009 file_base->set_title("File1"); | 1010 file_base->set_title("File1"); |
1010 platform_info->set_is_directory(false); | 1011 platform_info->set_is_directory(false); |
1011 platform_info->set_size(1048576); | 1012 platform_info->set_size(1048576); |
1012 | 1013 |
(...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3655 EXPECT_EQ(1, num_callback_invocations_); | 3656 EXPECT_EQ(1, num_callback_invocations_); |
3656 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); | 3657 EXPECT_TRUE(CacheEntryExists(resource_id, md5)); |
3657 | 3658 |
3658 // Try to remove the file. | 3659 // Try to remove the file. |
3659 num_callback_invocations_ = 0; | 3660 num_callback_invocations_ = 0; |
3660 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); | 3661 TestRemoveFromCache(resource_id, base::PLATFORM_FILE_OK); |
3661 EXPECT_EQ(1, num_callback_invocations_); | 3662 EXPECT_EQ(1, num_callback_invocations_); |
3662 } | 3663 } |
3663 | 3664 |
3664 } // namespace gdata | 3665 } // namespace gdata |
OLD | NEW |