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

Side by Side Diff: sync/api/sync_change_unittest.cc

Issue 17034006: Add base namespace to more values in sync and elsewhere. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « net/url_request/url_request_netlog_params.cc ('k') | sync/api/sync_data.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/api/sync_change.h" 5 #include "sync/api/sync_change.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 29 matching lines...) Expand all
40 pref_specifics->set_name("test"); 40 pref_specifics->set_name("test");
41 std::string tag = "client_tag"; 41 std::string tag = "client_tag";
42 std::string title = "client_title"; 42 std::string title = "client_title";
43 SyncChange e(FROM_HERE, 43 SyncChange e(FROM_HERE,
44 change_type, 44 change_type,
45 SyncData::CreateLocalData(tag, title, specifics)); 45 SyncData::CreateLocalData(tag, title, specifics));
46 EXPECT_EQ(change_type, e.change_type()); 46 EXPECT_EQ(change_type, e.change_type());
47 EXPECT_EQ(tag, e.sync_data().GetTag()); 47 EXPECT_EQ(tag, e.sync_data().GetTag());
48 EXPECT_EQ(title, e.sync_data().GetTitle()); 48 EXPECT_EQ(title, e.sync_data().GetTitle());
49 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); 49 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType());
50 scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue(specifics)); 50 scoped_ptr<base::DictionaryValue> ref_spec(EntitySpecificsToValue(specifics));
51 scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( 51 scoped_ptr<base::DictionaryValue> e_spec(EntitySpecificsToValue(
52 e.sync_data().GetSpecifics())); 52 e.sync_data().GetSpecifics()));
53 EXPECT_TRUE(ref_spec->Equals(e_spec.get())); 53 EXPECT_TRUE(ref_spec->Equals(e_spec.get()));
54 } 54 }
55 55
56 TEST_F(SyncChangeTest, LocalAdd) { 56 TEST_F(SyncChangeTest, LocalAdd) {
57 SyncChange::SyncChangeType change_type = SyncChange::ACTION_ADD; 57 SyncChange::SyncChangeType change_type = SyncChange::ACTION_ADD;
58 sync_pb::EntitySpecifics specifics; 58 sync_pb::EntitySpecifics specifics;
59 sync_pb::PreferenceSpecifics* pref_specifics = specifics.mutable_preference(); 59 sync_pb::PreferenceSpecifics* pref_specifics = specifics.mutable_preference();
60 pref_specifics->set_name("test"); 60 pref_specifics->set_name("test");
61 std::string tag = "client_tag"; 61 std::string tag = "client_tag";
62 std::string title = "client_title"; 62 std::string title = "client_title";
63 SyncChange e(FROM_HERE, 63 SyncChange e(FROM_HERE,
64 change_type, 64 change_type,
65 SyncData::CreateLocalData(tag, title, specifics)); 65 SyncData::CreateLocalData(tag, title, specifics));
66 EXPECT_EQ(change_type, e.change_type()); 66 EXPECT_EQ(change_type, e.change_type());
67 EXPECT_EQ(tag, e.sync_data().GetTag()); 67 EXPECT_EQ(tag, e.sync_data().GetTag());
68 EXPECT_EQ(title, e.sync_data().GetTitle()); 68 EXPECT_EQ(title, e.sync_data().GetTitle());
69 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); 69 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType());
70 scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue(specifics)); 70 scoped_ptr<base::DictionaryValue> ref_spec(EntitySpecificsToValue(specifics));
71 scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( 71 scoped_ptr<base::DictionaryValue> e_spec(EntitySpecificsToValue(
72 e.sync_data().GetSpecifics())); 72 e.sync_data().GetSpecifics()));
73 EXPECT_TRUE(ref_spec->Equals(e_spec.get())); 73 EXPECT_TRUE(ref_spec->Equals(e_spec.get()));
74 } 74 }
75 75
76 TEST_F(SyncChangeTest, SyncerChanges) { 76 TEST_F(SyncChangeTest, SyncerChanges) {
77 SyncChangeList change_list; 77 SyncChangeList change_list;
78 78
79 // Create an update. 79 // Create an update.
80 sync_pb::EntitySpecifics update_specifics; 80 sync_pb::EntitySpecifics update_specifics;
81 sync_pb::PreferenceSpecifics* pref_specifics = 81 sync_pb::PreferenceSpecifics* pref_specifics =
(...skipping 21 matching lines...) Expand all
103 FROM_HERE, 103 FROM_HERE,
104 SyncChange::ACTION_DELETE, 104 SyncChange::ACTION_DELETE,
105 SyncData::CreateRemoteData(3, delete_specifics))); 105 SyncData::CreateRemoteData(3, delete_specifics)));
106 106
107 ASSERT_EQ(3U, change_list.size()); 107 ASSERT_EQ(3U, change_list.size());
108 108
109 // Verify update. 109 // Verify update.
110 SyncChange e = change_list[0]; 110 SyncChange e = change_list[0];
111 EXPECT_EQ(SyncChange::ACTION_UPDATE, e.change_type()); 111 EXPECT_EQ(SyncChange::ACTION_UPDATE, e.change_type());
112 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); 112 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType());
113 scoped_ptr<DictionaryValue> ref_spec(EntitySpecificsToValue( 113 scoped_ptr<base::DictionaryValue> ref_spec(EntitySpecificsToValue(
114 update_specifics)); 114 update_specifics));
115 scoped_ptr<DictionaryValue> e_spec(EntitySpecificsToValue( 115 scoped_ptr<base::DictionaryValue> e_spec(EntitySpecificsToValue(
116 e.sync_data().GetSpecifics())); 116 e.sync_data().GetSpecifics()));
117 EXPECT_TRUE(ref_spec->Equals(e_spec.get())); 117 EXPECT_TRUE(ref_spec->Equals(e_spec.get()));
118 118
119 // Verify add. 119 // Verify add.
120 e = change_list[1]; 120 e = change_list[1];
121 EXPECT_EQ(SyncChange::ACTION_ADD, e.change_type()); 121 EXPECT_EQ(SyncChange::ACTION_ADD, e.change_type());
122 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); 122 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType());
123 ref_spec.reset(EntitySpecificsToValue(add_specifics)); 123 ref_spec.reset(EntitySpecificsToValue(add_specifics));
124 e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics())); 124 e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics()));
125 EXPECT_TRUE(ref_spec->Equals(e_spec.get())); 125 EXPECT_TRUE(ref_spec->Equals(e_spec.get()));
126 126
127 // Verify delete. 127 // Verify delete.
128 e = change_list[2]; 128 e = change_list[2];
129 EXPECT_EQ(SyncChange::ACTION_DELETE, e.change_type()); 129 EXPECT_EQ(SyncChange::ACTION_DELETE, e.change_type());
130 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType()); 130 EXPECT_EQ(PREFERENCES, e.sync_data().GetDataType());
131 ref_spec.reset(EntitySpecificsToValue(delete_specifics)); 131 ref_spec.reset(EntitySpecificsToValue(delete_specifics));
132 e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics())); 132 e_spec.reset(EntitySpecificsToValue(e.sync_data().GetSpecifics()));
133 EXPECT_TRUE(ref_spec->Equals(e_spec.get())); 133 EXPECT_TRUE(ref_spec->Equals(e_spec.get()));
134 } 134 }
135 135
136 } // namespace 136 } // namespace
137 137
138 } // namespace syncer 138 } // namespace syncer
OLDNEW
« no previous file with comments | « net/url_request/url_request_netlog_params.cc ('k') | sync/api/sync_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698