OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_TEST_BROWSER_BROWSER_TEST_RUNNER_ | 5 #ifndef CHROME_TEST_TEST_LAUNCHER_TEST_RUNNER_ |
6 #define CHROME_TEST_BROWSER_BROWSER_TEST_RUNNER_ | 6 #define CHROME_TEST_TEST_LAUNCHER_TEST_RUNNER_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 | 12 |
13 namespace browser_tests { | 13 namespace tests { |
14 | 14 |
15 class BrowserTestRunnerFactory; | 15 class TestRunnerFactory; |
16 | 16 |
17 // Runs the tests specified by the --gtest_filter flag specified in the command | 17 // Runs the tests specified by the --gtest_filter flag specified in the command |
18 // line that started this process. | 18 // line that started this process. |
19 // Returns true if all tests succeeded, false if there were no tests to run, or | 19 // Returns true if all tests succeeded, false if there were no tests to run, or |
20 // one or more tests failed, or if initialization failed. | 20 // one or more tests failed, or if initialization failed. |
21 // Results are printed to stdout. | 21 // Results are printed to stdout. |
22 bool RunTests(const BrowserTestRunnerFactory& browser_test_runner_factory); | 22 bool RunTests(const TestRunnerFactory& test_runner_factory); |
23 | 23 |
24 // This class defines a way to run browser tests. | 24 // This class defines a way to run tests in an isolated environment (each test |
| 25 // having its static variables uninitialized). |
25 // There are 2 implementations, in-process and out-of-process. | 26 // There are 2 implementations, in-process and out-of-process. |
26 class BrowserTestRunner { | 27 class TestRunner { |
27 public: | 28 public: |
28 BrowserTestRunner(); | 29 TestRunner(); |
29 virtual ~BrowserTestRunner(); | 30 virtual ~TestRunner(); |
30 | 31 |
31 // Called once before the BrowserTestRunner is used. Gives it an opportunity | 32 // Called once before the TestRunner is used. Gives it an opportunity to |
32 // to perform any requried initialization. Should return true if the | 33 // perform any requried initialization. Should return true if the |
33 // initialization was successful. | 34 // initialization was successful. |
34 virtual bool Init() = 0; | 35 virtual bool Init() = 0; |
35 | 36 |
36 // Runs the test named |test_name| and returns true if the test succeeded, | 37 // Runs the test named |test_name| and returns true if the test succeeded, |
37 // false if it failed. | 38 // false if it failed. |
38 virtual bool RunTest(const std::string& test_name) = 0; | 39 virtual bool RunTest(const std::string& test_name) = 0; |
39 | 40 |
40 private: | 41 private: |
41 DISALLOW_COPY_AND_ASSIGN(BrowserTestRunner); | 42 DISALLOW_COPY_AND_ASSIGN(TestRunner); |
42 }; | 43 }; |
43 | 44 |
44 class BrowserTestRunnerFactory { | 45 class TestRunnerFactory { |
45 public: | 46 public: |
46 virtual BrowserTestRunner* CreateBrowserTestRunner() const = 0; | 47 virtual TestRunner* CreateTestRunner() const = 0; |
47 }; | 48 }; |
48 | 49 |
49 } // namespace | 50 } // namespace |
50 | 51 |
51 #endif // CHROME_TEST_BROWSER_BROWSER_TEST_RUNNER_ | 52 #endif // CHROME_TEST_TEST_LAUNCHER_TEST_RUNNER_ |
OLD | NEW |