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 "chrome/browser/chromeos/drive/change_list_processor.h" | 5 #include "chrome/browser/chromeos/drive/change_list_processor.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/chromeos/drive/drive.pb.h" | 10 #include "chrome/browser/chromeos/drive/drive.pb.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 "sub_dir_folder_resource_id", | 188 "sub_dir_folder_resource_id", |
189 "1_folder_resource_id", DIRECTORY}, | 189 "1_folder_resource_id", DIRECTORY}, |
190 {"drive/root/Directory 1/Sub Directory Folder/Sub Sub Directory Folder", | 190 {"drive/root/Directory 1/Sub Directory Folder/Sub Sub Directory Folder", |
191 "sub_sub_directory_folder_id", | 191 "sub_sub_directory_folder_id", |
192 "sub_dir_folder_resource_id", DIRECTORY}, | 192 "sub_dir_folder_resource_id", DIRECTORY}, |
193 // Orphan | 193 // Orphan |
194 {"drive/other/Orphan File 1.txt", "1_orphanfile_resource_id", | 194 {"drive/other/Orphan File 1.txt", "1_orphanfile_resource_id", |
195 "", FILE}, | 195 "", FILE}, |
196 }; | 196 }; |
197 | 197 |
198 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kExpected); ++i) { | 198 for (size_t i = 0; i < arraysize(kExpected); ++i) { |
199 scoped_ptr<ResourceEntry> entry = GetResourceEntry(kExpected[i].path); | 199 scoped_ptr<ResourceEntry> entry = GetResourceEntry(kExpected[i].path); |
200 ASSERT_TRUE(entry) << "for path: " << kExpected[i].path; | 200 ASSERT_TRUE(entry) << "for path: " << kExpected[i].path; |
201 EXPECT_EQ(kExpected[i].id, entry->resource_id()); | 201 EXPECT_EQ(kExpected[i].id, entry->resource_id()); |
202 | 202 |
203 ResourceEntry parent_entry; | 203 ResourceEntry parent_entry; |
204 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById( | 204 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById( |
205 entry->parent_local_id(), &parent_entry)); | 205 entry->parent_local_id(), &parent_entry)); |
206 EXPECT_EQ(kExpected[i].parent_id, parent_entry.resource_id()); | 206 EXPECT_EQ(kExpected[i].parent_id, parent_entry.resource_id()); |
207 EXPECT_EQ(kExpected[i].type, | 207 EXPECT_EQ(kExpected[i].type, |
208 entry->file_info().is_directory() ? DIRECTORY : FILE); | 208 entry->file_info().is_directory() ? DIRECTORY : FILE); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 ApplyChangeList(change_lists.Pass(), &changed_files)); | 640 ApplyChangeList(change_lists.Pass(), &changed_files)); |
641 | 641 |
642 // The change is rejected due to the old modification date. | 642 // The change is rejected due to the old modification date. |
643 ResourceEntry entry; | 643 ResourceEntry entry; |
644 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id, &entry)); | 644 EXPECT_EQ(FILE_ERROR_OK, metadata_->GetResourceEntryById(local_id, &entry)); |
645 EXPECT_EQ(new_file_local.title(), entry.title()); | 645 EXPECT_EQ(new_file_local.title(), entry.title()); |
646 } | 646 } |
647 | 647 |
648 } // namespace internal | 648 } // namespace internal |
649 } // namespace drive | 649 } // namespace drive |
OLD | NEW |