OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" | 10 #include "chrome/browser/supervised_user/legacy/supervised_user_shared_settings_
service.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 const std::string& message) { | 62 const std::string& message) { |
63 return syncer::SyncError(location, SyncError::DATATYPE_ERROR, message, type_); | 63 return syncer::SyncError(location, SyncError::DATATYPE_ERROR, message, type_); |
64 } | 64 } |
65 | 65 |
66 // Convenience method to allow us to use EXPECT_EQ to compare values. | 66 // Convenience method to allow us to use EXPECT_EQ to compare values. |
67 std::string ToJson(const Value* value) { | 67 std::string ToJson(const Value* value) { |
68 if (!value) | 68 if (!value) |
69 return std::string(); | 69 return std::string(); |
70 | 70 |
71 std::string json_value; | 71 std::string json_value; |
72 base::JSONWriter::Write(value, &json_value); | 72 base::JSONWriter::Write(*value, &json_value); |
73 return json_value; | 73 return json_value; |
74 } | 74 } |
75 | 75 |
76 } // namespace | 76 } // namespace |
77 | 77 |
78 class SupervisedUserSharedSettingsServiceTest : public ::testing::Test { | 78 class SupervisedUserSharedSettingsServiceTest : public ::testing::Test { |
79 protected: | 79 protected: |
80 typedef base::CallbackList<void(const std::string&, const std::string&)> | 80 typedef base::CallbackList<void(const std::string&, const std::string&)> |
81 CallbackList; | 81 CallbackList; |
82 | 82 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 settings_service_.GetAllSyncData(SUPERVISED_USER_SHARED_SETTINGS).size()); | 265 settings_service_.GetAllSyncData(SUPERVISED_USER_SHARED_SETTINGS).size()); |
266 EXPECT_EQ(ToJson(&name), | 266 EXPECT_EQ(ToJson(&name), |
267 ToJson(settings_service_.GetValue(kIdA, "name"))); | 267 ToJson(settings_service_.GetValue(kIdA, "name"))); |
268 EXPECT_EQ(ToJson(&age), ToJson(settings_service_.GetValue(kIdA, "age"))); | 268 EXPECT_EQ(ToJson(&age), ToJson(settings_service_.GetValue(kIdA, "age"))); |
269 EXPECT_EQ(ToJson(&bar), ToJson(settings_service_.GetValue(kIdB, "foo"))); | 269 EXPECT_EQ(ToJson(&bar), ToJson(settings_service_.GetValue(kIdB, "foo"))); |
270 EXPECT_EQ(ToJson(&blurp), ToJson(settings_service_.GetValue(kIdC, "baz"))); | 270 EXPECT_EQ(ToJson(&blurp), ToJson(settings_service_.GetValue(kIdC, "baz"))); |
271 EXPECT_FALSE(settings_service_.GetValue(kIdA, "foo")); | 271 EXPECT_FALSE(settings_service_.GetValue(kIdA, "foo")); |
272 EXPECT_FALSE(settings_service_.GetValue(kIdB, "name")); | 272 EXPECT_FALSE(settings_service_.GetValue(kIdB, "name")); |
273 EXPECT_FALSE(settings_service_.GetValue(kIdC, "name")); | 273 EXPECT_FALSE(settings_service_.GetValue(kIdC, "name")); |
274 } | 274 } |
OLD | NEW |