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/protocol/proto_value_conversions_unittest.cc

Issue 11090083: Makes sync code persist the date the node was added. I'm hoping this covers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 years, 2 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 | « sync/protocol/proto_value_conversions.cc ('k') | no next file » | 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 // Keep this file in sync with the .proto files in this directory. 5 // Keep this file in sync with the .proto files in this directory.
6 6
7 #include "sync/protocol/proto_value_conversions.h" 7 #include "sync/protocol/proto_value_conversions.h"
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_number_conversions.h"
11 #include "base/time.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "sync/internal_api/public/base/model_type.h" 13 #include "sync/internal_api/public/base/model_type.h"
12 #include "sync/protocol/app_notification_specifics.pb.h" 14 #include "sync/protocol/app_notification_specifics.pb.h"
13 #include "sync/protocol/app_setting_specifics.pb.h" 15 #include "sync/protocol/app_setting_specifics.pb.h"
14 #include "sync/protocol/app_specifics.pb.h" 16 #include "sync/protocol/app_specifics.pb.h"
15 #include "sync/protocol/autofill_specifics.pb.h" 17 #include "sync/protocol/autofill_specifics.pb.h"
16 #include "sync/protocol/bookmark_specifics.pb.h" 18 #include "sync/protocol/bookmark_specifics.pb.h"
17 #include "sync/protocol/encryption.pb.h" 19 #include "sync/protocol/encryption.pb.h"
18 #include "sync/protocol/extension_setting_specifics.pb.h" 20 #include "sync/protocol/extension_setting_specifics.pb.h"
19 #include "sync/protocol/extension_specifics.pb.h" 21 #include "sync/protocol/extension_specifics.pb.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 115 }
114 116
115 TEST_F(ProtoValueConversionsTest, AutofillProfileSpecificsToValue) { 117 TEST_F(ProtoValueConversionsTest, AutofillProfileSpecificsToValue) {
116 TestSpecificsToValue(AutofillProfileSpecificsToValue); 118 TestSpecificsToValue(AutofillProfileSpecificsToValue);
117 } 119 }
118 120
119 TEST_F(ProtoValueConversionsTest, BookmarkSpecificsToValue) { 121 TEST_F(ProtoValueConversionsTest, BookmarkSpecificsToValue) {
120 TestSpecificsToValue(BookmarkSpecificsToValue); 122 TestSpecificsToValue(BookmarkSpecificsToValue);
121 } 123 }
122 124
125 TEST_F(ProtoValueConversionsTest, BookmarkSpecificsData) {
126 const base::Time creation_time(base::Time::Now());
127 sync_pb::BookmarkSpecifics specifics;
128 specifics.set_creation_time_us(creation_time.ToInternalValue());
129 scoped_ptr<DictionaryValue> value(BookmarkSpecificsToValue(specifics));
130 EXPECT_FALSE(value->empty());
131 std::string encoded_time;
132 EXPECT_TRUE(value->GetString("creation_time_us", &encoded_time));
133 EXPECT_EQ(base::Int64ToString(creation_time.ToInternalValue()), encoded_time);
134 }
135
123 TEST_F(ProtoValueConversionsTest, ExtensionSettingSpecificsToValue) { 136 TEST_F(ProtoValueConversionsTest, ExtensionSettingSpecificsToValue) {
124 TestSpecificsToValue(ExtensionSettingSpecificsToValue); 137 TestSpecificsToValue(ExtensionSettingSpecificsToValue);
125 } 138 }
126 139
127 TEST_F(ProtoValueConversionsTest, ExtensionSpecificsToValue) { 140 TEST_F(ProtoValueConversionsTest, ExtensionSpecificsToValue) {
128 TestSpecificsToValue(ExtensionSpecificsToValue); 141 TestSpecificsToValue(ExtensionSpecificsToValue);
129 } 142 }
130 143
131 TEST_F(ProtoValueConversionsTest, NigoriSpecificsToValue) { 144 TEST_F(ProtoValueConversionsTest, NigoriSpecificsToValue) {
132 TestSpecificsToValue(NigoriSpecificsToValue); 145 TestSpecificsToValue(NigoriSpecificsToValue);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 257
245 scoped_ptr<DictionaryValue> value_without_specifics( 258 scoped_ptr<DictionaryValue> value_without_specifics(
246 ClientToServerResponseToValue(message, false /* include_specifics */)); 259 ClientToServerResponseToValue(message, false /* include_specifics */));
247 EXPECT_FALSE(value_without_specifics->empty()); 260 EXPECT_FALSE(value_without_specifics->empty());
248 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), 261 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()),
249 "get_updates.entries")); 262 "get_updates.entries"));
250 } 263 }
251 264
252 } // namespace 265 } // namespace
253 } // namespace syncer 266 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/protocol/proto_value_conversions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698