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 #include "chromeos/network/onc/onc_utils.h" | 5 #include "chromeos/network/onc/onc_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
| 10 #include "base/json/json_reader.h" |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
13 #include "base/values.h" | 14 #include "base/values.h" |
14 #include "chromeos/chromeos_test_utils.h" | 15 #include "chromeos/chromeos_test_utils.h" |
15 #include "chromeos/network/network_ui_data.h" | 16 #include "chromeos/network/network_ui_data.h" |
16 #include "chromeos/network/onc/onc_signature.h" | 17 #include "chromeos/network/onc/onc_signature.h" |
17 #include "chromeos/network/onc/onc_test_utils.h" | 18 #include "chromeos/network/onc/onc_test_utils.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 namespace chromeos { | 21 namespace chromeos { |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 std::unique_ptr<base::Value> ReadTestJson(const std::string& filename) { | 25 std::unique_ptr<base::Value> ReadTestJson(const std::string& filename) { |
25 base::FilePath path; | 26 base::FilePath path; |
26 std::unique_ptr<base::Value> result; | 27 std::unique_ptr<base::Value> result; |
27 if (!test_utils::GetTestDataPath("network", filename, &path)) { | 28 if (!test_utils::GetTestDataPath("network", filename, &path)) { |
28 NOTREACHED() << "Unable to get test file path for: " << filename; | 29 NOTREACHED() << "Unable to get test file path for: " << filename; |
29 return result; | 30 return result; |
30 } | 31 } |
31 JSONFileValueDeserializer deserializer(path); | 32 JSONFileValueDeserializer deserializer(path, |
32 deserializer.set_allow_trailing_comma(true); | 33 base::JSON_ALLOW_TRAILING_COMMAS); |
33 std::string error_message; | 34 std::string error_message; |
34 result = deserializer.Deserialize(nullptr, &error_message); | 35 result = deserializer.Deserialize(nullptr, &error_message); |
35 CHECK(result != nullptr) << "Couldn't json-deserialize file: " << filename | 36 CHECK(result != nullptr) << "Couldn't json-deserialize file: " << filename |
36 << ": " << error_message; | 37 << ": " << error_message; |
37 return result; | 38 return result; |
38 } | 39 } |
39 | 40 |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 namespace onc { | 43 namespace onc { |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 215 |
215 std::unique_ptr<base::DictionaryValue> actual_proxy_settings = | 216 std::unique_ptr<base::DictionaryValue> actual_proxy_settings = |
216 ConvertProxyConfigToOncProxySettings(*shill_proxy_config); | 217 ConvertProxyConfigToOncProxySettings(*shill_proxy_config); |
217 EXPECT_TRUE( | 218 EXPECT_TRUE( |
218 test_utils::Equals(onc_proxy_settings, actual_proxy_settings.get())); | 219 test_utils::Equals(onc_proxy_settings, actual_proxy_settings.get())); |
219 } | 220 } |
220 } | 221 } |
221 | 222 |
222 } // namespace onc | 223 } // namespace onc |
223 } // namespace chromeos | 224 } // namespace chromeos |
OLD | NEW |