OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_TEST_BROWSER_TEST_H_ | 5 #ifndef CONTENT_TEST_BROWSER_TEST_H_ |
6 #define CONTENT_TEST_BROWSER_TEST_H_ | 6 #define CONTENT_TEST_BROWSER_TEST_H_ |
7 | 7 |
8 // We only want to use InProcessBrowserTest in test targets which properly | 8 // We only want to use InProcessBrowserTest in test targets which properly |
9 // isolate each test case by running each test in a separate process. | 9 // isolate each test case by running each test in a separate process. |
10 // This way if a test hangs the test launcher can reliably terminate it. | 10 // This way if a test hangs the test launcher can reliably terminate it. |
11 // | 11 // |
12 // InProcessBrowserTest cannot be run more than once in the same address space | 12 // InProcessBrowserTest cannot be run more than once in the same address space |
13 // anyway - otherwise the second test crashes. | 13 // anyway - otherwise the second test crashes. |
14 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER) | 14 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER) |
15 | 15 |
16 #if defined(BROWSER_TESTS_HEADER_OVERRIDE) | |
17 #include BROWSER_TESTS_HEADER_OVERRIDE | |
18 #else | |
19 #include "content/test/content_browser_test.h" | |
20 typedef ContentBrowserTest InProcessBrowserTest; | |
21 #endif | |
22 | |
23 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
24 | 17 |
25 #define IN_PROC_BROWSER_TEST_(test_case_name, test_name, parent_class,\ | 18 #define IN_PROC_BROWSER_TEST_(test_case_name, test_name, parent_class,\ |
26 parent_id)\ | 19 parent_id)\ |
27 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\ | 20 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\ |
28 public:\ | 21 public:\ |
29 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\ | 22 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\ |
30 protected:\ | 23 protected:\ |
31 virtual void RunTestOnMainThread() OVERRIDE;\ | 24 virtual void RunTestOnMainThread() OVERRIDE;\ |
32 private:\ | 25 private:\ |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \ | 68 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \ |
76 }; \ | 69 }; \ |
77 int GTEST_TEST_CLASS_NAME_(test_case_name, \ | 70 int GTEST_TEST_CLASS_NAME_(test_case_name, \ |
78 test_name)::gtest_registering_dummy_ = \ | 71 test_name)::gtest_registering_dummy_ = \ |
79 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \ | 72 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \ |
80 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() | 73 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread() |
81 | 74 |
82 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) | 75 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER) |
83 | 76 |
84 #endif // CONTENT_TEST_BROWSER_TEST_H_ | 77 #endif // CONTENT_TEST_BROWSER_TEST_H_ |
OLD | NEW |