| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/test/gtest_util.h" | 5 #include "base/test/gtest_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 JSONFileValueSerializer serializer(path); | 58 JSONFileValueSerializer serializer(path); |
| 59 return serializer.Serialize(root); | 59 return serializer.Serialize(root); |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool ReadTestNamesFromFile(const FilePath& path, | 62 bool ReadTestNamesFromFile(const FilePath& path, |
| 63 std::vector<TestIdentifier>* output) { | 63 std::vector<TestIdentifier>* output) { |
| 64 JSONFileValueDeserializer deserializer(path); | 64 JSONFileValueDeserializer deserializer(path); |
| 65 int error_code = 0; | 65 int error_code = 0; |
| 66 std::string error_message; | 66 std::string error_message; |
| 67 scoped_ptr<base::Value> value = | 67 std::unique_ptr<base::Value> value = |
| 68 deserializer.Deserialize(&error_code, &error_message); | 68 deserializer.Deserialize(&error_code, &error_message); |
| 69 if (!value.get()) | 69 if (!value.get()) |
| 70 return false; | 70 return false; |
| 71 | 71 |
| 72 base::ListValue* tests = nullptr; | 72 base::ListValue* tests = nullptr; |
| 73 if (!value->GetAsList(&tests)) | 73 if (!value->GetAsList(&tests)) |
| 74 return false; | 74 return false; |
| 75 | 75 |
| 76 std::vector<base::TestIdentifier> result; | 76 std::vector<base::TestIdentifier> result; |
| 77 for (base::ListValue::iterator i = tests->begin(); i != tests->end(); ++i) { | 77 for (base::ListValue::iterator i = tests->begin(); i != tests->end(); ++i) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 94 return false; | 94 return false; |
| 95 | 95 |
| 96 result.push_back(test_data); | 96 result.push_back(test_data); |
| 97 } | 97 } |
| 98 | 98 |
| 99 output->swap(result); | 99 output->swap(result); |
| 100 return true; | 100 return true; |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace base | 103 } // namespace base |
| OLD | NEW |