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

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

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 months 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/system/statistics_provider.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/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/values.h" 12 #include "base/values.h"
13 #include "chromeos/chromeos_test_utils.h" 13 #include "chromeos/chromeos_test_utils.h"
14 #include "chromeos/network/network_ui_data.h" 14 #include "chromeos/network/network_ui_data.h"
15 #include "chromeos/network/onc/onc_signature.h" 15 #include "chromeos/network/onc/onc_signature.h"
16 #include "chromeos/network/onc/onc_test_utils.h" 16 #include "chromeos/network/onc/onc_test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace chromeos { 19 namespace chromeos {
20 20
21 namespace { 21 namespace {
22 22
23 scoped_ptr<base::Value> ReadTestJson(const std::string& filename) { 23 scoped_ptr<base::Value> ReadTestJson(const std::string& filename) {
24 base::Value* result = nullptr;
25 base::FilePath path; 24 base::FilePath path;
25 scoped_ptr<base::Value> result;
26 if (!test_utils::GetTestDataPath("network", filename, &path)) { 26 if (!test_utils::GetTestDataPath("network", filename, &path)) {
27 NOTREACHED() << "Unable to get test file path for: " << filename; 27 NOTREACHED() << "Unable to get test file path for: " << filename;
28 return make_scoped_ptr(result); 28 return result;
29 } 29 }
30 JSONFileValueDeserializer deserializer(path); 30 JSONFileValueDeserializer deserializer(path);
31 deserializer.set_allow_trailing_comma(true); 31 deserializer.set_allow_trailing_comma(true);
32 std::string error_message; 32 std::string error_message;
33 result = deserializer.Deserialize(nullptr, &error_message); 33 result = deserializer.Deserialize(nullptr, &error_message);
34 CHECK(result != nullptr) << "Couldn't json-deserialize file: " << filename 34 CHECK(result != nullptr) << "Couldn't json-deserialize file: " << filename
35 << ": " << error_message; 35 << ": " << error_message;
36 return make_scoped_ptr(result); 36 return result;
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
41 namespace onc { 41 namespace onc {
42 42
43 TEST(ONCDecrypterTest, BrokenEncryptionIterations) { 43 TEST(ONCDecrypterTest, BrokenEncryptionIterations) {
44 scoped_ptr<base::DictionaryValue> encrypted_onc = 44 scoped_ptr<base::DictionaryValue> encrypted_onc =
45 test_utils::ReadTestDictionary("broken-encrypted-iterations.onc"); 45 test_utils::ReadTestDictionary("broken-encrypted-iterations.onc");
46 46
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 scoped_ptr<base::DictionaryValue> actual_proxy_settings = 214 scoped_ptr<base::DictionaryValue> actual_proxy_settings =
215 ConvertProxyConfigToOncProxySettings(*shill_proxy_config); 215 ConvertProxyConfigToOncProxySettings(*shill_proxy_config);
216 EXPECT_TRUE( 216 EXPECT_TRUE(
217 test_utils::Equals(onc_proxy_settings, actual_proxy_settings.get())); 217 test_utils::Equals(onc_proxy_settings, actual_proxy_settings.get()));
218 } 218 }
219 } 219 }
220 220
221 } // namespace onc 221 } // namespace onc
222 } // namespace chromeos 222 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_test_utils.cc ('k') | chromeos/system/statistics_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698