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

Unified Diff: sync/engine/sync_scheduler_unittest.cc

Issue 322333004: sync: Inject sync/'s dependency on invalidations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sync/engine/sync_scheduler_impl.cc ('k') | sync/internal_api/public/base/invalidation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/sync_scheduler_unittest.cc
diff --git a/sync/engine/sync_scheduler_unittest.cc b/sync/engine/sync_scheduler_unittest.cc
index c231087f9c98683ed81d5094847ed1aa9ba65b39..8348eabfef86d32b8783261735a7b82ebb5b9a5e 100644
--- a/sync/engine/sync_scheduler_unittest.cc
+++ b/sync/engine/sync_scheduler_unittest.cc
@@ -20,6 +20,7 @@
#include "sync/test/engine/fake_model_worker.h"
#include "sync/test/engine/mock_connection_manager.h"
#include "sync/test/engine/test_directory_setter_upper.h"
+#include "sync/test/mock_invalidation.h"
#include "sync/util/extensions_activity.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -220,6 +221,13 @@ class SyncSchedulerTest : public testing::Test {
return scheduler_->retry_timer_.GetCurrentDelay();
}
+ static scoped_ptr<InvalidationInterface> BuildInvalidation(
+ int64 version,
+ const std::string& payload) {
+ return MockInvalidation::Build(version, payload)
+ .PassAs<InvalidationInterface>();
+ }
+
private:
syncable::Directory* directory() {
return dir_maker_.directory();
@@ -523,25 +531,23 @@ TEST_F(SyncSchedulerTest, NudgeWithStates) {
StartSyncScheduler(SyncScheduler::NORMAL_MODE);
SyncShareTimes times1;
- ObjectIdInvalidationMap invalidations1 =
- BuildInvalidationMap(BOOKMARKS, 10, "test");
EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_))
.WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess),
RecordSyncShare(&times1)))
.RetiresOnSaturation();
- scheduler()->ScheduleInvalidationNudge(zero(), invalidations1, FROM_HERE);
+ scheduler()->ScheduleInvalidationNudge(
+ zero(), BOOKMARKS, BuildInvalidation(10, "test"), FROM_HERE);
RunLoop();
Mock::VerifyAndClearExpectations(syncer());
// Make sure a second, later, nudge is unaffected by first (no coalescing).
SyncShareTimes times2;
- ObjectIdInvalidationMap invalidations2 =
- BuildInvalidationMap(AUTOFILL, 10, "test2");
EXPECT_CALL(*syncer(), NormalSyncShare(_,_,_))
.WillOnce(DoAll(Invoke(sessions::test_util::SimulateNormalSuccess),
RecordSyncShare(&times2)));
- scheduler()->ScheduleInvalidationNudge(zero(), invalidations2, FROM_HERE);
+ scheduler()->ScheduleInvalidationNudge(
+ zero(), AUTOFILL, BuildInvalidation(10, "test2"), FROM_HERE);
RunLoop();
}
@@ -834,9 +840,8 @@ TEST_F(SyncSchedulerTest, TypeThrottlingDoesBlockOtherSources) {
EXPECT_TRUE(GetThrottledTypes().HasAll(throttled_types));
// Ignore invalidations for throttled types.
- ObjectIdInvalidationMap invalidations =
- BuildInvalidationMap(BOOKMARKS, 10, "test");
- scheduler()->ScheduleInvalidationNudge(zero(), invalidations, FROM_HERE);
+ scheduler()->ScheduleInvalidationNudge(
+ zero(), BOOKMARKS, BuildInvalidation(10, "test"), FROM_HERE);
PumpLoop();
// Ignore refresh requests for throttled types.
« no previous file with comments | « sync/engine/sync_scheduler_impl.cc ('k') | sync/internal_api/public/base/invalidation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698