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