OLD | NEW |
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" | 10 #include "base/string_number_conversions.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 TEST_F(ProtoValueConversionsTest, AutofillProfileSpecificsToValue) { | 117 TEST_F(ProtoValueConversionsTest, AutofillProfileSpecificsToValue) { |
118 TestSpecificsToValue(AutofillProfileSpecificsToValue); | 118 TestSpecificsToValue(AutofillProfileSpecificsToValue); |
119 } | 119 } |
120 | 120 |
121 TEST_F(ProtoValueConversionsTest, BookmarkSpecificsToValue) { | 121 TEST_F(ProtoValueConversionsTest, BookmarkSpecificsToValue) { |
122 TestSpecificsToValue(BookmarkSpecificsToValue); | 122 TestSpecificsToValue(BookmarkSpecificsToValue); |
123 } | 123 } |
124 | 124 |
125 TEST_F(ProtoValueConversionsTest, BookmarkSpecificsData) { | 125 TEST_F(ProtoValueConversionsTest, BookmarkSpecificsData) { |
126 const base::Time creation_time(base::Time::Now()); | 126 const base::Time creation_time(base::Time::Now()); |
| 127 const std::string icon_url = "http://www.google.com/favicon.ico"; |
127 sync_pb::BookmarkSpecifics specifics; | 128 sync_pb::BookmarkSpecifics specifics; |
128 specifics.set_creation_time_us(creation_time.ToInternalValue()); | 129 specifics.set_creation_time_us(creation_time.ToInternalValue()); |
| 130 specifics.set_icon_url(icon_url); |
129 scoped_ptr<DictionaryValue> value(BookmarkSpecificsToValue(specifics)); | 131 scoped_ptr<DictionaryValue> value(BookmarkSpecificsToValue(specifics)); |
130 EXPECT_FALSE(value->empty()); | 132 EXPECT_FALSE(value->empty()); |
131 std::string encoded_time; | 133 std::string encoded_time; |
132 EXPECT_TRUE(value->GetString("creation_time_us", &encoded_time)); | 134 EXPECT_TRUE(value->GetString("creation_time_us", &encoded_time)); |
133 EXPECT_EQ(base::Int64ToString(creation_time.ToInternalValue()), encoded_time); | 135 EXPECT_EQ(base::Int64ToString(creation_time.ToInternalValue()), encoded_time); |
| 136 std::string encoded_icon_url; |
| 137 EXPECT_TRUE(value->GetString("icon_url", &encoded_icon_url)); |
| 138 EXPECT_EQ(icon_url, encoded_icon_url); |
134 } | 139 } |
135 | 140 |
136 TEST_F(ProtoValueConversionsTest, DeviceInfoSpecificsToValue) { | 141 TEST_F(ProtoValueConversionsTest, DeviceInfoSpecificsToValue) { |
137 TestSpecificsToValue(DeviceInfoSpecificsToValue); | 142 TestSpecificsToValue(DeviceInfoSpecificsToValue); |
138 } | 143 } |
139 | 144 |
140 TEST_F(ProtoValueConversionsTest, ExperimentsSpecificsToValue) { | 145 TEST_F(ProtoValueConversionsTest, ExperimentsSpecificsToValue) { |
141 TestSpecificsToValue(ExperimentsSpecificsToValue); | 146 TestSpecificsToValue(ExperimentsSpecificsToValue); |
142 } | 147 } |
143 | 148 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 277 |
273 scoped_ptr<DictionaryValue> value_without_specifics( | 278 scoped_ptr<DictionaryValue> value_without_specifics( |
274 ClientToServerResponseToValue(message, false /* include_specifics */)); | 279 ClientToServerResponseToValue(message, false /* include_specifics */)); |
275 EXPECT_FALSE(value_without_specifics->empty()); | 280 EXPECT_FALSE(value_without_specifics->empty()); |
276 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), | 281 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), |
277 "get_updates.entries")); | 282 "get_updates.entries")); |
278 } | 283 } |
279 | 284 |
280 } // namespace | 285 } // namespace |
281 } // namespace syncer | 286 } // namespace syncer |
OLD | NEW |