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

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

Issue 273058: Fix some warnings on Mac that are treated as errors:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 entry. 3 // found in the LICENSE entry.
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 4326 matching lines...) Expand 10 before | Expand all | Expand 10 after
4337 ASSERT_TRUE(tag_bob.GetName().value() == PSTR("update2")); 4337 ASSERT_TRUE(tag_bob.GetName().value() == PSTR("update2"));
4338 // The old item should be unchanged. 4338 // The old item should be unchanged.
4339 Entry hurdle(&trans, GET_BY_HANDLE, hurdle_handle); 4339 Entry hurdle(&trans, GET_BY_HANDLE, hurdle_handle);
4340 ASSERT_TRUE(hurdle.good()); 4340 ASSERT_TRUE(hurdle.good());
4341 ASSERT_TRUE(!hurdle.Get(IS_DEL)); 4341 ASSERT_TRUE(!hurdle.Get(IS_DEL));
4342 ASSERT_TRUE(hurdle.Get(SINGLETON_TAG).empty()); 4342 ASSERT_TRUE(hurdle.Get(SINGLETON_TAG).empty());
4343 ASSERT_TRUE(hurdle.GetName().value() == PSTR("bob")); 4343 ASSERT_TRUE(hurdle.GetName().value() == PSTR("bob"));
4344 } 4344 }
4345 } 4345 }
4346 4346
4347 namespace {
Fred 2009/10/15 00:21:05 Instead of removing these namespace clauses, just
Munjal (Google) 2009/10/15 00:32:51 I thought it's better to be consistent within the
4348
4349 class SyncerPositionUpdateTest : public SyncerTest { 4347 class SyncerPositionUpdateTest : public SyncerTest {
4350 public: 4348 public:
4351 SyncerPositionUpdateTest() : next_update_id_(1), next_revision_(1) {} 4349 SyncerPositionUpdateTest() : next_update_id_(1), next_revision_(1) {}
4352 4350
4353 protected: 4351 protected:
4354 void ExpectLocalItemsInServerOrder() { 4352 void ExpectLocalItemsInServerOrder() {
4355 if (position_map_.empty()) 4353 if (position_map_.empty())
4356 return; 4354 return;
4357 4355
4358 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); 4356 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name());
(...skipping 29 matching lines...) Expand all
4388 PosMap::value_type(position, Id::CreateFromServerId(id))); 4386 PosMap::value_type(position, Id::CreateFromServerId(id)));
4389 } 4387 }
4390 private: 4388 private:
4391 typedef multimap<int64, Id> PosMap; 4389 typedef multimap<int64, Id> PosMap;
4392 PosMap position_map_; 4390 PosMap position_map_;
4393 int next_update_id_; 4391 int next_update_id_;
4394 int next_revision_; 4392 int next_revision_;
4395 DISALLOW_COPY_AND_ASSIGN(SyncerPositionUpdateTest); 4393 DISALLOW_COPY_AND_ASSIGN(SyncerPositionUpdateTest);
4396 }; 4394 };
4397 4395
4398 } // namespace
4399
4400 TEST_F(SyncerPositionUpdateTest, InOrderPositive) { 4396 TEST_F(SyncerPositionUpdateTest, InOrderPositive) {
4401 // Add a bunch of items in increasing order, starting with just positive 4397 // Add a bunch of items in increasing order, starting with just positive
4402 // position values. 4398 // position values.
4403 AddRootItemWithPosition(100); 4399 AddRootItemWithPosition(100);
4404 AddRootItemWithPosition(199); 4400 AddRootItemWithPosition(199);
4405 AddRootItemWithPosition(200); 4401 AddRootItemWithPosition(200);
4406 AddRootItemWithPosition(201); 4402 AddRootItemWithPosition(201);
4407 AddRootItemWithPosition(400); 4403 AddRootItemWithPosition(400);
4408 4404
4409 syncer_->SyncShare(); 4405 syncer_->SyncShare();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
4455 4451
4456 syncer_->SyncShare(); 4452 syncer_->SyncShare();
4457 ExpectLocalItemsInServerOrder(); 4453 ExpectLocalItemsInServerOrder();
4458 4454
4459 AddRootItemWithPosition(-144); 4455 AddRootItemWithPosition(-144);
4460 4456
4461 syncer_->SyncShare(); 4457 syncer_->SyncShare();
4462 ExpectLocalItemsInServerOrder(); 4458 ExpectLocalItemsInServerOrder();
4463 } 4459 }
4464 4460
4465 namespace {
4466
4467 class SyncerPositionTiebreakingTest : public SyncerTest { 4461 class SyncerPositionTiebreakingTest : public SyncerTest {
4468 public: 4462 public:
4469 SyncerPositionTiebreakingTest() 4463 SyncerPositionTiebreakingTest()
4470 : low_id_(Id::CreateFromServerId("A")), 4464 : low_id_(Id::CreateFromServerId("A")),
4471 mid_id_(Id::CreateFromServerId("M")), 4465 mid_id_(Id::CreateFromServerId("M")),
4472 high_id_(Id::CreateFromServerId("Z")), 4466 high_id_(Id::CreateFromServerId("Z")),
4473 next_revision_(1) { 4467 next_revision_(1) {
4474 DCHECK(low_id_ < mid_id_); 4468 DCHECK(low_id_ < mid_id_);
4475 DCHECK(mid_id_ < high_id_); 4469 DCHECK(mid_id_ < high_id_);
4476 DCHECK(low_id_ < high_id_); 4470 DCHECK(low_id_ < high_id_);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4511 // order. 4505 // order.
4512 const Id low_id_; 4506 const Id low_id_;
4513 const Id mid_id_; 4507 const Id mid_id_;
4514 const Id high_id_; 4508 const Id high_id_;
4515 4509
4516 private: 4510 private:
4517 int next_revision_; 4511 int next_revision_;
4518 DISALLOW_COPY_AND_ASSIGN(SyncerPositionTiebreakingTest); 4512 DISALLOW_COPY_AND_ASSIGN(SyncerPositionTiebreakingTest);
4519 }; 4513 };
4520 4514
4521 } // namespace
4522
4523 TEST_F(SyncerPositionTiebreakingTest, LowMidHigh) { 4515 TEST_F(SyncerPositionTiebreakingTest, LowMidHigh) {
4524 Add(low_id_); 4516 Add(low_id_);
4525 Add(mid_id_); 4517 Add(mid_id_);
4526 Add(high_id_); 4518 Add(high_id_);
4527 syncer_->SyncShare(); 4519 syncer_->SyncShare();
4528 ExpectLocalOrderIsByServerId(); 4520 ExpectLocalOrderIsByServerId();
4529 } 4521 }
4530 4522
4531 TEST_F(SyncerPositionTiebreakingTest, LowHighMid) { 4523 TEST_F(SyncerPositionTiebreakingTest, LowHighMid) {
4532 Add(low_id_); 4524 Add(low_id_);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
4565 Add(low_id_); 4557 Add(low_id_);
4566 Add(high_id_); 4558 Add(high_id_);
4567 syncer_->SyncShare(); 4559 syncer_->SyncShare();
4568 ExpectLocalOrderIsByServerId(); 4560 ExpectLocalOrderIsByServerId();
4569 } 4561 }
4570 4562
4571 const SyncerTest::CommitOrderingTest 4563 const SyncerTest::CommitOrderingTest
4572 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; 4564 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()};
4573 4565
4574 } // namespace browser_sync 4566 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/net/gaia_authenticator_unittest.cc ('k') | chrome/browser/sync/syncable/syncable.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698