OLD | NEW |
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/sync_file_system/drive_backend/conflict_resolver.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/conflict_resolver.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" | 21 #include "chrome/browser/sync_file_system/drive_backend/metadata_database.h" |
22 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
" | 22 #include "chrome/browser/sync_file_system/drive_backend/remote_to_local_syncer.h
" |
23 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" | 23 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_context.h" |
24 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.
h" | 24 #include "chrome/browser/sync_file_system/drive_backend/sync_engine_initializer.
h" |
25 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" | 25 #include "chrome/browser/sync_file_system/drive_backend/sync_task_manager.h" |
26 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" | 26 #include "chrome/browser/sync_file_system/drive_backend/sync_task_token.h" |
27 #include "chrome/browser/sync_file_system/fake_remote_change_processor.h" | 27 #include "chrome/browser/sync_file_system/fake_remote_change_processor.h" |
28 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" | 28 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" |
29 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 29 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
30 #include "content/public/test/test_browser_thread_bundle.h" | 30 #include "content/public/test/test_browser_thread_bundle.h" |
| 31 #include "google_apis/drive/drive_api_error_codes.h" |
31 #include "google_apis/drive/drive_api_parser.h" | 32 #include "google_apis/drive/drive_api_parser.h" |
32 #include "google_apis/drive/gdata_errorcode.h" | |
33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
34 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 34 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
35 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 35 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
36 | 36 |
37 namespace sync_file_system { | 37 namespace sync_file_system { |
38 namespace drive_backend { | 38 namespace drive_backend { |
39 | 39 |
40 namespace { | 40 namespace { |
41 | 41 |
42 storage::FileSystemURL URL(const GURL& origin, const std::string& path) { | 42 storage::FileSystemURL URL(const GURL& origin, const std::string& path) { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 parent_folder_id, title, content, &file_id)); | 150 parent_folder_id, title, content, &file_id)); |
151 return file_id; | 151 return file_id; |
152 } | 152 } |
153 | 153 |
154 void CreateLocalFile(const storage::FileSystemURL& url) { | 154 void CreateLocalFile(const storage::FileSystemURL& url) { |
155 remote_change_processor_->UpdateLocalFileMetadata( | 155 remote_change_processor_->UpdateLocalFileMetadata( |
156 url, FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 156 url, FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
157 SYNC_FILE_TYPE_FILE)); | 157 SYNC_FILE_TYPE_FILE)); |
158 } | 158 } |
159 | 159 |
160 google_apis::GDataErrorCode AddFileToFolder( | 160 google_apis::DriveApiErrorCode AddFileToFolder( |
161 const std::string& parent_folder_id, | 161 const std::string& parent_folder_id, |
162 const std::string& file_id) { | 162 const std::string& file_id) { |
163 google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 163 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
164 context_->GetDriveService()->AddResourceToDirectory( | 164 context_->GetDriveService()->AddResourceToDirectory( |
165 parent_folder_id, file_id, | 165 parent_folder_id, file_id, |
166 CreateResultReceiver(&error)); | 166 CreateResultReceiver(&error)); |
167 base::RunLoop().RunUntilIdle(); | 167 base::RunLoop().RunUntilIdle(); |
168 return error; | 168 return error; |
169 } | 169 } |
170 | 170 |
171 int CountParents(const std::string& file_id) { | 171 int CountParents(const std::string& file_id) { |
172 scoped_ptr<google_apis::FileResource> entry; | 172 scoped_ptr<google_apis::FileResource> entry; |
173 EXPECT_EQ(google_apis::HTTP_SUCCESS, | 173 EXPECT_EQ(google_apis::HTTP_SUCCESS, |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 517 |
518 EXPECT_EQ(4, CountParents(file)); | 518 EXPECT_EQ(4, CountParents(file)); |
519 | 519 |
520 EXPECT_EQ(SYNC_STATUS_OK, RunConflictResolver()); | 520 EXPECT_EQ(SYNC_STATUS_OK, RunConflictResolver()); |
521 | 521 |
522 EXPECT_EQ(1, CountParents(file)); | 522 EXPECT_EQ(1, CountParents(file)); |
523 } | 523 } |
524 | 524 |
525 } // namespace drive_backend | 525 } // namespace drive_backend |
526 } // namespace sync_file_system | 526 } // namespace sync_file_system |
OLD | NEW |