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

Side by Side Diff: base/test/gtest_util.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 Created 4 years, 8 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 | « base/task_scheduler/task_tracker_unittest.cc ('k') | base/test/histogram_tester.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 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
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
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
OLDNEW
« no previous file with comments | « base/task_scheduler/task_tracker_unittest.cc ('k') | base/test/histogram_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698