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 "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 JSONFileValueSerializer serializer(path); | 54 JSONFileValueSerializer serializer(path); |
55 return serializer.Serialize(root); | 55 return serializer.Serialize(root); |
56 } | 56 } |
57 | 57 |
58 bool ReadTestNamesFromFile(const FilePath& path, | 58 bool ReadTestNamesFromFile(const FilePath& path, |
59 std::vector<TestIdentifier>* output) { | 59 std::vector<TestIdentifier>* output) { |
60 JSONFileValueDeserializer deserializer(path); | 60 JSONFileValueDeserializer deserializer(path); |
61 int error_code = 0; | 61 int error_code = 0; |
62 std::string error_message; | 62 std::string error_message; |
63 scoped_ptr<base::Value> value( | 63 scoped_ptr<base::Value> value = |
64 deserializer.Deserialize(&error_code, &error_message)); | 64 deserializer.Deserialize(&error_code, &error_message); |
65 if (!value.get()) | 65 if (!value.get()) |
66 return false; | 66 return false; |
67 | 67 |
68 base::ListValue* tests = nullptr; | 68 base::ListValue* tests = nullptr; |
69 if (!value->GetAsList(&tests)) | 69 if (!value->GetAsList(&tests)) |
70 return false; | 70 return false; |
71 | 71 |
72 std::vector<base::TestIdentifier> result; | 72 std::vector<base::TestIdentifier> result; |
73 for (base::ListValue::iterator i = tests->begin(); i != tests->end(); ++i) { | 73 for (base::ListValue::iterator i = tests->begin(); i != tests->end(); ++i) { |
74 base::DictionaryValue* test = nullptr; | 74 base::DictionaryValue* test = nullptr; |
(...skipping 15 matching lines...) Expand all Loading... |
90 return false; | 90 return false; |
91 | 91 |
92 result.push_back(test_data); | 92 result.push_back(test_data); |
93 } | 93 } |
94 | 94 |
95 output->swap(result); | 95 output->swap(result); |
96 return true; | 96 return true; |
97 } | 97 } |
98 | 98 |
99 } // namespace base | 99 } // namespace base |
OLD | NEW |