Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / base / test / gtest_util.h
blobc0e088f49ca09564692615256595b469f01d506f
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
3 // found in the LICENSE file.
5 #ifndef BASE_TEST_GTEST_UTIL_H_
6 #define BASE_TEST_GTEST_UTIL_H_
8 #include <string>
9 #include <utility>
10 #include <vector>
12 #include "base/compiler_specific.h"
14 namespace base {
16 class FilePath;
18 struct TestIdentifier {
19 TestIdentifier();
21 std::string test_case_name;
22 std::string test_name;
23 std::string file;
24 int line;
27 // Constructs a full test name given a test case name and a test name,
28 // e.g. for test case "A" and test name "B" returns "A.B".
29 std::string FormatFullTestName(const std::string& test_case_name,
30 const std::string& test_name);
32 // Returns a vector of gtest-based tests compiled into
33 // current executable.
34 std::vector<TestIdentifier> GetCompiledInTests();
36 // Writes the list of gtest-based tests compiled into
37 // current executable as a JSON file. Returns true on success.
38 bool WriteCompiledInTestsToFile(const FilePath& path) WARN_UNUSED_RESULT;
40 // Reads the list of gtest-based tests from |path| into |output|.
41 // Returns true on success.
42 bool ReadTestNamesFromFile(
43 const FilePath& path,
44 std::vector<TestIdentifier>* output) WARN_UNUSED_RESULT;
46 } // namespace base
48 #endif // BASE_TEST_GTEST_UTIL_H_