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

Side by Side Diff: base/test/test_suite.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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/test/test_simple_task_runner.cc ('k') | base/test/test_suite.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 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.
4
5 #ifndef BASE_TEST_TEST_SUITE_H_
6 #define BASE_TEST_TEST_SUITE_H_
7
8 // Defines a basic test suite framework for running gtest based tests. You can
9 // instantiate this class in your main function and call its Run method to run
10 // any gtest based tests that are linked into your executable.
11
12 #include <string>
13
14 #include "base/at_exit.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/test/trace_to_file.h"
17
18 namespace testing {
19 class TestInfo;
20 }
21
22 namespace base {
23
24 // Instantiates TestSuite, runs it and returns exit code.
25 int RunUnitTestsUsingBaseTestSuite(int argc, char **argv);
26
27 class TestSuite {
28 public:
29 // Match function used by the GetTestCount method.
30 typedef bool (*TestMatch)(const testing::TestInfo&);
31
32 TestSuite(int argc, char** argv);
33 #if defined(OS_WIN)
34 TestSuite(int argc, wchar_t** argv);
35 #endif // defined(OS_WIN)
36 virtual ~TestSuite();
37
38 // Returns true if the test is marked as "MAYBE_".
39 // When using different prefixes depending on platform, we use MAYBE_ and
40 // preprocessor directives to replace MAYBE_ with the target prefix.
41 static bool IsMarkedMaybe(const testing::TestInfo& test);
42
43 void CatchMaybeTests();
44
45 void ResetCommandLine();
46
47 void AddTestLauncherResultPrinter();
48
49 int Run();
50
51 protected:
52 // This constructor is only accessible to specialized test suite
53 // implementations which need to control the creation of an AtExitManager
54 // instance for the duration of the test.
55 TestSuite(int argc, char** argv, bool create_at_exit_manager);
56
57 // By default fatal log messages (e.g. from DCHECKs) result in error dialogs
58 // which gum up buildbots. Use a minimalistic assert handler which just
59 // terminates the process.
60 static void UnitTestAssertHandler(const std::string& str);
61
62 // Disable crash dialogs so that it doesn't gum up the buildbot
63 virtual void SuppressErrorDialogs();
64
65 // Override these for custom initialization and shutdown handling. Use these
66 // instead of putting complex code in your constructor/destructor.
67
68 virtual void Initialize();
69 virtual void Shutdown();
70
71 // Make sure that we setup an AtExitManager so Singleton objects will be
72 // destroyed.
73 scoped_ptr<base::AtExitManager> at_exit_manager_;
74
75 private:
76 void InitializeFromCommandLine(int argc, char** argv);
77 #if defined(OS_WIN)
78 void InitializeFromCommandLine(int argc, wchar_t** argv);
79 #endif // defined(OS_WIN)
80
81 // Basic initialization for the test suite happens here.
82 void PreInitialize(bool create_at_exit_manager);
83
84 test::TraceToFile trace_to_file_;
85
86 bool initialized_command_line_;
87
88 DISALLOW_COPY_AND_ASSIGN(TestSuite);
89 };
90
91 } // namespace base
92
93 #endif // BASE_TEST_TEST_SUITE_H_
OLDNEW
« no previous file with comments | « base/test/test_simple_task_runner.cc ('k') | base/test/test_suite.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698