Chromium Code Reviews| 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/values.h" | 10 #include "base/values.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 180 SET_FIELD(theme); | 180 SET_FIELD(theme); |
| 181 SET_FIELD(typed_url); | 181 SET_FIELD(typed_url); |
| 182 | 182 |
| 183 #undef SET_FIELD | 183 #undef SET_FIELD |
| 184 | 184 |
| 185 scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics)); | 185 scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics)); |
| 186 EXPECT_EQ(syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE, | 186 EXPECT_EQ(syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE, |
| 187 static_cast<int>(value->size())); | 187 static_cast<int>(value->size())); |
| 188 } | 188 } |
| 189 | 189 |
| 190 TEST_F(ProtoValueConversionsTest, ClientToServerMessageToValue) { | |
| 191 sync_pb::ClientToServerMessage message; | |
|
akalin
2012/03/17 01:55:05
You should put a specifics in this message, and te
lipalani1
2012/03/19 19:24:37
Done.
| |
| 192 scoped_ptr<DictionaryValue> value_with_specifics( | |
| 193 ClientToServerMessageToValue(message, true /* include_specifics */)); | |
| 194 EXPECT_FALSE(value_with_specifics->empty()); | |
| 195 | |
| 196 scoped_ptr<DictionaryValue> value_without_specifics( | |
| 197 ClientToServerMessageToValue(message, false /* include_specifics */)); | |
| 198 EXPECT_FALSE(value_without_specifics->empty()); | |
| 199 } | |
| 200 | |
| 201 TEST_F(ProtoValueConversionsTest, ClientToServerResponseToValue) { | |
| 202 sync_pb::ClientToServerResponse message; | |
| 203 scoped_ptr<DictionaryValue> value_with_specifics( | |
|
akalin
2012/03/17 01:55:05
same here
lipalani1
2012/03/19 19:24:37
Done.
| |
| 204 ClientToServerResponseToValue(message, true /* include_specifics */)); | |
| 205 EXPECT_FALSE(value_with_specifics->empty()); | |
| 206 | |
| 207 scoped_ptr<DictionaryValue> value_without_specifics( | |
| 208 ClientToServerResponseToValue(message, false /* include_specifics */)); | |
| 209 EXPECT_FALSE(value_without_specifics->empty()); | |
| 210 } | |
| 211 | |
| 190 } // namespace | 212 } // namespace |
| 191 } // namespace browser_sync | 213 } // namespace browser_sync |
| OLD | NEW |