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/sync_file_system/mock_remote_file_sync_service.h" | 5 #include "chrome/browser/sync_file_system/mock_remote_file_sync_service.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 .WillByDefault( | 32 .WillByDefault( |
33 Invoke(this, &self::DeleteOriginDirectoryStub)); | 33 Invoke(this, &self::DeleteOriginDirectoryStub)); |
34 ON_CALL(*this, ProcessRemoteChange(_)) | 34 ON_CALL(*this, ProcessRemoteChange(_)) |
35 .WillByDefault(Invoke(this, &self::ProcessRemoteChangeStub)); | 35 .WillByDefault(Invoke(this, &self::ProcessRemoteChangeStub)); |
36 ON_CALL(*this, GetLocalChangeProcessor()) | 36 ON_CALL(*this, GetLocalChangeProcessor()) |
37 .WillByDefault(Return(&mock_local_change_processor_)); | 37 .WillByDefault(Return(&mock_local_change_processor_)); |
38 ON_CALL(*this, IsConflicting(_)) | 38 ON_CALL(*this, IsConflicting(_)) |
39 .WillByDefault(Return(false)); | 39 .WillByDefault(Return(false)); |
40 ON_CALL(*this, GetCurrentState()) | 40 ON_CALL(*this, GetCurrentState()) |
41 .WillByDefault(Invoke(this, &self::GetCurrentStateStub)); | 41 .WillByDefault(Invoke(this, &self::GetCurrentStateStub)); |
42 ON_CALL(*this, SetConflictResolutionPolicy(_)) | 42 ON_CALL(*this, SetDefaultConflictResolutionPolicy(_)) |
| 43 .WillByDefault( |
| 44 Invoke(this, &self::SetDefaultConflictResolutionPolicyStub)); |
| 45 ON_CALL(*this, SetConflictResolutionPolicy(_, _)) |
43 .WillByDefault(Invoke(this, &self::SetConflictResolutionPolicyStub)); | 46 .WillByDefault(Invoke(this, &self::SetConflictResolutionPolicyStub)); |
44 ON_CALL(*this, GetConflictResolutionPolicy()) | 47 ON_CALL(*this, GetDefaultConflictResolutionPolicy()) |
| 48 .WillByDefault( |
| 49 Invoke(this, &self::GetDefaultConflictResolutionPolicyStub)); |
| 50 ON_CALL(*this, GetConflictResolutionPolicy(_)) |
45 .WillByDefault(Invoke(this, &self::GetConflictResolutionPolicyStub)); | 51 .WillByDefault(Invoke(this, &self::GetConflictResolutionPolicyStub)); |
46 } | 52 } |
47 | 53 |
48 MockRemoteFileSyncService::~MockRemoteFileSyncService() { | 54 MockRemoteFileSyncService::~MockRemoteFileSyncService() { |
49 } | 55 } |
50 | 56 |
51 scoped_ptr<base::ListValue> MockRemoteFileSyncService::DumpFiles( | 57 scoped_ptr<base::ListValue> MockRemoteFileSyncService::DumpFiles( |
52 const GURL& origin) { | 58 const GURL& origin) { |
53 return scoped_ptr<base::ListValue>(); | 59 return scoped_ptr<base::ListValue>(); |
54 } | 60 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 117 } |
112 | 118 |
113 void MockRemoteFileSyncService::ProcessRemoteChangeStub( | 119 void MockRemoteFileSyncService::ProcessRemoteChangeStub( |
114 const SyncFileCallback& callback) { | 120 const SyncFileCallback& callback) { |
115 base::MessageLoopProxy::current()->PostTask( | 121 base::MessageLoopProxy::current()->PostTask( |
116 FROM_HERE, | 122 FROM_HERE, |
117 base::Bind(callback, SYNC_STATUS_NO_CHANGE_TO_SYNC, | 123 base::Bind(callback, SYNC_STATUS_NO_CHANGE_TO_SYNC, |
118 fileapi::FileSystemURL())); | 124 fileapi::FileSystemURL())); |
119 } | 125 } |
120 | 126 |
| 127 SyncStatusCode |
| 128 MockRemoteFileSyncService::SetDefaultConflictResolutionPolicyStub( |
| 129 ConflictResolutionPolicy policy) { |
| 130 conflict_resolution_policy_ = policy; |
| 131 return SYNC_STATUS_OK; |
| 132 } |
| 133 |
121 SyncStatusCode MockRemoteFileSyncService::SetConflictResolutionPolicyStub( | 134 SyncStatusCode MockRemoteFileSyncService::SetConflictResolutionPolicyStub( |
| 135 const GURL& origin, |
122 ConflictResolutionPolicy policy) { | 136 ConflictResolutionPolicy policy) { |
123 conflict_resolution_policy_ = policy; | 137 conflict_resolution_policy_ = policy; |
124 return SYNC_STATUS_OK; | 138 return SYNC_STATUS_OK; |
125 } | 139 } |
126 | 140 |
127 ConflictResolutionPolicy | 141 ConflictResolutionPolicy |
128 MockRemoteFileSyncService::GetConflictResolutionPolicyStub() const { | 142 MockRemoteFileSyncService::GetDefaultConflictResolutionPolicyStub() const { |
129 return conflict_resolution_policy_; | 143 return conflict_resolution_policy_; |
130 } | 144 } |
131 | 145 |
| 146 ConflictResolutionPolicy |
| 147 MockRemoteFileSyncService::GetConflictResolutionPolicyStub( |
| 148 const GURL& origin) const { |
| 149 return conflict_resolution_policy_; |
| 150 } |
| 151 |
132 RemoteServiceState MockRemoteFileSyncService::GetCurrentStateStub() const { | 152 RemoteServiceState MockRemoteFileSyncService::GetCurrentStateStub() const { |
133 return state_; | 153 return state_; |
134 } | 154 } |
135 | 155 |
136 } // namespace sync_file_system | 156 } // namespace sync_file_system |
OLD | NEW |