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_v1/fake_drive_service_he lper.h" | 5 #include "chrome/browser/sync_file_system/drive_backend/fake_drive_service_helpe r.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "base/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
12 #include "chrome/browser/sync_file_system/drive_backend_v1/api_util.h" | 12 #include "chrome/browser/sync_file_system/drive_backend_v1/api_util.h" |
13 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" | 13 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h" |
14 #include "chrome/browser/sync_file_system/sync_status_code.h" | 14 #include "chrome/browser/sync_file_system/sync_status_code.h" |
15 #include "content/public/test/test_browser_thread.h" | 15 #include "content/public/test/test_browser_thread.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 CreateResultReceiver(&error)); | 157 CreateResultReceiver(&error)); |
158 base::RunLoop().RunUntilIdle(); | 158 base::RunLoop().RunUntilIdle(); |
159 return error; | 159 return error; |
160 } | 160 } |
161 | 161 |
162 GDataErrorCode FakeDriveServiceHelper::GetSyncRootFolderID( | 162 GDataErrorCode FakeDriveServiceHelper::GetSyncRootFolderID( |
163 std::string* sync_root_folder_id) { | 163 std::string* sync_root_folder_id) { |
164 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; | 164 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; |
165 scoped_ptr<ResourceList> resource_list; | 165 scoped_ptr<ResourceList> resource_list; |
166 fake_drive_service_->SearchByTitle( | 166 fake_drive_service_->SearchByTitle( |
167 APIUtil::GetSyncRootDirectoryName(), std::string(), | 167 APIUtil::GetSyncRootDirectoryName(), std::string(), |
kinuko
2014/01/07 05:45:51
Can you make this not rely on v1 APIUtil? (It's j
tzik
2014/01/07 06:38:18
I think it's worth separating to CL since the impl
tzik
2014/01/08 14:43:01
Done in another CL.
| |
168 CreateResultReceiver(&error, &resource_list)); | 168 CreateResultReceiver(&error, &resource_list)); |
169 base::RunLoop().RunUntilIdle(); | 169 base::RunLoop().RunUntilIdle(); |
170 if (error != google_apis::HTTP_SUCCESS) | 170 if (error != google_apis::HTTP_SUCCESS) |
171 return error; | 171 return error; |
172 | 172 |
173 const ScopedVector<ResourceEntry>& entries = resource_list->entries(); | 173 const ScopedVector<ResourceEntry>& entries = resource_list->entries(); |
174 for (ScopedVector<ResourceEntry>::const_iterator itr = entries.begin(); | 174 for (ScopedVector<ResourceEntry>::const_iterator itr = entries.begin(); |
175 itr != entries.end(); ++itr) { | 175 itr != entries.end(); ++itr) { |
176 const ResourceEntry& entry = **itr; | 176 const ResourceEntry& entry = **itr; |
177 if (!entry.GetLinkByType(google_apis::Link::LINK_PARENT)) { | 177 if (!entry.GetLinkByType(google_apis::Link::LINK_PARENT)) { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 const std::string& content) { | 296 const std::string& content) { |
297 base::FilePath temp_file; | 297 base::FilePath temp_file; |
298 EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_, &temp_file)); | 298 EXPECT_TRUE(base::CreateTemporaryFileInDir(temp_dir_, &temp_file)); |
299 EXPECT_EQ(static_cast<int>(content.size()), | 299 EXPECT_EQ(static_cast<int>(content.size()), |
300 file_util::WriteFile(temp_file, content.data(), content.size())); | 300 file_util::WriteFile(temp_file, content.data(), content.size())); |
301 return temp_file; | 301 return temp_file; |
302 } | 302 } |
303 | 303 |
304 } // namespace drive_backend | 304 } // namespace drive_backend |
305 } // namespace sync_file_system | 305 } // namespace sync_file_system |
OLD | NEW |