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

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

Issue 6104003: sync: use progress markers instead of timestamps during GetUpdates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tim's fixes 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/sync/engine/download_updates_command.h" 5 #include "chrome/browser/sync/engine/download_updates_command.h"
6 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h" 6 #include "chrome/browser/sync/protocol/autofill_specifics.pb.h"
7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h" 7 #include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
8 #include "chrome/browser/sync/protocol/preference_specifics.pb.h" 8 #include "chrome/browser/sync/protocol/preference_specifics.pb.h"
9 #include "chrome/browser/sync/protocol/sync.pb.h" 9 #include "chrome/browser/sync/protocol/sync.pb.h"
10 #include "chrome/browser/sync/syncable/directory_manager.h" 10 #include "chrome/browser/sync/syncable/directory_manager.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 syncable::ModelTypeBitSet enabled_types; 80 syncable::ModelTypeBitSet enabled_types;
81 enabled_types[syncable::PREFERENCES] = true; 81 enabled_types[syncable::PREFERENCES] = true;
82 sync_pb::EntitySpecifics get_updates_filter; 82 sync_pb::EntitySpecifics get_updates_filter;
83 command_.SetRequestedTypes(enabled_types, &get_updates_filter); 83 command_.SetRequestedTypes(enabled_types, &get_updates_filter);
84 ProtoExtensionValidator<sync_pb::EntitySpecifics> v(get_updates_filter); 84 ProtoExtensionValidator<sync_pb::EntitySpecifics> v(get_updates_filter);
85 v.ExpectHasExtension(sync_pb::preference); 85 v.ExpectHasExtension(sync_pb::preference);
86 v.ExpectNoOtherFieldsOrExtensions(); 86 v.ExpectNoOtherFieldsOrExtensions();
87 } 87 }
88 } 88 }
89 89
90 TEST_F(DownloadUpdatesCommandTest, OldestTimestampPicked) {
91 syncable::ScopedDirLookup dir(syncdb()->manager(), syncdb()->name());
92 ASSERT_TRUE(dir.good());
93
94 // i,j,k range over every possible model type. j and k are enabled and at
95 // the same timestamp. if i != j or k, i is enabled but at an older
96 // timestamp.
97 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
98 syncable::ModelType type_i = syncable::ModelTypeFromInt(i);
99 for (int j = FIRST_REAL_MODEL_TYPE; j < MODEL_TYPE_COUNT; ++j) {
100 syncable::ModelType type_j = syncable::ModelTypeFromInt(j);
101 for (int k = FIRST_REAL_MODEL_TYPE; k < MODEL_TYPE_COUNT; ++k) {
102 syncable::ModelType type_k = syncable::ModelTypeFromInt(k);
103 SCOPED_TRACE(testing::Message() << "Iteration (" << i << "," << j
104 << "," << k << ")");
105 mutable_routing_info()->clear();
106 (*mutable_routing_info())[type_i] = browser_sync::GROUP_UI;
107 (*mutable_routing_info())[type_j] = browser_sync::GROUP_DB;
108 (*mutable_routing_info())[type_k] = browser_sync::GROUP_UI;
109 dir->set_last_download_timestamp(type_i, 5000 + j);
110 dir->set_last_download_timestamp(type_j, 1000 + i);
111 dir->set_last_download_timestamp(type_k, 1000 + i);
112
113 ConfigureMockServerConnection();
114 dir->set_store_birthday(mock_server()->store_birthday());
115
116 syncable::ModelTypeBitSet expected_request_types;
117 expected_request_types[j] = true;
118 expected_request_types[k] = true;
119 mock_server()->ExpectGetUpdatesRequestTypes(expected_request_types);
120
121 command_.Execute(session());
122
123 const sync_pb::ClientToServerMessage& r = mock_server()->last_request();
124 EXPECT_EQ(1, mock_server()->GetAndClearNumGetUpdatesRequests());
125 EXPECT_TRUE(r.has_get_updates());
126 EXPECT_TRUE(r.get_updates().has_from_timestamp());
127 EXPECT_EQ(1000 + i, r.get_updates().from_timestamp());
128 EXPECT_TRUE(r.get_updates().has_fetch_folders());
129 EXPECT_TRUE(r.get_updates().fetch_folders());
130 EXPECT_TRUE(r.get_updates().has_requested_types());
131 }
132 }
133 }
134 }
135
136 } // namespace browser_sync 90 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/download_updates_command.cc ('k') | chrome/browser/sync/engine/store_timestamps_command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698