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

Side by Side Diff: components/sync/engine_impl/directory_commit_contribution_unittest.cc

Issue 2258873003: [Sync] Move sessions/ to engine/cycle/ and rename things to match. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/sync/engine_impl/directory_commit_contribution.h" 5 #include "components/sync/engine_impl/directory_commit_contribution.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "components/sync/base/attachment_id_proto.h" 13 #include "components/sync/base/attachment_id_proto.h"
14 #include "components/sync/sessions_impl/status_controller.h" 14 #include "components/sync/engine_impl/cycle/status_controller.h"
15 #include "components/sync/syncable/entry.h" 15 #include "components/sync/syncable/entry.h"
16 #include "components/sync/syncable/mutable_entry.h" 16 #include "components/sync/syncable/mutable_entry.h"
17 #include "components/sync/syncable/syncable_read_transaction.h" 17 #include "components/sync/syncable/syncable_read_transaction.h"
18 #include "components/sync/syncable/syncable_write_transaction.h" 18 #include "components/sync/syncable/syncable_write_transaction.h"
19 #include "components/sync/test/engine/test_directory_setter_upper.h" 19 #include "components/sync/test/engine/test_directory_setter_upper.h"
20 #include "components/sync/test/engine/test_id_factory.h" 20 #include "components/sync/test/engine/test_id_factory.h"
21 #include "components/sync/test/engine/test_syncable_utils.h" 21 #include "components/sync/test/engine/test_syncable_utils.h"
22 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
23 23
24 namespace syncer { 24 namespace syncer {
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 ASSERT_EQ(3, commit_message.entries_size()); 384 ASSERT_EQ(3, commit_message.entries_size());
385 385
386 sync_pb::ClientToServerResponse response; 386 sync_pb::ClientToServerResponse response;
387 for (int i = 0; i < commit_message.entries_size(); ++i) { 387 for (int i = 0; i < commit_message.entries_size(); ++i) {
388 sync_pb::SyncEntity entity = commit_message.entries(i); 388 sync_pb::SyncEntity entity = commit_message.entries(i);
389 sync_pb::CommitResponse_EntryResponse* entry_response = 389 sync_pb::CommitResponse_EntryResponse* entry_response =
390 response.mutable_commit()->add_entryresponse(); 390 response.mutable_commit()->add_entryresponse();
391 CreateSuccessfulCommitResponse(entity, entry_response); 391 CreateSuccessfulCommitResponse(entity, entry_response);
392 } 392 }
393 393
394 sessions::StatusController status; 394 StatusController status;
395 395
396 // Process these in reverse order. Just because we can. 396 // Process these in reverse order. Just because we can.
397 ext_cc->ProcessCommitResponse(response, &status); 397 ext_cc->ProcessCommitResponse(response, &status);
398 pref_cc->ProcessCommitResponse(response, &status); 398 pref_cc->ProcessCommitResponse(response, &status);
399 399
400 { 400 {
401 syncable::ReadTransaction trans(FROM_HERE, dir()); 401 syncable::ReadTransaction trans(FROM_HERE, dir());
402 syncable::Entry p1(&trans, syncable::GET_BY_HANDLE, pref1_handle); 402 syncable::Entry p1(&trans, syncable::GET_BY_HANDLE, pref1_handle);
403 EXPECT_TRUE(p1.GetId().ServerKnows()); 403 EXPECT_TRUE(p1.GetId().ServerKnows());
404 EXPECT_FALSE(p1.GetSyncing()); 404 EXPECT_FALSE(p1.GetSyncing());
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 ASSERT_EQ(1, commit_message.entries_size()); 471 ASSERT_EQ(1, commit_message.entries_size());
472 472
473 sync_pb::ClientToServerResponse response; 473 sync_pb::ClientToServerResponse response;
474 for (int i = 0; i < commit_message.entries_size(); ++i) { 474 for (int i = 0; i < commit_message.entries_size(); ++i) {
475 sync_pb::SyncEntity entity = commit_message.entries(i); 475 sync_pb::SyncEntity entity = commit_message.entries(i);
476 sync_pb::CommitResponse_EntryResponse* entry_response = 476 sync_pb::CommitResponse_EntryResponse* entry_response =
477 response.mutable_commit()->add_entryresponse(); 477 response.mutable_commit()->add_entryresponse();
478 CreateSuccessfulCommitResponse(entity, entry_response); 478 CreateSuccessfulCommitResponse(entity, entry_response);
479 } 479 }
480 480
481 sessions::StatusController status; 481 StatusController status;
482 art_cc->ProcessCommitResponse(response, &status); 482 art_cc->ProcessCommitResponse(response, &status);
483 { 483 {
484 syncable::ReadTransaction trans(FROM_HERE, dir()); 484 syncable::ReadTransaction trans(FROM_HERE, dir());
485 485
486 syncable::Entry a1(&trans, syncable::GET_BY_HANDLE, art1_handle); 486 syncable::Entry a1(&trans, syncable::GET_BY_HANDLE, art1_handle);
487 EXPECT_TRUE(a1.GetId().ServerKnows()); 487 EXPECT_TRUE(a1.GetId().ServerKnows());
488 EXPECT_FALSE(a1.GetSyncing()); 488 EXPECT_FALSE(a1.GetSyncing());
489 EXPECT_FALSE(a1.GetDirtySync()); 489 EXPECT_FALSE(a1.GetDirtySync());
490 EXPECT_LT(0, a1.GetServerVersion()); 490 EXPECT_LT(0, a1.GetServerVersion());
491 491
492 syncable::Entry a2(&trans, syncable::GET_BY_HANDLE, art2_handle); 492 syncable::Entry a2(&trans, syncable::GET_BY_HANDLE, art2_handle);
493 EXPECT_FALSE(a2.GetId().ServerKnows()); 493 EXPECT_FALSE(a2.GetId().ServerKnows());
494 EXPECT_FALSE(a2.GetSyncing()); 494 EXPECT_FALSE(a2.GetSyncing());
495 EXPECT_FALSE(a2.GetDirtySync()); 495 EXPECT_FALSE(a2.GetDirtySync());
496 EXPECT_EQ(0, a2.GetServerVersion()); 496 EXPECT_EQ(0, a2.GetServerVersion());
497 497
498 syncable::Entry a3(&trans, syncable::GET_BY_HANDLE, art3_handle); 498 syncable::Entry a3(&trans, syncable::GET_BY_HANDLE, art3_handle);
499 EXPECT_FALSE(a3.GetId().ServerKnows()); 499 EXPECT_FALSE(a3.GetId().ServerKnows());
500 EXPECT_FALSE(a3.GetSyncing()); 500 EXPECT_FALSE(a3.GetSyncing());
501 EXPECT_FALSE(a3.GetDirtySync()); 501 EXPECT_FALSE(a3.GetDirtySync());
502 EXPECT_EQ(0, a3.GetServerVersion()); 502 EXPECT_EQ(0, a3.GetServerVersion());
503 } 503 }
504 504
505 art_cc->CleanUp(); 505 art_cc->CleanUp();
506 } 506 }
507 507
508 } // namespace syncer 508 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698