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

Side by Side Diff: sync/sessions/nudge_tracker_unittest.cc

Issue 19982002: sync: Remove SyncSourceInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert SyncShareRecords to typedef Created 7 years, 4 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 | « sync/sessions/nudge_tracker.cc ('k') | sync/sessions/ordered_commit_set.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 "sync/sessions/nudge_tracker.h" 5 #include "sync/sessions/nudge_tracker.h"
6 6
7 #include "sync/internal_api/public/base/model_type_invalidation_map.h" 7 #include "sync/internal_api/public/base/model_type_invalidation_map.h"
8 #include "sync/internal_api/public/sessions/sync_source_info.h"
9 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
10 9
11 namespace syncer { 10 namespace syncer {
12 11
13 namespace { 12 namespace {
14 13
15 testing::AssertionResult ModelTypeSetEquals(ModelTypeSet a, ModelTypeSet b) { 14 testing::AssertionResult ModelTypeSetEquals(ModelTypeSet a, ModelTypeSet b) {
16 if (a.Equals(b)) { 15 if (a.Equals(b)) {
17 return testing::AssertionSuccess(); 16 return testing::AssertionSuccess();
18 } else { 17 } else {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 NudgeTracker nudge_tracker; 60 NudgeTracker nudge_tracker;
62 61
63 EXPECT_FALSE(nudge_tracker.IsSyncRequired()); 62 EXPECT_FALSE(nudge_tracker.IsSyncRequired());
64 EXPECT_FALSE(nudge_tracker.IsGetUpdatesRequired()); 63 EXPECT_FALSE(nudge_tracker.IsGetUpdatesRequired());
65 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::UNKNOWN, 64 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::UNKNOWN,
66 nudge_tracker.updates_source()); 65 nudge_tracker.updates_source());
67 66
68 sync_pb::GetUpdateTriggers gu_trigger; 67 sync_pb::GetUpdateTriggers gu_trigger;
69 nudge_tracker.FillProtoMessage(BOOKMARKS, &gu_trigger); 68 nudge_tracker.FillProtoMessage(BOOKMARKS, &gu_trigger);
70 69
71 SyncSourceInfo source_info = nudge_tracker.GetSourceInfo();
72 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::UNKNOWN, 70 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::UNKNOWN,
73 source_info.updates_source); 71 nudge_tracker.updates_source());
74 } 72 }
75 73
76 // Verify that nudges override each other based on a priority order. 74 // Verify that nudges override each other based on a priority order.
77 // LOCAL < DATATYPE_REFRESH < NOTIFICATION 75 // LOCAL < DATATYPE_REFRESH < NOTIFICATION
78 TEST_F(NudgeTrackerTest, SourcePriorities) { 76 TEST_F(NudgeTrackerTest, SourcePriorities) {
79 NudgeTracker nudge_tracker; 77 NudgeTracker nudge_tracker;
80 78
81 // Track a local nudge. 79 // Track a local nudge.
82 nudge_tracker.RecordLocalChange(ModelTypeSet(BOOKMARKS)); 80 nudge_tracker.RecordLocalChange(ModelTypeSet(BOOKMARKS));
83 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::LOCAL, 81 EXPECT_EQ(sync_pb::GetUpdatesCallerInfo::LOCAL,
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 EXPECT_EQ(throttle2_length - throttle1_length, 468 EXPECT_EQ(throttle2_length - throttle1_length,
471 nudge_tracker.GetTimeUntilNextUnthrottle(t1)); 469 nudge_tracker.GetTimeUntilNextUnthrottle(t1));
472 470
473 // Expire the second interval. 471 // Expire the second interval.
474 nudge_tracker.UpdateTypeThrottlingState(t2); 472 nudge_tracker.UpdateTypeThrottlingState(t2);
475 EXPECT_TRUE(nudge_tracker.GetThrottledTypes().Empty()); 473 EXPECT_TRUE(nudge_tracker.GetThrottledTypes().Empty());
476 } 474 }
477 475
478 } // namespace sessions 476 } // namespace sessions
479 } // namespace syncer 477 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/sessions/nudge_tracker.cc ('k') | sync/sessions/ordered_commit_set.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698