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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 using testing::WithArg; | 31 using testing::WithArg; |
32 using testing::WithArgs; | 32 using testing::WithArgs; |
33 | 33 |
34 namespace syncer { | 34 namespace syncer { |
35 using sessions::SyncSession; | 35 using sessions::SyncSession; |
36 using sessions::SyncSessionContext; | 36 using sessions::SyncSessionContext; |
37 using sync_pb::GetUpdatesCallerInfo; | 37 using sync_pb::GetUpdatesCallerInfo; |
38 | 38 |
39 class MockSyncer : public Syncer { | 39 class MockSyncer : public Syncer { |
40 public: | 40 public: |
| 41 MockSyncer(); |
41 MOCK_METHOD3(NormalSyncShare, bool(ModelTypeSet, | 42 MOCK_METHOD3(NormalSyncShare, bool(ModelTypeSet, |
42 const sessions::NudgeTracker&, | 43 const sessions::NudgeTracker&, |
43 sessions::SyncSession*)); | 44 sessions::SyncSession*)); |
44 MOCK_METHOD3(ConfigureSyncShare, | 45 MOCK_METHOD3(ConfigureSyncShare, |
45 bool(ModelTypeSet, | 46 bool(ModelTypeSet, |
46 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource, | 47 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource, |
47 SyncSession*)); | 48 SyncSession*)); |
48 MOCK_METHOD2(PollSyncShare, bool(ModelTypeSet, sessions::SyncSession*)); | 49 MOCK_METHOD2(PollSyncShare, bool(ModelTypeSet, sessions::SyncSession*)); |
49 }; | 50 }; |
50 | 51 |
| 52 MockSyncer::MockSyncer() |
| 53 : Syncer(NULL) {} |
| 54 |
51 typedef std::vector<TimeTicks> SyncShareTimes; | 55 typedef std::vector<TimeTicks> SyncShareTimes; |
52 | 56 |
53 void QuitLoopNow() { | 57 void QuitLoopNow() { |
54 // We use QuitNow() instead of Quit() as the latter may get stalled | 58 // We use QuitNow() instead of Quit() as the latter may get stalled |
55 // indefinitely in the presence of repeated timers with low delays | 59 // indefinitely in the presence of repeated timers with low delays |
56 // and a slow test (e.g., ThrottlingDoesThrottle [which has a poll | 60 // and a slow test (e.g., ThrottlingDoesThrottle [which has a poll |
57 // delay of 5ms] run under TSAN on the trybots). | 61 // delay of 5ms] run under TSAN on the trybots). |
58 base::MessageLoop::current()->QuitNow(); | 62 base::MessageLoop::current()->QuitNow(); |
59 } | 63 } |
60 | 64 |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1195 // poll once more | 1199 // poll once more |
1196 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) | 1200 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) |
1197 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), | 1201 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), |
1198 RecordSyncShare(×))); | 1202 RecordSyncShare(×))); |
1199 scheduler()->OnCredentialsUpdated(); | 1203 scheduler()->OnCredentialsUpdated(); |
1200 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK); | 1204 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK); |
1201 StopSyncScheduler(); | 1205 StopSyncScheduler(); |
1202 } | 1206 } |
1203 | 1207 |
1204 } // namespace syncer | 1208 } // namespace syncer |
OLD | NEW |