| 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 29 matching lines...) Expand all Loading... |
| 40 test_info->SetString("test_name", tests[i].second); | 40 test_info->SetString("test_name", tests[i].second); |
| 41 root.Append(test_info); | 41 root.Append(test_info); |
| 42 } | 42 } |
| 43 | 43 |
| 44 JSONFileValueSerializer serializer(path); | 44 JSONFileValueSerializer serializer(path); |
| 45 return serializer.Serialize(root); | 45 return serializer.Serialize(root); |
| 46 } | 46 } |
| 47 | 47 |
| 48 bool ReadTestNamesFromFile(const FilePath& path, | 48 bool ReadTestNamesFromFile(const FilePath& path, |
| 49 std::vector<SplitTestName>* output) { | 49 std::vector<SplitTestName>* output) { |
| 50 JSONFileValueSerializer deserializer(path); | 50 JSONFileValueDeserializer deserializer(path); |
| 51 int error_code = 0; | 51 int error_code = 0; |
| 52 std::string error_message; | 52 std::string error_message; |
| 53 scoped_ptr<base::Value> value( | 53 scoped_ptr<base::Value> value( |
| 54 deserializer.Deserialize(&error_code, &error_message)); | 54 deserializer.Deserialize(&error_code, &error_message)); |
| 55 if (!value.get()) | 55 if (!value.get()) |
| 56 return false; | 56 return false; |
| 57 | 57 |
| 58 base::ListValue* tests = nullptr; | 58 base::ListValue* tests = nullptr; |
| 59 if (!value->GetAsList(&tests)) | 59 if (!value->GetAsList(&tests)) |
| 60 return false; | 60 return false; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 73 if (!test->GetStringASCII("test_name", &test_name)) | 73 if (!test->GetStringASCII("test_name", &test_name)) |
| 74 return false; | 74 return false; |
| 75 | 75 |
| 76 result.push_back(std::make_pair(test_case_name, test_name)); | 76 result.push_back(std::make_pair(test_case_name, test_name)); |
| 77 } | 77 } |
| 78 | 78 |
| 79 output->swap(result); | 79 output->swap(result); |
| 80 return true; | 80 return true; |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace base |
| OLD | NEW |