| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 fake_sync_client_ = NULL; | 181 fake_sync_client_ = NULL; |
| 182 sync_service_.reset(); | 182 sync_service_.reset(); |
| 183 fake_remote_processor_.reset(); | 183 fake_remote_processor_.reset(); |
| 184 message_loop_.RunUntilIdle(); | 184 message_loop_.RunUntilIdle(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void AddOrUpdateResource(const std::string& title) { | 187 void AddOrUpdateResource(const std::string& title) { |
| 188 typedef ResourceIdByTitle::iterator iterator; | 188 typedef ResourceIdByTitle::iterator iterator; |
| 189 std::pair<iterator, bool> inserted = | 189 std::pair<iterator, bool> inserted = |
| 190 resources_.insert(std::make_pair(title, std::string())); | 190 resources_.insert(std::make_pair(title, std::string())); |
| 191 if (inserted.second) | 191 if (inserted.second) { |
| 192 inserted.first->second = StringPrintf("%" PRId64, ++resource_count_); | 192 inserted.first->second = |
| 193 base::StringPrintf("%" PRId64, ++resource_count_); |
| 194 } |
| 193 std::string resource_id = inserted.first->second; | 195 std::string resource_id = inserted.first->second; |
| 194 | 196 |
| 195 fake_sync_client_->PushRemoteChange( | 197 fake_sync_client_->PushRemoteChange( |
| 196 kParentResourceId, kAppId, title, resource_id, | 198 kParentResourceId, kAppId, title, resource_id, |
| 197 StringPrintf("%" PRIx64, base::RandUint64()), | 199 base::StringPrintf("%" PRIx64, base::RandUint64()), |
| 198 false /* deleted */); | 200 false /* deleted */); |
| 199 message_loop_.RunUntilIdle(); | 201 message_loop_.RunUntilIdle(); |
| 200 } | 202 } |
| 201 | 203 |
| 202 void DeleteResource(const std::string& title) { | 204 void DeleteResource(const std::string& title) { |
| 203 ResourceIdByTitle::iterator found = resources_.find(title); | 205 ResourceIdByTitle::iterator found = resources_.find(title); |
| 204 if (found == resources_.end()) | 206 if (found == resources_.end()) |
| 205 return; | 207 return; |
| 206 std::string resource_id = found->second; | 208 std::string resource_id = found->second; |
| 207 resources_.erase(found); | 209 resources_.erase(found); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 CreateRemoteFileAddOrUpdateEvent(kFile1), | 389 CreateRemoteFileAddOrUpdateEvent(kFile1), |
| 388 | 390 |
| 389 CreateFetchEvent(), | 391 CreateFetchEvent(), |
| 390 CreateProcessRemoteChangeEvent(), | 392 CreateProcessRemoteChangeEvent(), |
| 391 CreateRelaunchEvent(), | 393 CreateRelaunchEvent(), |
| 392 }; | 394 }; |
| 393 RunTest(CreateTestCase(sync_event)); | 395 RunTest(CreateTestCase(sync_event)); |
| 394 } | 396 } |
| 395 | 397 |
| 396 } // namespace sync_file_system | 398 } // namespace sync_file_system |
| OLD | NEW |