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

Unified Diff: sync/engine/store_timestamps_command_unittest.cc

Issue 38803003: sync: Implement per-type update processing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes Created 7 years, 2 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/store_timestamps_command.cc ('k') | sync/engine/sync_directory_update_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/store_timestamps_command_unittest.cc
diff --git a/sync/engine/store_timestamps_command_unittest.cc b/sync/engine/store_timestamps_command_unittest.cc
deleted file mode 100644
index e49eb3126eed11810250d5988c67da4021eb8422..0000000000000000000000000000000000000000
--- a/sync/engine/store_timestamps_command_unittest.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-// 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 "base/basictypes.h"
-#include "sync/engine/store_timestamps_command.h"
-#include "sync/internal_api/public/base/model_type.h"
-#include "sync/protocol/sync.pb.h"
-#include "sync/test/engine/syncer_command_test.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace syncer {
-
-namespace {
-
-// Adds a progress marker to |response| for the given field number and
-// token.
-void AddProgressMarkerForFieldNumber(
- sync_pb::GetUpdatesResponse* response,
- int field_number, const std::string& token) {
- sync_pb::DataTypeProgressMarker* marker =
- response->add_new_progress_marker();
- marker->set_data_type_id(field_number);
- marker->set_token(token);
-}
-
-// Adds a progress marker to |response| for the given model type and
-// token.
-void AddProgressMarkerForModelType(
- sync_pb::GetUpdatesResponse* response,
- ModelType model_type, const std::string& token) {
- AddProgressMarkerForFieldNumber(
- response, GetSpecificsFieldNumberFromModelType(model_type), token);
-}
-
-class StoreTimestampsCommandTest : public SyncerCommandTest {
- protected:
- // Gets the directory's progress marker's token for the given model
- // type.
- std::string GetProgessMarkerToken(ModelType model_type) {
- sync_pb::DataTypeProgressMarker progress_marker;
- session()->context()->directory()->GetDownloadProgress(
- model_type, &progress_marker);
- EXPECT_EQ(
- GetSpecificsFieldNumberFromModelType(model_type),
- progress_marker.data_type_id());
- return progress_marker.token();
- }
-};
-
-// Builds a GetUpdatesResponse with some progress markers, including
-// invalid ones. ProcessNewProgressMarkers() should return the model
-// types for the valid progress markers and fill in the progress
-// markers in the directory.
-TEST_F(StoreTimestampsCommandTest, ProcessNewProgressMarkers) {
- sync_pb::GetUpdatesResponse response;
- AddProgressMarkerForModelType(&response, BOOKMARKS, "token1");
- AddProgressMarkerForModelType(&response,
- HISTORY_DELETE_DIRECTIVES, "token2");
- AddProgressMarkerForFieldNumber(&response, -1, "bad token");
-
- ModelTypeSet forward_progress_types =
- ProcessNewProgressMarkers(
- response, session()->context()->directory());
-
- EXPECT_TRUE(
- forward_progress_types.Equals(
- ModelTypeSet(BOOKMARKS, HISTORY_DELETE_DIRECTIVES)));
-
- EXPECT_EQ("token1", GetProgessMarkerToken(BOOKMARKS));
- EXPECT_EQ("token2", GetProgessMarkerToken(HISTORY_DELETE_DIRECTIVES));
-
- ModelTypeSet non_forward_progress_types =
- Difference(ProtocolTypes(), forward_progress_types);
- for (ModelTypeSet::Iterator it = non_forward_progress_types.First();
- it.Good(); it.Inc()) {
- EXPECT_TRUE(GetProgessMarkerToken(it.Get()).empty());
- }
-}
-
-} // namespace
-
-} // namespace syncer
« no previous file with comments | « sync/engine/store_timestamps_command.cc ('k') | sync/engine/sync_directory_update_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698