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

Unified Diff: sync/engine/nudge_tracker_unittest.cc

Issue 13743003: sync: Finish the SyncScheduler refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ModelNeutralState forward decl Created 7 years, 8 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
Index: sync/engine/nudge_tracker_unittest.cc
diff --git a/sync/engine/nudge_tracker_unittest.cc b/sync/engine/nudge_tracker_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ce84b20dec0cf07c922d301416b40eb72793b008
--- /dev/null
+++ b/sync/engine/nudge_tracker_unittest.cc
@@ -0,0 +1,49 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "sync/engine/nudge_tracker.h"
+
+#include "sync/internal_api/public/base/model_type_invalidation_map.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace syncer {
+
+namespace {
+
+ModelTypeSet ParamsMeaningAllEnabledTypes() {
+ ModelTypeSet request_params(BOOKMARKS, AUTOFILL);
+ return request_params;
+}
+
+ModelTypeSet ParamsMeaningJustOneEnabledType() {
+ return ModelTypeSet(AUTOFILL);
+}
+
+} // namespace
+
+TEST(NudgeTrackerTest, CoalesceSources) {
tim (not reviewing) 2013/04/15 22:37:49 Would it be feasible to have a test that demonstra
rlarocque 2013/04/16 01:30:26 Good idea. Done.
+ ModelTypeInvalidationMap one_type =
+ ModelTypeSetToInvalidationMap(
+ ParamsMeaningJustOneEnabledType(),
+ std::string());
+ ModelTypeInvalidationMap all_types =
+ ModelTypeSetToInvalidationMap(
+ ParamsMeaningAllEnabledTypes(),
+ std::string());
+ sessions::SyncSourceInfo source_one(
+ sync_pb::GetUpdatesCallerInfo::PERIODIC, one_type);
+ sessions::SyncSourceInfo source_two(
+ sync_pb::GetUpdatesCallerInfo::LOCAL, all_types);
+
+ NudgeTracker tracker;
+ EXPECT_TRUE(tracker.IsEmpty());
+
+ tracker.CoalesceSources(source_one);
+ EXPECT_EQ(source_one.updates_source, tracker.source_info().updates_source);
+
+ tracker.CoalesceSources(source_two);
+ EXPECT_EQ(source_two.updates_source, tracker.source_info().updates_source);
+}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698