Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: trunk/src/sync/engine/sync_scheduler_unittest.cc

Issue 23658030: Revert 222154 "sync: Gracefully handle very early shutdown" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « trunk/src/sync/engine/sync_scheduler_impl.cc ('k') | trunk/src/sync/engine/syncer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 using testing::WithArg; 34 using testing::WithArg;
35 using testing::WithArgs; 35 using testing::WithArgs;
36 36
37 namespace syncer { 37 namespace syncer {
38 using sessions::SyncSession; 38 using sessions::SyncSession;
39 using sessions::SyncSessionContext; 39 using sessions::SyncSessionContext;
40 using sync_pb::GetUpdatesCallerInfo; 40 using sync_pb::GetUpdatesCallerInfo;
41 41
42 class MockSyncer : public Syncer { 42 class MockSyncer : public Syncer {
43 public: 43 public:
44 MockSyncer();
45 MOCK_METHOD3(NormalSyncShare, bool(ModelTypeSet, 44 MOCK_METHOD3(NormalSyncShare, bool(ModelTypeSet,
46 const sessions::NudgeTracker&, 45 const sessions::NudgeTracker&,
47 sessions::SyncSession*)); 46 sessions::SyncSession*));
48 MOCK_METHOD3(ConfigureSyncShare, 47 MOCK_METHOD3(ConfigureSyncShare,
49 bool(ModelTypeSet, 48 bool(ModelTypeSet,
50 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource, 49 sync_pb::GetUpdatesCallerInfo::GetUpdatesSource,
51 SyncSession*)); 50 SyncSession*));
52 MOCK_METHOD2(PollSyncShare, bool(ModelTypeSet, sessions::SyncSession*)); 51 MOCK_METHOD2(PollSyncShare, bool(ModelTypeSet, sessions::SyncSession*));
53 }; 52 };
54 53
55 MockSyncer::MockSyncer()
56 : Syncer(NULL) {}
57
58 typedef std::vector<TimeTicks> SyncShareTimes; 54 typedef std::vector<TimeTicks> SyncShareTimes;
59 55
60 void QuitLoopNow() { 56 void QuitLoopNow() {
61 // We use QuitNow() instead of Quit() as the latter may get stalled 57 // We use QuitNow() instead of Quit() as the latter may get stalled
62 // indefinitely in the presence of repeated timers with low delays 58 // indefinitely in the presence of repeated timers with low delays
63 // and a slow test (e.g., ThrottlingDoesThrottle [which has a poll 59 // and a slow test (e.g., ThrottlingDoesThrottle [which has a poll
64 // delay of 5ms] run under TSAN on the trybots). 60 // delay of 5ms] run under TSAN on the trybots).
65 base::MessageLoop::current()->QuitNow(); 61 base::MessageLoop::current()->QuitNow();
66 } 62 }
67 63
(...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 // poll once more 1196 // poll once more
1201 EXPECT_CALL(*syncer(), PollSyncShare(_,_)) 1197 EXPECT_CALL(*syncer(), PollSyncShare(_,_))
1202 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess), 1198 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollSuccess),
1203 RecordSyncShare(&times))); 1199 RecordSyncShare(&times)));
1204 scheduler()->OnCredentialsUpdated(); 1200 scheduler()->OnCredentialsUpdated();
1205 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK); 1201 connection()->SetServerStatus(HttpResponse::SERVER_CONNECTION_OK);
1206 StopSyncScheduler(); 1202 StopSyncScheduler();
1207 } 1203 }
1208 1204
1209 } // namespace syncer 1205 } // namespace syncer
OLDNEW
« no previous file with comments | « trunk/src/sync/engine/sync_scheduler_impl.cc ('k') | trunk/src/sync/engine/syncer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698