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

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

Issue 3054021: Sync: set BASE_VERSION to entry.version() instead of 0 when changing (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Sync to trunk; add comment per chron. Created 10 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/sync/engine/process_updates_command.cc ('k') | no next file » | 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) 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 // Syncer unit tests. Unfortunately a lot of these tests 5 // Syncer unit tests. Unfortunately a lot of these tests
6 // are outdated and need to be reworked and updated. 6 // are outdated and need to be reworked and updated.
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 4345 matching lines...) Expand 10 before | Expand all | Expand 10 after
4356 4356
4357 mock_server_->set_conflict_all_commits(true); 4357 mock_server_->set_conflict_all_commits(true);
4358 4358
4359 syncer_->SyncShare(this); 4359 syncer_->SyncShare(this);
4360 // This should cause client tag overwrite. 4360 // This should cause client tag overwrite.
4361 { 4361 {
4362 ReadTransaction trans(dir, __FILE__, __LINE__); 4362 ReadTransaction trans(dir, __FILE__, __LINE__);
4363 4363
4364 Entry tag_a(&trans, GET_BY_CLIENT_TAG, "tag a"); 4364 Entry tag_a(&trans, GET_BY_CLIENT_TAG, "tag a");
4365 ASSERT_TRUE(tag_a.good()); 4365 ASSERT_TRUE(tag_a.good());
4366 ASSERT_TRUE(tag_a.Get(ID).ServerKnows()); 4366 EXPECT_TRUE(tag_a.Get(ID).ServerKnows());
4367 ASSERT_TRUE(ids_.FromNumber(1) == tag_a.Get(ID)); 4367 EXPECT_EQ(ids_.FromNumber(1), tag_a.Get(ID));
4368 EXPECT_FALSE(tag_a.Get(IS_DEL)); 4368 EXPECT_FALSE(tag_a.Get(IS_DEL));
4369 EXPECT_FALSE(tag_a.Get(IS_UNAPPLIED_UPDATE)); 4369 EXPECT_FALSE(tag_a.Get(IS_UNAPPLIED_UPDATE));
4370 EXPECT_FALSE(tag_a.Get(IS_UNSYNCED)); 4370 EXPECT_FALSE(tag_a.Get(IS_UNSYNCED));
4371 EXPECT_EQ("One A", tag_a.Get(NON_UNIQUE_NAME)); 4371 EXPECT_EQ("One A", tag_a.Get(NON_UNIQUE_NAME));
4372 EXPECT_EQ(1, tag_a.Get(BASE_VERSION)); 4372 EXPECT_EQ(1, tag_a.Get(BASE_VERSION));
4373 EXPECT_EQ("tag a", tag_a.Get(UNIQUE_CLIENT_TAG)); 4373 EXPECT_EQ("tag a", tag_a.Get(UNIQUE_CLIENT_TAG));
4374 4374
4375 Entry tag_b(&trans, GET_BY_CLIENT_TAG, "tag b"); 4375 Entry tag_b(&trans, GET_BY_CLIENT_TAG, "tag b");
4376 ASSERT_TRUE(tag_b.good()); 4376 ASSERT_TRUE(tag_b.good());
4377 ASSERT_TRUE(tag_b.Get(ID).ServerKnows()); 4377 EXPECT_TRUE(tag_b.Get(ID).ServerKnows());
4378 ASSERT_TRUE(ids_.FromNumber(101) == tag_b.Get(ID)); 4378 EXPECT_EQ(ids_.FromNumber(101), tag_b.Get(ID));
4379 EXPECT_FALSE(tag_b.Get(IS_DEL)); 4379 EXPECT_FALSE(tag_b.Get(IS_DEL));
4380 EXPECT_FALSE(tag_b.Get(IS_UNAPPLIED_UPDATE)); 4380 EXPECT_FALSE(tag_b.Get(IS_UNAPPLIED_UPDATE));
4381 EXPECT_FALSE(tag_b.Get(IS_UNSYNCED)); 4381 EXPECT_FALSE(tag_b.Get(IS_UNSYNCED));
4382 EXPECT_EQ("Three B", tag_b.Get(NON_UNIQUE_NAME)); 4382 EXPECT_EQ("Three B", tag_b.Get(NON_UNIQUE_NAME));
4383 EXPECT_EQ(16, tag_b.Get(BASE_VERSION)); 4383 EXPECT_EQ(16, tag_b.Get(BASE_VERSION));
4384 EXPECT_EQ("tag b", tag_b.Get(UNIQUE_CLIENT_TAG)); 4384 EXPECT_EQ("tag b", tag_b.Get(UNIQUE_CLIENT_TAG));
4385 4385
4386 Entry tag_c(&trans, GET_BY_CLIENT_TAG, "tag c"); 4386 Entry tag_c(&trans, GET_BY_CLIENT_TAG, "tag c");
4387 ASSERT_TRUE(tag_c.good()); 4387 ASSERT_TRUE(tag_c.good());
4388 ASSERT_TRUE(tag_c.Get(ID).ServerKnows()); 4388 EXPECT_TRUE(tag_c.Get(ID).ServerKnows());
4389 ASSERT_TRUE(ids_.FromNumber(201) == tag_c.Get(ID)); 4389 EXPECT_EQ(ids_.FromNumber(201), tag_c.Get(ID));
4390 EXPECT_FALSE(tag_c.Get(IS_DEL)); 4390 EXPECT_FALSE(tag_c.Get(IS_DEL));
4391 EXPECT_FALSE(tag_c.Get(IS_UNAPPLIED_UPDATE)); 4391 EXPECT_FALSE(tag_c.Get(IS_UNAPPLIED_UPDATE));
4392 EXPECT_FALSE(tag_c.Get(IS_UNSYNCED)); 4392 EXPECT_FALSE(tag_c.Get(IS_UNSYNCED));
4393 EXPECT_EQ("Four C", tag_c.Get(NON_UNIQUE_NAME)); 4393 EXPECT_EQ("Four C", tag_c.Get(NON_UNIQUE_NAME));
4394 EXPECT_EQ(21, tag_c.Get(BASE_VERSION)); 4394 EXPECT_EQ(21, tag_c.Get(BASE_VERSION));
4395 EXPECT_EQ("tag c", tag_c.Get(UNIQUE_CLIENT_TAG)); 4395 EXPECT_EQ("tag c", tag_c.Get(UNIQUE_CLIENT_TAG));
4396 4396
4397 syncable::Directory::ChildHandles children; 4397 syncable::Directory::ChildHandles children;
4398 dir->GetChildHandles(&trans, trans.root_id(), &children); 4398 dir->GetChildHandles(&trans, trans.root_id(), &children);
4399 ASSERT_EQ(3U, children.size()); 4399 ASSERT_EQ(3U, children.size());
(...skipping 762 matching lines...) Expand 10 before | Expand all | Expand 10 after
5162 Add(low_id_); 5162 Add(low_id_);
5163 Add(high_id_); 5163 Add(high_id_);
5164 syncer_->SyncShare(this); 5164 syncer_->SyncShare(this);
5165 ExpectLocalOrderIsByServerId(); 5165 ExpectLocalOrderIsByServerId();
5166 } 5166 }
5167 5167
5168 const SyncerTest::CommitOrderingTest 5168 const SyncerTest::CommitOrderingTest
5169 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; 5169 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()};
5170 5170
5171 } // namespace browser_sync 5171 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/process_updates_command.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698