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/local_to_remote_syncer.h
" | 5 #include "chrome/browser/sync_file_system/drive_backend/local_to_remote_syncer.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/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "google_apis/drive/gdata_errorcode.h" | 33 #include "google_apis/drive/gdata_errorcode.h" |
34 #include "testing/gtest/include/gtest/gtest.h" | 34 #include "testing/gtest/include/gtest/gtest.h" |
35 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" | 35 #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" |
36 #include "third_party/leveldatabase/src/include/leveldb/env.h" | 36 #include "third_party/leveldatabase/src/include/leveldb/env.h" |
37 | 37 |
38 namespace sync_file_system { | 38 namespace sync_file_system { |
39 namespace drive_backend { | 39 namespace drive_backend { |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 fileapi::FileSystemURL URL(const GURL& origin, | 43 storage::FileSystemURL URL(const GURL& origin, const std::string& path) { |
44 const std::string& path) { | |
45 return CreateSyncableFileSystemURL( | 44 return CreateSyncableFileSystemURL( |
46 origin, base::FilePath::FromUTF8Unsafe(path)); | 45 origin, base::FilePath::FromUTF8Unsafe(path)); |
47 } | 46 } |
48 | 47 |
49 const int kRetryLimit = 100; | 48 const int kRetryLimit = 100; |
50 | 49 |
51 } // namespace | 50 } // namespace |
52 | 51 |
53 class LocalToRemoteSyncerTest : public testing::Test { | 52 class LocalToRemoteSyncerTest : public testing::Test { |
54 public: | 53 public: |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 parent_folder_id, title, content, &file_id)); | 159 parent_folder_id, title, content, &file_id)); |
161 return file_id; | 160 return file_id; |
162 } | 161 } |
163 | 162 |
164 void DeleteResource(const std::string& file_id) { | 163 void DeleteResource(const std::string& file_id) { |
165 EXPECT_EQ(google_apis::HTTP_NO_CONTENT, | 164 EXPECT_EQ(google_apis::HTTP_NO_CONTENT, |
166 fake_drive_helper_->DeleteResource(file_id)); | 165 fake_drive_helper_->DeleteResource(file_id)); |
167 } | 166 } |
168 | 167 |
169 SyncStatusCode RunLocalToRemoteSyncer(FileChange file_change, | 168 SyncStatusCode RunLocalToRemoteSyncer(FileChange file_change, |
170 const fileapi::FileSystemURL& url) { | 169 const storage::FileSystemURL& url) { |
171 SyncStatusCode status = SYNC_STATUS_UNKNOWN; | 170 SyncStatusCode status = SYNC_STATUS_UNKNOWN; |
172 base::FilePath local_path = base::FilePath::FromUTF8Unsafe("dummy"); | 171 base::FilePath local_path = base::FilePath::FromUTF8Unsafe("dummy"); |
173 scoped_ptr<LocalToRemoteSyncer> syncer(new LocalToRemoteSyncer( | 172 scoped_ptr<LocalToRemoteSyncer> syncer(new LocalToRemoteSyncer( |
174 context_.get(), | 173 context_.get(), |
175 SyncFileMetadata(file_change.file_type(), 0, base::Time()), | 174 SyncFileMetadata(file_change.file_type(), 0, base::Time()), |
176 file_change, local_path, url)); | 175 file_change, local_path, url)); |
177 syncer->RunPreflight(SyncTaskToken::CreateForTesting( | 176 syncer->RunPreflight(SyncTaskToken::CreateForTesting( |
178 CreateResultReceiver(&status))); | 177 CreateResultReceiver(&status))); |
179 base::RunLoop().RunUntilIdle(); | 178 base::RunLoop().RunUntilIdle(); |
180 return status; | 179 return status; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 EXPECT_EQ(SYNC_STATUS_UNKNOWN_ORIGIN, RunLocalToRemoteSyncer( | 540 EXPECT_EQ(SYNC_STATUS_UNKNOWN_ORIGIN, RunLocalToRemoteSyncer( |
542 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, | 541 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, |
543 SYNC_FILE_TYPE_DIRECTORY), | 542 SYNC_FILE_TYPE_DIRECTORY), |
544 URL(kOrigin, "foo"))); | 543 URL(kOrigin, "foo"))); |
545 | 544 |
546 // SyncEngine will re-register the app and resurrect the app root later. | 545 // SyncEngine will re-register the app and resurrect the app root later. |
547 } | 546 } |
548 | 547 |
549 } // namespace drive_backend | 548 } // namespace drive_backend |
550 } // namespace sync_file_system | 549 } // namespace sync_file_system |
OLD | NEW |