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

Side by Side Diff: components/sync/sessions/sync_session_snapshot_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/sync/sessions/sync_session_snapshot.h"
6
7 #include <memory>
8 #include <vector>
9
10 #include "base/test/values_test_util.h"
11 #include "base/values.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 namespace syncer {
15 namespace sessions {
16 namespace {
17
18 using base::ExpectDictBooleanValue;
19 using base::ExpectDictDictionaryValue;
20 using base::ExpectDictIntegerValue;
21 using base::ExpectDictListValue;
22 using base::ExpectDictStringValue;
23
24 class SyncSessionSnapshotTest : public testing::Test {};
25
26 TEST_F(SyncSessionSnapshotTest, SyncSessionSnapshotToValue) {
27 ModelNeutralState model_neutral;
28 model_neutral.num_successful_commits = 5;
29 model_neutral.num_successful_bookmark_commits = 10;
30 model_neutral.num_updates_downloaded_total = 100;
31 model_neutral.num_tombstone_updates_downloaded_total = 200;
32 model_neutral.num_reflected_updates_downloaded_total = 50;
33 model_neutral.num_local_overwrites = 15;
34 model_neutral.num_server_overwrites = 18;
35
36 ProgressMarkerMap download_progress_markers;
37 download_progress_markers[BOOKMARKS] = "\xef\xb7\xa4";
38 download_progress_markers[APPS] = "apps";
39 std::unique_ptr<base::DictionaryValue>
40 expected_download_progress_markers_value(
41 ProgressMarkerMapToValue(download_progress_markers));
42
43 const bool kIsSilenced = true;
44 const int kNumEncryptionConflicts = 1054;
45 const int kNumHierarchyConflicts = 1055;
46 const int kNumServerConflicts = 1057;
47
48 SyncSessionSnapshot snapshot(model_neutral, download_progress_markers,
49 kIsSilenced, kNumEncryptionConflicts,
50 kNumHierarchyConflicts, kNumServerConflicts,
51 false, 0, base::Time::Now(), base::Time::Now(),
52 std::vector<int>(MODEL_TYPE_COUNT, 0),
53 std::vector<int>(MODEL_TYPE_COUNT, 0),
54 sync_pb::GetUpdatesCallerInfo::UNKNOWN);
55 std::unique_ptr<base::DictionaryValue> value(snapshot.ToValue());
56 EXPECT_EQ(16u, value->size());
57 ExpectDictIntegerValue(model_neutral.num_successful_commits, *value,
58 "numSuccessfulCommits");
59 ExpectDictIntegerValue(model_neutral.num_successful_bookmark_commits, *value,
60 "numSuccessfulBookmarkCommits");
61 ExpectDictIntegerValue(model_neutral.num_updates_downloaded_total, *value,
62 "numUpdatesDownloadedTotal");
63 ExpectDictIntegerValue(model_neutral.num_tombstone_updates_downloaded_total,
64 *value, "numTombstoneUpdatesDownloadedTotal");
65 ExpectDictIntegerValue(model_neutral.num_reflected_updates_downloaded_total,
66 *value, "numReflectedUpdatesDownloadedTotal");
67 ExpectDictIntegerValue(model_neutral.num_local_overwrites, *value,
68 "numLocalOverwrites");
69 ExpectDictIntegerValue(model_neutral.num_server_overwrites, *value,
70 "numServerOverwrites");
71 ExpectDictDictionaryValue(*expected_download_progress_markers_value, *value,
72 "downloadProgressMarkers");
73 ExpectDictBooleanValue(kIsSilenced, *value, "isSilenced");
74 ExpectDictIntegerValue(kNumEncryptionConflicts, *value,
75 "numEncryptionConflicts");
76 ExpectDictIntegerValue(kNumHierarchyConflicts, *value,
77 "numHierarchyConflicts");
78 ExpectDictIntegerValue(kNumServerConflicts, *value, "numServerConflicts");
79 ExpectDictBooleanValue(false, *value, "notificationsEnabled");
80 }
81
82 } // namespace
83 } // namespace sessions
84 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/sessions/sync_session_snapshot.cc ('k') | components/sync/sessions/type_debug_info_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698