| 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. | |
| 6 | |
| 7 #include "components/sync/protocol/proto_value_conversions.h" | 5 #include "components/sync/protocol/proto_value_conversions.h" |
| 8 | 6 |
| 9 #include <string> | 7 #include <string> |
| 10 | 8 |
| 11 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 12 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 13 #include "base/values.h" | 11 #include "base/values.h" |
| 14 #include "components/sync/base/model_type.h" | 12 #include "components/sync/base/model_type.h" |
| 15 #include "components/sync/protocol/app_notification_specifics.pb.h" | 13 #include "components/sync/protocol/app_notification_specifics.pb.h" |
| 16 #include "components/sync/protocol/app_setting_specifics.pb.h" | 14 #include "components/sync/protocol/app_setting_specifics.pb.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 #include "components/sync/protocol/session_specifics.pb.h" | 34 #include "components/sync/protocol/session_specifics.pb.h" |
| 37 #include "components/sync/protocol/sync.pb.h" | 35 #include "components/sync/protocol/sync.pb.h" |
| 38 #include "components/sync/protocol/theme_specifics.pb.h" | 36 #include "components/sync/protocol/theme_specifics.pb.h" |
| 39 #include "components/sync/protocol/typed_url_specifics.pb.h" | 37 #include "components/sync/protocol/typed_url_specifics.pb.h" |
| 40 #include "components/sync/protocol/wifi_credential_specifics.pb.h" | 38 #include "components/sync/protocol/wifi_credential_specifics.pb.h" |
| 41 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 42 | 40 |
| 43 namespace syncer { | 41 namespace syncer { |
| 44 namespace { | 42 namespace { |
| 45 | 43 |
| 44 // Keep this file in sync with the .proto files in this directory. |
| 46 class ProtoValueConversionsTest : public testing::Test { | 45 class ProtoValueConversionsTest : public testing::Test { |
| 47 protected: | 46 protected: |
| 48 template <class T> | 47 template <class T> |
| 49 void TestSpecificsToValue( | 48 void TestSpecificsToValue( |
| 50 std::unique_ptr<base::DictionaryValue> (*specifics_to_value)(const T&)) { | 49 std::unique_ptr<base::DictionaryValue> (*specifics_to_value)(const T&)) { |
| 51 const T& specifics(T::default_instance()); | 50 const T& specifics(T::default_instance()); |
| 52 std::unique_ptr<base::DictionaryValue> value = | 51 std::unique_ptr<base::DictionaryValue> value = |
| 53 specifics_to_value(specifics); | 52 specifics_to_value(specifics); |
| 54 // We can't do much but make sure that this doesn't crash. | 53 // We can't do much but make sure that this doesn't crash. |
| 55 } | 54 } |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), | 414 EXPECT_FALSE(ValueHasSpecifics(*(value_without_specifics.get()), |
| 416 "get_updates.entries")); | 415 "get_updates.entries")); |
| 417 } | 416 } |
| 418 | 417 |
| 419 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { | 418 TEST_F(ProtoValueConversionsTest, AttachmentIdProtoToValue) { |
| 420 TestSpecificsToValue(AttachmentIdProtoToValue); | 419 TestSpecificsToValue(AttachmentIdProtoToValue); |
| 421 } | 420 } |
| 422 | 421 |
| 423 } // namespace | 422 } // namespace |
| 424 } // namespace syncer | 423 } // namespace syncer |
| OLD | NEW |