OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/protocol/proto_value_conversions.h" | 7 #include "chrome/browser/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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 std::string password_value; | 84 std::string password_value; |
85 EXPECT_TRUE(value->GetString("password_value", &password_value)); | 85 EXPECT_TRUE(value->GetString("password_value", &password_value)); |
86 EXPECT_EQ("<redacted>", password_value); | 86 EXPECT_EQ("<redacted>", password_value); |
87 } | 87 } |
88 | 88 |
89 TEST_F(ProtoValueConversionsTest, AppNotificationSpecificsToValue) { | 89 TEST_F(ProtoValueConversionsTest, AppNotificationSpecificsToValue) { |
90 TestSpecificsToValue(AppNotificationSpecificsToValue); | 90 TestSpecificsToValue(AppNotificationSpecificsToValue); |
91 } | 91 } |
92 | 92 |
93 TEST_F(ProtoValueConversionsTest, AppSettingSpecificsToValue) { | 93 TEST_F(ProtoValueConversionsTest, AppSettingSpecificsToValue) { |
94 TestSpecificsToValue(AppSettingSpecificsToValue); | 94 sync_pb::AppNotificationSettings specifics; |
| 95 specifics.set_disabled(true); |
| 96 specifics.set_oauth_client_id("some_id_value"); |
| 97 scoped_ptr<DictionaryValue> value(AppSettingsToValue(specifics)); |
| 98 EXPECT_FALSE(value->empty()); |
| 99 bool disabled_value = false; |
| 100 std::string oauth_client_id_value; |
| 101 EXPECT_TRUE(value->GetBoolean("disabled", &disabled_value)); |
| 102 EXPECT_EQ(true, disabled_value); |
| 103 EXPECT_TRUE(value->GetString("oauth_client_id", &oauth_client_id_value)); |
| 104 EXPECT_EQ("some_id_value", oauth_client_id_value); |
95 } | 105 } |
96 | 106 |
97 TEST_F(ProtoValueConversionsTest, AppSpecificsToValue) { | 107 TEST_F(ProtoValueConversionsTest, AppSpecificsToValue) { |
98 TestSpecificsToValue(AppSpecificsToValue); | 108 TestSpecificsToValue(AppSpecificsToValue); |
99 } | 109 } |
100 | 110 |
101 TEST_F(ProtoValueConversionsTest, AutofillSpecificsToValue) { | 111 TEST_F(ProtoValueConversionsTest, AutofillSpecificsToValue) { |
102 TestSpecificsToValue(AutofillSpecificsToValue); | 112 TestSpecificsToValue(AutofillSpecificsToValue); |
103 } | 113 } |
104 | 114 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 182 |
173 #undef SET_EXTENSION | 183 #undef SET_EXTENSION |
174 | 184 |
175 scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics)); | 185 scoped_ptr<DictionaryValue> value(EntitySpecificsToValue(specifics)); |
176 EXPECT_EQ(syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE, | 186 EXPECT_EQ(syncable::MODEL_TYPE_COUNT - syncable::FIRST_REAL_MODEL_TYPE, |
177 static_cast<int>(value->size())); | 187 static_cast<int>(value->size())); |
178 } | 188 } |
179 | 189 |
180 } // namespace | 190 } // namespace |
181 } // namespace browser_sync | 191 } // namespace browser_sync |
OLD | NEW |