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

Unified Diff: base/test/gtest_util.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: base/test/gtest_util.cc
diff --git a/base/test/gtest_util.cc b/base/test/gtest_util.cc
index 47fd6397fcc6d86d6eb3c39bc10ee013b0e835d3..f98320c52746e063f92d16ba178167b9faefeeaa 100644
--- a/base/test/gtest_util.cc
+++ b/base/test/gtest_util.cc
@@ -40,4 +40,39 @@ bool WriteCompiledInTestsToFile(const FilePath& path) {
return serializer.Serialize(root);
}
+bool ReadTestNamesFromFile(const FilePath& path,
+ std::vector<SplitTestName>* output) {
+ JSONFileValueSerializer deserializer(path);
+ int error_code = 0;
+ std::string error_message;
+ scoped_ptr<base::Value> value(
+ deserializer.Deserialize(&error_code, &error_message));
+ if (!value.get())
+ return false;
+
+ base::ListValue* tests = nullptr;
+ if (!value->GetAsList(&tests))
+ return false;
+
+ std::vector<base::SplitTestName> result;
+ for (base::ListValue::iterator i = tests->begin(); i != tests->end(); ++i) {
+ base::DictionaryValue* test = nullptr;
+ if (!(*i)->GetAsDictionary(&test))
+ return false;
+
+ std::string test_case_name;
+ if (!test->GetStringASCII("test_case_name", &test_case_name))
+ return false;
+
+ std::string test_name;
+ if (!test->GetStringASCII("test_name", &test_name))
+ return false;
+
+ result.push_back(std::make_pair(test_case_name, test_name));
+ }
+
+ output->swap(result);
+ return true;
+}
+
} // namespace
« no previous file with comments | « base/test/gtest_util.h ('k') | base/test/launcher/test_launcher.h » ('j') | shell/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698