| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <map> | 6 #include <map> |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 typedef std::map<std::string, PolicyTestCase*> PolicyTestCaseMap; | 190 typedef std::map<std::string, PolicyTestCase*> PolicyTestCaseMap; |
| 191 typedef PolicyTestCaseMap::const_iterator iterator; | 191 typedef PolicyTestCaseMap::const_iterator iterator; |
| 192 | 192 |
| 193 PolicyTestCases() { | 193 PolicyTestCases() { |
| 194 policy_test_cases_ = new std::map<std::string, PolicyTestCase*>(); | 194 policy_test_cases_ = new std::map<std::string, PolicyTestCase*>(); |
| 195 | 195 |
| 196 base::FilePath path = ui_test_utils::GetTestFilePath( | 196 base::FilePath path = ui_test_utils::GetTestFilePath( |
| 197 base::FilePath(FILE_PATH_LITERAL("policy")), | 197 base::FilePath(FILE_PATH_LITERAL("policy")), |
| 198 base::FilePath(FILE_PATH_LITERAL("policy_test_cases.json"))); | 198 base::FilePath(FILE_PATH_LITERAL("policy_test_cases.json"))); |
| 199 std::string json; | 199 std::string json; |
| 200 if (!file_util::ReadFileToString(path, &json)) { | 200 if (!base::ReadFileToString(path, &json)) { |
| 201 ADD_FAILURE(); | 201 ADD_FAILURE(); |
| 202 return; | 202 return; |
| 203 } | 203 } |
| 204 int error_code = -1; | 204 int error_code = -1; |
| 205 std::string error_string; | 205 std::string error_string; |
| 206 base::DictionaryValue* dict = NULL; | 206 base::DictionaryValue* dict = NULL; |
| 207 scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError( | 207 scoped_ptr<base::Value> value(base::JSONReader::ReadAndReturnError( |
| 208 json, base::JSON_PARSE_RFC, &error_code, &error_string)); | 208 json, base::JSON_PARSE_RFC, &error_code, &error_string)); |
| 209 if (!value.get() || !value->GetAsDictionary(&dict)) { | 209 if (!value.get() || !value->GetAsDictionary(&dict)) { |
| 210 ADD_FAILURE() << "Error parsing policy_test_cases.json: " << error_string; | 210 ADD_FAILURE() << "Error parsing policy_test_cases.json: " << error_string; |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 | 568 |
| 569 INSTANTIATE_TEST_CASE_P( | 569 INSTANTIATE_TEST_CASE_P( |
| 570 PolicyPrefsTestInstance, | 570 PolicyPrefsTestInstance, |
| 571 PolicyPrefsTest, | 571 PolicyPrefsTest, |
| 572 testing::ValuesIn(GetChromePolicyDefinitionList()->begin, | 572 testing::ValuesIn(GetChromePolicyDefinitionList()->begin, |
| 573 GetChromePolicyDefinitionList()->end)); | 573 GetChromePolicyDefinitionList()->end)); |
| 574 | 574 |
| 575 } // namespace policy | 575 } // namespace policy |
| OLD | NEW |