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

Side by Side Diff: sync/sessions/sync_session_unittest.cc

Issue 10917234: sync: make scheduling logic and job ownership more obvious. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test + comment + rebase Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "sync/sessions/sync_session.h" 5 #include "sync/sessions/sync_session.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 expected_enabled_groups_one.insert(GROUP_DB); 361 expected_enabled_groups_one.insert(GROUP_DB);
362 362
363 std::set<ModelSafeGroup> expected_enabled_groups_two; 363 std::set<ModelSafeGroup> expected_enabled_groups_two;
364 expected_enabled_groups_two.insert(GROUP_PASSIVE); 364 expected_enabled_groups_two.insert(GROUP_PASSIVE);
365 expected_enabled_groups_two.insert(GROUP_DB); 365 expected_enabled_groups_two.insert(GROUP_DB);
366 expected_enabled_groups_two.insert(GROUP_UI); 366 expected_enabled_groups_two.insert(GROUP_UI);
367 367
368 EXPECT_EQ(expected_enabled_groups_one, one.GetEnabledGroups()); 368 EXPECT_EQ(expected_enabled_groups_one, one.GetEnabledGroups());
369 EXPECT_EQ(expected_enabled_groups_two, two.GetEnabledGroups()); 369 EXPECT_EQ(expected_enabled_groups_two, two.GetEnabledGroups());
370 370
371 two.RebaseRoutingInfoWithLatest(one); 371 two.RebaseRoutingInfoWithLatest(one.routing_info(), one.workers());
372 372
373 EXPECT_EQ(expected_enabled_groups_one, one.GetEnabledGroups()); 373 EXPECT_EQ(expected_enabled_groups_one, one.GetEnabledGroups());
374 EXPECT_EQ(expected_enabled_groups_one, two.GetEnabledGroups()); 374 EXPECT_EQ(expected_enabled_groups_one, two.GetEnabledGroups());
375 375
376 // Make sure the source has not been touched. 376 // Make sure the source has not been touched.
377 EXPECT_EQ(two.source().updates_source, 377 EXPECT_EQ(two.source().updates_source,
378 sync_pb::GetUpdatesCallerInfo::LOCAL); 378 sync_pb::GetUpdatesCallerInfo::LOCAL);
379 379
380 // Make sure the payload is reduced to one. 380 // Make sure the payload is reduced to one.
381 EXPECT_THAT(one_type, Eq(two.source().types)); 381 EXPECT_THAT(one_type, Eq(two.source().types));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 workers_second); 431 workers_second);
432 432
433 std::set<ModelSafeGroup> expected_enabled_groups; 433 std::set<ModelSafeGroup> expected_enabled_groups;
434 expected_enabled_groups.insert(GROUP_PASSIVE); 434 expected_enabled_groups.insert(GROUP_PASSIVE);
435 expected_enabled_groups.insert(GROUP_DB); 435 expected_enabled_groups.insert(GROUP_DB);
436 expected_enabled_groups.insert(GROUP_UI); 436 expected_enabled_groups.insert(GROUP_UI);
437 437
438 EXPECT_EQ(expected_enabled_groups, first.GetEnabledGroups()); 438 EXPECT_EQ(expected_enabled_groups, first.GetEnabledGroups());
439 EXPECT_EQ(expected_enabled_groups, second.GetEnabledGroups()); 439 EXPECT_EQ(expected_enabled_groups, second.GetEnabledGroups());
440 440
441 second.RebaseRoutingInfoWithLatest(first); 441 second.RebaseRoutingInfoWithLatest(first.routing_info(), first.workers());
442 442
443 EXPECT_EQ(expected_enabled_groups, first.GetEnabledGroups()); 443 EXPECT_EQ(expected_enabled_groups, first.GetEnabledGroups());
444 EXPECT_EQ(expected_enabled_groups, second.GetEnabledGroups()); 444 EXPECT_EQ(expected_enabled_groups, second.GetEnabledGroups());
445 445
446 // Make sure the source has not been touched. 446 // Make sure the source has not been touched.
447 EXPECT_EQ(second.source().updates_source, 447 EXPECT_EQ(second.source().updates_source,
448 sync_pb::GetUpdatesCallerInfo::LOCAL); 448 sync_pb::GetUpdatesCallerInfo::LOCAL);
449 449
450 // Make sure our payload is still the same. 450 // Make sure our payload is still the same.
451 EXPECT_THAT(all_types, Eq(second.source().types)); 451 EXPECT_THAT(all_types, Eq(second.source().types));
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 497
498 ASSERT_EQ(3U, type_state_map.size()); 498 ASSERT_EQ(3U, type_state_map.size());
499 EXPECT_EQ(type_state_map[BOOKMARKS].payload, payload); 499 EXPECT_EQ(type_state_map[BOOKMARKS].payload, payload);
500 EXPECT_EQ(type_state_map[PASSWORDS].payload, payload); 500 EXPECT_EQ(type_state_map[PASSWORDS].payload, payload);
501 EXPECT_EQ(type_state_map[AUTOFILL].payload, payload); 501 EXPECT_EQ(type_state_map[AUTOFILL].payload, payload);
502 } 502 }
503 503
504 } // namespace 504 } // namespace
505 } // namespace sessions 505 } // namespace sessions
506 } // namespace syncer 506 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698