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

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

Issue 8851006: [Sync] Replace all instances of ModelTypeSet with ModelEnumSet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup pass #2 Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 StatusController* status = session_->mutable_status_controller(); 363 StatusController* status = session_->mutable_status_controller();
364 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); 364 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir);
365 ScopedSetSessionWriteTransaction set_trans(session_.get(), &wtrans); 365 ScopedSetSessionWriteTransaction set_trans(session_.get(), &wtrans);
366 status->set_unsynced_handles(unsynced_handle_view); 366 status->set_unsynced_handles(unsynced_handle_view);
367 367
368 ModelSafeRoutingInfo routes; 368 ModelSafeRoutingInfo routes;
369 GetModelSafeRoutingInfo(&routes); 369 GetModelSafeRoutingInfo(&routes);
370 GetCommitIdsCommand command(limit); 370 GetCommitIdsCommand command(limit);
371 command.BuildCommitIds( 371 command.BuildCommitIds(
372 session_->status_controller().unsynced_handles(), 372 session_->status_controller().unsynced_handles(),
373 session_->write_transaction(), routes, syncable::ModelTypeSet()); 373 session_->write_transaction(), routes, syncable::ModelEnumSet());
374 vector<syncable::Id> output = 374 vector<syncable::Id> output =
375 command.ordered_commit_set_->GetAllCommitIds(); 375 command.ordered_commit_set_->GetAllCommitIds();
376 size_t truncated_size = std::min(limit, expected_id_order.size()); 376 size_t truncated_size = std::min(limit, expected_id_order.size());
377 ASSERT_TRUE(truncated_size == output.size()); 377 ASSERT_TRUE(truncated_size == output.size());
378 for (size_t i = 0; i < truncated_size; ++i) { 378 for (size_t i = 0; i < truncated_size; ++i) {
379 ASSERT_TRUE(expected_id_order[i] == output[i]) 379 ASSERT_TRUE(expected_id_order[i] == output[i])
380 << "At index " << i << " with batch size limited to " << limit; 380 << "At index " << i << " with batch size limited to " << limit;
381 } 381 }
382 sessions::OrderedCommitSet::Projection proj; 382 sessions::OrderedCommitSet::Projection proj;
383 proj = command.ordered_commit_set_->GetCommitIdProjection(GROUP_PASSIVE); 383 proj = command.ordered_commit_set_->GetCommitIdProjection(GROUP_PASSIVE);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 expected_order.push_back(ids_.MakeLocal("x")); 551 expected_order.push_back(ids_.MakeLocal("x"));
552 expected_order.push_back(ids_.MakeLocal("b")); 552 expected_order.push_back(ids_.MakeLocal("b"));
553 expected_order.push_back(ids_.MakeLocal("c")); 553 expected_order.push_back(ids_.MakeLocal("c"));
554 expected_order.push_back(ids_.MakeLocal("e")); 554 expected_order.push_back(ids_.MakeLocal("e"));
555 DoTruncationTest(dir, unsynced_handle_view, expected_order); 555 DoTruncationTest(dir, unsynced_handle_view, expected_order);
556 } 556 }
557 557
558 TEST_F(SyncerTest, GetCommitIdsFiltersThrottledEntries) { 558 TEST_F(SyncerTest, GetCommitIdsFiltersThrottledEntries) {
559 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); 559 ScopedDirLookup dir(syncdb_.manager(), syncdb_.name());
560 ASSERT_TRUE(dir.good()); 560 ASSERT_TRUE(dir.good());
561 syncable::ModelTypeSet throttled_types; 561 const syncable::ModelEnumSet throttled_types(syncable::BOOKMARKS);
562 throttled_types.insert(syncable::BOOKMARKS);
563 KeyParams key_params = {"localhost", "dummy", "foobar"}; 562 KeyParams key_params = {"localhost", "dummy", "foobar"};
564 sync_pb::EntitySpecifics bookmark_data; 563 sync_pb::EntitySpecifics bookmark_data;
565 AddDefaultExtensionValue(syncable::BOOKMARKS, &bookmark_data); 564 AddDefaultExtensionValue(syncable::BOOKMARKS, &bookmark_data);
566 565
567 mock_server_->AddUpdateDirectory(1, 0, "A", 10, 10); 566 mock_server_->AddUpdateDirectory(1, 0, "A", 10, 10);
568 SyncShareAsDelegate(); 567 SyncShareAsDelegate();
569 568
570 { 569 {
571 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); 570 WriteTransaction wtrans(FROM_HERE, UNITTEST, dir);
572 MutableEntry A(&wtrans, GET_BY_ID, ids_.FromNumber(1)); 571 MutableEntry A(&wtrans, GET_BY_ID, ids_.FromNumber(1));
(...skipping 4779 matching lines...) Expand 10 before | Expand all | Expand 10 after
5352 Add(low_id_); 5351 Add(low_id_);
5353 Add(high_id_); 5352 Add(high_id_);
5354 SyncShareAsDelegate(); 5353 SyncShareAsDelegate();
5355 ExpectLocalOrderIsByServerId(); 5354 ExpectLocalOrderIsByServerId();
5356 } 5355 }
5357 5356
5358 const SyncerTest::CommitOrderingTest 5357 const SyncerTest::CommitOrderingTest
5359 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()}; 5358 SyncerTest::CommitOrderingTest::LAST_COMMIT_ITEM = {-1, TestIdFactory::root()};
5360 5359
5361 } // namespace browser_sync 5360 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/engine/syncer_proto_util_unittest.cc ('k') | chrome/browser/sync/engine/syncer_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698