Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chromeos/network/onc/onc_utils_unittest.cc

Issue 2475583002: Adds option for JSON reader to allow invalid utf characters (Closed)
Patch Set: comment Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/network/onc/onc_test_utils.cc ('k') | chromeos/tools/onc_validator/onc_validator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_test_utils.cc ('k') | chromeos/tools/onc_validator/onc_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698