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

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

Issue 1246063003: Sync: Don't set/use Parent ID for non-hierarchical sync data types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 // 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 <algorithm> 8 #include <algorithm>
9 #include <limits> 9 #include <limits>
10 #include <list> 10 #include <list>
(...skipping 4361 matching lines...) Expand 10 before | Expand all | Expand 10 after
4372 { 4372 {
4373 // Preferences type root should have been created by the update above. 4373 // Preferences type root should have been created by the update above.
4374 // We need it in order to get its ID. 4374 // We need it in order to get its ID.
4375 syncable::ReadTransaction trans(FROM_HERE, directory()); 4375 syncable::ReadTransaction trans(FROM_HERE, directory());
4376 Entry pref_root(&trans, GET_TYPE_ROOT, PREFERENCES); 4376 Entry pref_root(&trans, GET_TYPE_ROOT, PREFERENCES);
4377 ASSERT_TRUE(pref_root.good()); 4377 ASSERT_TRUE(pref_root.good());
4378 pref_root_id = pref_root.GetId(); 4378 pref_root_id = pref_root.GetId();
4379 } 4379 }
4380 4380
4381 // Add a preference item with explicit parent ID. 4381 // Add a preference item with explicit parent ID.
4382 mock_server_->AddUpdatePref(ids_.FromNumber(2).GetServerId(), 4382 {
4383 ids_.FromNumber(1).GetServerId(), "tag", 1, 10); 4383 WriteTransaction trans(FROM_HERE, UNITTEST, directory());
4384 MutableEntry entry(&trans, CREATE, PREFERENCES, pref_root_id, "tag");
4385 ASSERT_TRUE(entry.good());
4386 entry.PutIsDir(false);
4387 entry.PutBaseVersion(1);
4388 entry.PutUniqueClientTag("tag");
4389 entry.PutId(ids_.FromNumber(2));
4390 }
4384 4391
4385 EXPECT_TRUE(SyncShareNudge()); 4392 // Verify the entry above.
4386
4387 { 4393 {
4388 syncable::ReadTransaction trans(FROM_HERE, directory()); 4394 syncable::ReadTransaction trans(FROM_HERE, directory());
4389 Entry pref_entry(&trans, GET_BY_CLIENT_TAG, "tag"); 4395 Entry pref_entry(&trans, GET_BY_CLIENT_TAG, "tag");
4390 ASSERT_TRUE(pref_entry.good()); 4396 ASSERT_TRUE(pref_entry.good());
4391 ASSERT_EQ(pref_root_id, pref_entry.GetParentId()); 4397 ASSERT_EQ(pref_root_id, pref_entry.GetParentId());
4392 } 4398 }
4393 4399
4394 // Make another update where the same item get updated, this time 4400 // Make another update where the same item get updated, this time
4395 // with implicit parent ID. 4401 // with implicit parent ID.
4396 mock_server_->AddUpdatePref(ids_.FromNumber(2).GetServerId(), "", "tag", 2, 4402 mock_server_->AddUpdatePref(ids_.FromNumber(2).GetServerId(), "", "tag", 2,
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
5481 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id); 5487 EXPECT_EQ("xyz", final_monitor_records["xyz"].extension_id);
5482 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count); 5488 EXPECT_EQ(2049U, final_monitor_records["ABC"].bookmark_write_count);
5483 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count); 5489 EXPECT_EQ(4U, final_monitor_records["xyz"].bookmark_write_count);
5484 } else { 5490 } else {
5485 EXPECT_TRUE(final_monitor_records.empty()) 5491 EXPECT_TRUE(final_monitor_records.empty())
5486 << "Should not restore records after successful bookmark commit."; 5492 << "Should not restore records after successful bookmark commit.";
5487 } 5493 }
5488 } 5494 }
5489 5495
5490 } // namespace syncer 5496 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698