| 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" |
| 11 #include "sync/internal_api/public/syncable/model_type.h" | 11 #include "sync/internal_api/public/syncable/model_type.h" |
| 12 #include "sync/protocol/app_notification_specifics.pb.h" | 12 #include "sync/protocol/app_notification_specifics.pb.h" |
| 13 #include "sync/protocol/app_setting_specifics.pb.h" | 13 #include "sync/protocol/app_setting_specifics.pb.h" |
| 14 #include "sync/protocol/app_specifics.pb.h" | 14 #include "sync/protocol/app_specifics.pb.h" |
| 15 #include "sync/protocol/autofill_specifics.pb.h" | 15 #include "sync/protocol/autofill_specifics.pb.h" |
| 16 #include "sync/protocol/bookmark_specifics.pb.h" | 16 #include "sync/protocol/bookmark_specifics.pb.h" |
| 17 #include "sync/protocol/encryption.pb.h" | 17 #include "sync/protocol/encryption.pb.h" |
| 18 #include "sync/protocol/extension_setting_specifics.pb.h" | 18 #include "sync/protocol/extension_setting_specifics.pb.h" |
| 19 #include "sync/protocol/extension_specifics.pb.h" | 19 #include "sync/protocol/extension_specifics.pb.h" |
| 20 #include "sync/protocol/nigori_specifics.pb.h" | 20 #include "sync/protocol/nigori_specifics.pb.h" |
| 21 #include "sync/protocol/password_specifics.pb.h" | 21 #include "sync/protocol/password_specifics.pb.h" |
| 22 #include "sync/protocol/preference_specifics.pb.h" | 22 #include "sync/protocol/preference_specifics.pb.h" |
| 23 #include "sync/protocol/search_engine_specifics.pb.h" | 23 #include "sync/protocol/search_engine_specifics.pb.h" |
| 24 #include "sync/protocol/session_specifics.pb.h" | 24 #include "sync/protocol/session_specifics.pb.h" |
| 25 #include "sync/protocol/sync.pb.h" | 25 #include "sync/protocol/sync.pb.h" |
| 26 #include "sync/protocol/theme_specifics.pb.h" | 26 #include "sync/protocol/theme_specifics.pb.h" |
| 27 #include "sync/protocol/typed_url_specifics.pb.h" | 27 #include "sync/protocol/typed_url_specifics.pb.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 29 | 29 |
| 30 namespace csync { | 30 namespace syncer { |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 class ProtoValueConversionsTest : public testing::Test { | 33 class ProtoValueConversionsTest : public testing::Test { |
| 34 protected: | 34 protected: |
| 35 template <class T> | 35 template <class T> |
| 36 void TestSpecificsToValue( | 36 void TestSpecificsToValue( |
| 37 DictionaryValue* (*specifics_to_value)(const T&)) { | 37 DictionaryValue* (*specifics_to_value)(const T&)) { |
| 38 const T& specifics(T::default_instance()); | 38 const T& specifics(T::default_instance()); |
| 39 scoped_ptr<DictionaryValue> value(specifics_to_value(specifics)); | 39 scoped_ptr<DictionaryValue> value(specifics_to_value(specifics)); |
| 40 // We can't do much but make sure that the returned value has | 40 // We can't do much but make sure that the returned value has |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 "get_updates.entries")); | 243 "get_updates.entries")); |
| 244 | 244 |
| 245 scoped_ptr<DictionaryValue> value_without_specifics( | 245 scoped_ptr<DictionaryValue> value_without_specifics( |
| 246 ClientToServerResponseToValue(message, false /* include_specifics */)); | 246 ClientToServerResponseToValue(message, false /* include_specifics */)); |
| 247 EXPECT_FALSE(value_without_specifics->empty()); | 247 EXPECT_FALSE(value_without_specifics->empty()); |
| 248 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), | 248 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), |
| 249 "get_updates.entries")); | 249 "get_updates.entries")); |
| 250 } | 250 } |
| 251 | 251 |
| 252 } // namespace | 252 } // namespace |
| 253 } // namespace csync | 253 } // namespace syncer |
| OLD | NEW |