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

Side by Side Diff: chrome/browser/sync/engine/syncer_thread2_unittest.cc

Issue 6296023: sync: remove a test expectation that is actually dumb. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/sync
Patch Set: rebase Created 9 years, 11 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 | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 #include "base/test/test_timeouts.h" 6 #include "base/test/test_timeouts.h"
7 #include "chrome/browser/sync/engine/mock_model_safe_workers.h" 7 #include "chrome/browser/sync/engine/mock_model_safe_workers.h"
8 #include "chrome/browser/sync/engine/syncer.h" 8 #include "chrome/browser/sync/engine/syncer.h"
9 #include "chrome/browser/sync/engine/syncer_thread2.h" 9 #include "chrome/browser/sync/engine/syncer_thread2.h"
10 #include "chrome/browser/sync/sessions/test_util.h" 10 #include "chrome/browser/sync/sessions/test_util.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 82
83 void AnalyzePollRun(const SyncShareRecords& records, size_t min_num_samples, 83 void AnalyzePollRun(const SyncShareRecords& records, size_t min_num_samples,
84 const TimeTicks& optimal_start, const TimeDelta& poll_interval) { 84 const TimeTicks& optimal_start, const TimeDelta& poll_interval) {
85 const std::vector<TimeTicks>& data(records.times); 85 const std::vector<TimeTicks>& data(records.times);
86 EXPECT_GE(data.size(), min_num_samples); 86 EXPECT_GE(data.size(), min_num_samples);
87 for (size_t i = 0; i < data.size(); i++) { 87 for (size_t i = 0; i < data.size(); i++) {
88 SCOPED_TRACE(testing::Message() << "SyncShare # (" << i << ")"); 88 SCOPED_TRACE(testing::Message() << "SyncShare # (" << i << ")");
89 TimeTicks optimal_next_sync = optimal_start + poll_interval * i; 89 TimeTicks optimal_next_sync = optimal_start + poll_interval * i;
90 EXPECT_GE(data[i], optimal_next_sync); 90 EXPECT_GE(data[i], optimal_next_sync);
91 EXPECT_LE(data[i], optimal_next_sync + poll_interval);
92 EXPECT_EQ(GetUpdatesCallerInfo::PERIODIC, 91 EXPECT_EQ(GetUpdatesCallerInfo::PERIODIC,
93 records.snapshots[i]->source.first); 92 records.snapshots[i]->source.first);
94 } 93 }
95 } 94 }
96 95
97 bool GetBackoffAndResetTest(base::WaitableEvent* done) { 96 bool GetBackoffAndResetTest(base::WaitableEvent* done) {
98 syncable::ModelTypeBitSet nudge_types; 97 syncable::ModelTypeBitSet nudge_types;
99 syncer_thread()->Start(SyncerThread::NORMAL_MODE); 98 syncer_thread()->Start(SyncerThread::NORMAL_MODE);
100 syncer_thread()->ScheduleNudge(zero(), NUDGE_SOURCE_LOCAL, nudge_types); 99 syncer_thread()->ScheduleNudge(zero(), NUDGE_SOURCE_LOCAL, nudge_types);
101 done->TimedWait(timeout()); 100 done->TimedWait(timeout());
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 syncer_thread()->Start(SyncerThread::NORMAL_MODE); 502 syncer_thread()->Start(SyncerThread::NORMAL_MODE);
504 done.TimedWait(timeout()); 503 done.TimedWait(timeout());
505 syncer_thread()->Stop(); 504 syncer_thread()->Stop();
506 505
507 // Check for healthy polling after backoff is relieved. 506 // Check for healthy polling after backoff is relieved.
508 // Can't use AnalyzePollRun because first sync is a continuation. Bleh. 507 // Can't use AnalyzePollRun because first sync is a continuation. Bleh.
509 for (size_t i = 0; i < r.times.size(); i++) { 508 for (size_t i = 0; i < r.times.size(); i++) {
510 SCOPED_TRACE(testing::Message() << "SyncShare # (" << i << ")"); 509 SCOPED_TRACE(testing::Message() << "SyncShare # (" << i << ")");
511 TimeTicks optimal_next_sync = optimal_start + poll * i; 510 TimeTicks optimal_next_sync = optimal_start + poll * i;
512 EXPECT_GE(r.times[i], optimal_next_sync); 511 EXPECT_GE(r.times[i], optimal_next_sync);
513 EXPECT_LE(r.times[i], optimal_next_sync + poll);
514 EXPECT_EQ(i == 0 ? GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION 512 EXPECT_EQ(i == 0 ? GetUpdatesCallerInfo::SYNC_CYCLE_CONTINUATION
515 : GetUpdatesCallerInfo::PERIODIC, 513 : GetUpdatesCallerInfo::PERIODIC,
516 r.snapshots[i]->source.first); 514 r.snapshots[i]->source.first);
517 } 515 }
518 } 516 }
519 517
520 TEST_F(SyncerThread2Test, GetRecommendedDelay) { 518 TEST_F(SyncerThread2Test, GetRecommendedDelay) {
521 EXPECT_LE(TimeDelta::FromSeconds(0), 519 EXPECT_LE(TimeDelta::FromSeconds(0),
522 SyncerThread::GetRecommendedDelay(TimeDelta::FromSeconds(0))); 520 SyncerThread::GetRecommendedDelay(TimeDelta::FromSeconds(0)));
523 EXPECT_LE(TimeDelta::FromSeconds(1), 521 EXPECT_LE(TimeDelta::FromSeconds(1),
(...skipping 22 matching lines...) Expand all
546 TEST_F(SyncerThread2Test, DISABLED_StartWhenNotConnected) { 544 TEST_F(SyncerThread2Test, DISABLED_StartWhenNotConnected) {
547 545
548 } 546 }
549 547
550 } // namespace s3 548 } // namespace s3
551 } // namespace browser_sync 549 } // namespace browser_sync
552 550
553 // SyncerThread won't outlive the test! 551 // SyncerThread won't outlive the test!
554 DISABLE_RUNNABLE_METHOD_REFCOUNT(browser_sync::s3::SyncerThread2Test); 552 DISABLE_RUNNABLE_METHOD_REFCOUNT(browser_sync::s3::SyncerThread2Test);
555 553
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698