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

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

Issue 11578052: Replace OncNetworkParser by the new ONC translator. (Closed) Base URL: http://git.chromium.org/chromium/src.git@extend_onc_to_shill
Patch Set: Rebased. Created 7 years, 11 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.h ('k') | chromeos/network/onc/onc_validator.h » ('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_test_utils.h" 5 #include "chromeos/network/onc/onc_test_utils.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h"
8 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
9 #include "base/logging.h" 10 #include "base/logging.h"
10 #include "base/path_service.h" 11 #include "base/path_service.h"
11 #include "base/values.h" 12 #include "base/values.h"
12 #include "chromeos/chromeos_test_utils.h" 13 #include "chromeos/chromeos_test_utils.h"
13 14
14 namespace chromeos { 15 namespace chromeos {
15 namespace onc { 16 namespace onc {
16 namespace test_utils { 17 namespace test_utils {
17 18
18 namespace { 19 namespace {
19 20
20 // The name of the component directory to get the test data from. 21 // The name of the component directory to get the test data from.
21 const char kNetworkComponentDirectory[] = "network"; 22 const char kNetworkComponentDirectory[] = "network";
22 23
23 } // namespace 24 } // namespace
24 25
26 std::string ReadTestData(const std::string& filename) {
27 FilePath path;
28 if (!chromeos::test_utils::GetTestDataPath(kNetworkComponentDirectory,
29 filename,
30 &path)) {
31 NOTREACHED() << "Unable to get test data path for "
32 << kNetworkComponentDirectory << "/" << filename;
33 return "";
34 }
35 std::string result;
36 file_util::ReadFileToString(path, &result);
37 return result;
38 }
39
25 scoped_ptr<base::DictionaryValue> ReadTestDictionary( 40 scoped_ptr<base::DictionaryValue> ReadTestDictionary(
26 const std::string& filename) { 41 const std::string& filename) {
27 base::DictionaryValue* dict = NULL; 42 base::DictionaryValue* dict = NULL;
28 FilePath path; 43 FilePath path;
29 if (!chromeos::test_utils::GetTestDataPath(kNetworkComponentDirectory, 44 if (!chromeos::test_utils::GetTestDataPath(kNetworkComponentDirectory,
30 filename, 45 filename,
31 &path)) { 46 &path)) {
32 NOTREACHED() << "Unable to get test dictionary path for " 47 NOTREACHED() << "Unable to get test dictionary path for "
33 << kNetworkComponentDirectory << "/" << filename; 48 << kNetworkComponentDirectory << "/" << filename;
34 return make_scoped_ptr(dict); 49 return make_scoped_ptr(dict);
(...skipping 24 matching lines...) Expand all
59 return ::testing::AssertionSuccess() << "Dictionaries are equal"; 74 return ::testing::AssertionSuccess() << "Dictionaries are equal";
60 75
61 return ::testing::AssertionFailure() << "Dictionaries are unequal.\n" 76 return ::testing::AssertionFailure() << "Dictionaries are unequal.\n"
62 << "Expected dictionary:\n" << *expected 77 << "Expected dictionary:\n" << *expected
63 << "Actual dictionary:\n" << *actual; 78 << "Actual dictionary:\n" << *actual;
64 } 79 }
65 80
66 } // namespace test_utils 81 } // namespace test_utils
67 } // namespace onc 82 } // namespace onc
68 } // namespace chromeos 83 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_test_utils.h ('k') | chromeos/network/onc/onc_validator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698