| 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 "sync/engine/syncer_proto_util.h" | 5 #include "sync/engine/syncer_proto_util.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 258 |
| 259 dcm.set_access_denied(true); | 259 dcm.set_access_denied(true); |
| 260 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, | 260 EXPECT_FALSE(SyncerProtoUtil::PostAndProcessHeaders(&dcm, NULL, |
| 261 msg, &response)); | 261 msg, &response)); |
| 262 } | 262 } |
| 263 | 263 |
| 264 TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) { | 264 TEST_F(SyncerProtoUtilTest, HandleThrottlingWithDatatypes) { |
| 265 ThrottledDataTypeTracker tracker(NULL); | 265 ThrottledDataTypeTracker tracker(NULL); |
| 266 SyncProtocolError error; | 266 SyncProtocolError error; |
| 267 error.error_type = syncer::THROTTLED; | 267 error.error_type = syncer::THROTTLED; |
| 268 syncable::ModelTypeSet types; | 268 syncer::ModelTypeSet types; |
| 269 types.Put(syncable::BOOKMARKS); | 269 types.Put(syncer::BOOKMARKS); |
| 270 types.Put(syncable::PASSWORDS); | 270 types.Put(syncer::PASSWORDS); |
| 271 error.error_data_types = types; | 271 error.error_data_types = types; |
| 272 | 272 |
| 273 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); | 273 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); |
| 274 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, NULL); | 274 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, NULL); |
| 275 EXPECT_TRUE(tracker.GetThrottledTypes().Equals(types)); | 275 EXPECT_TRUE(tracker.GetThrottledTypes().Equals(types)); |
| 276 } | 276 } |
| 277 | 277 |
| 278 TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) { | 278 TEST_F(SyncerProtoUtilTest, HandleThrottlingNoDatatypes) { |
| 279 ThrottledDataTypeTracker tracker(NULL); | 279 ThrottledDataTypeTracker tracker(NULL); |
| 280 MockDelegate delegate; | 280 MockDelegate delegate; |
| 281 SyncProtocolError error; | 281 SyncProtocolError error; |
| 282 error.error_type = syncer::THROTTLED; | 282 error.error_type = syncer::THROTTLED; |
| 283 | 283 |
| 284 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); | 284 base::TimeTicks ticks = base::TimeTicks::FromInternalValue(1); |
| 285 | 285 |
| 286 EXPECT_CALL(delegate, OnSilencedUntil(ticks)); | 286 EXPECT_CALL(delegate, OnSilencedUntil(ticks)); |
| 287 | 287 |
| 288 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, &delegate); | 288 SyncerProtoUtil::HandleThrottleError(error, ticks, &tracker, &delegate); |
| 289 EXPECT_TRUE(tracker.GetThrottledTypes().Empty()); | 289 EXPECT_TRUE(tracker.GetThrottledTypes().Empty()); |
| 290 } | 290 } |
| 291 } // namespace syncer | 291 } // namespace syncer |
| OLD | NEW |