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

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

Issue 146113003: sync: GU retry with less explicit TimeTicks logic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix logic in GU retry fail edge case Created 6 years, 10 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
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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
1362 TEST_F(SyncSchedulerTest, ReceiveNewRetryDelay) { 1362 TEST_F(SyncSchedulerTest, ReceiveNewRetryDelay) {
1363 StartSyncScheduler(SyncScheduler::NORMAL_MODE); 1363 StartSyncScheduler(SyncScheduler::NORMAL_MODE);
1364 1364
1365 SyncShareTimes times; 1365 SyncShareTimes times;
1366 base::TimeDelta delay1 = base::TimeDelta::FromMilliseconds(100); 1366 base::TimeDelta delay1 = base::TimeDelta::FromMilliseconds(100);
1367 base::TimeDelta delay2 = base::TimeDelta::FromMilliseconds(200); 1367 base::TimeDelta delay2 = base::TimeDelta::FromMilliseconds(200);
1368 1368
1369 scheduler()->ScheduleLocalRefreshRequest(zero(), ModelTypeSet(BOOKMARKS), 1369 scheduler()->ScheduleLocalRefreshRequest(zero(), ModelTypeSet(BOOKMARKS),
1370 FROM_HERE); 1370 FROM_HERE);
1371 scheduler()->OnReceivedGuRetryDelay(delay1); 1371 scheduler()->OnReceivedGuRetryDelay(delay1);
1372 EXPECT_EQ(delay1, GetRetryTimerDelay());
1372 1373
1373 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_)) 1374 EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_))
1374 .WillOnce(DoAll( 1375 .WillOnce(DoAll(
1375 WithoutArgs(VerifyRetryTimerDelay(this, delay1)), 1376 WithoutArgs(VerifyRetryTimerDelay(this, delay1)),
1376 WithArg<2>(sessions::test_util::SimulateGuRetryDelayCommand(delay2)), 1377 WithArg<2>(sessions::test_util::SimulateGuRetryDelayCommand(delay2)),
1377 WithoutArgs(VerifyRetryTimerDelay(this, delay2)),
1378 RecordSyncShare(&times))); 1378 RecordSyncShare(&times)));
1379 1379
1380 // Run nudge GU. 1380 // Run nudge GU.
1381 RunLoop(); 1381 RunLoop();
1382 EXPECT_EQ(delay2, GetRetryTimerDelay());
1382 1383
1383 EXPECT_CALL(*syncer(), RetrySyncShare(_,_)) 1384 EXPECT_CALL(*syncer(), RetrySyncShare(_,_))
1384 .WillOnce( 1385 .WillOnce(DoAll(Invoke(sessions::test_util::SimulatePollRetrySuccess),
1385 DoAll(Invoke(sessions::test_util::SimulatePollRetrySuccess), 1386 RecordSyncShare(&times)));
1386 RecordSyncShare(&times)));
1387 1387
1388 // Run to wait for retrying. 1388 // Run to wait for retrying.
1389 RunLoop(); 1389 RunLoop();
1390 1390
1391 StopSyncScheduler(); 1391 StopSyncScheduler();
1392 } 1392 }
1393 1393
1394 } // namespace syncer 1394 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698