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

Side by Side Diff: content/test/browser_test.h

Issue 8036044: Add (not yet working) content_browsertests target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « content/content_tests.gypi ('k') | content/test/browser_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_TEST_BROWSER_TEST_H_
6 #define CONTENT_TEST_BROWSER_TEST_H_
7 #pragma once
8
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.
11 // This way if a test hangs the test launcher can reliably terminate it.
12 //
13 // InProcessBrowserTest cannot be run more than once in the same address space
14 // anyway - otherwise the second test crashes.
15 #if defined(HAS_OUT_OF_PROC_TEST_RUNNER)
16
17 #if defined(BROWSER_TESTS_USE_CONTENT)
jam 2011/09/27 19:11:35 instead of having each test binary having to defin
Paweł Hajdan Jr. 2011/09/27 20:05:18 Do you mean something like: defines: [ 'BROWSER
18 #include "content/test/content_browser_test.h"
19 typedef ContentBrowserTest InProcessBrowserTest;
20 #elif defined(BROWSER_TESTS_USE_CHROME)
21 #include "chrome/test/base/in_process_browser_test.h"
22 #else
23 #error Please define BROWSER_TESTS_USE_CONTENT or BROWSER_TESTS_USE_CHROME
24 #endif
25
26 #define IN_PROC_BROWSER_TEST_(test_case_name, test_name, parent_class,\
27 parent_id)\
28 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\
29 public:\
30 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\
31 protected:\
32 virtual void RunTestOnMainThread();\
33 private:\
34 virtual void TestBody() {}\
35 static ::testing::TestInfo* const test_info_;\
36 GTEST_DISALLOW_COPY_AND_ASSIGN_(\
37 GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\
38 };\
39 \
40 ::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_case_name, test_name)\
41 ::test_info_ =\
42 ::testing::internal::MakeAndRegisterTestInfo(\
43 #test_case_name, #test_name, "", "", \
44 (parent_id), \
45 parent_class::SetUpTestCase, \
46 parent_class::TearDownTestCase, \
47 new ::testing::internal::TestFactoryImpl<\
48 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>);\
49 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread()
50
51 #define IN_PROC_BROWSER_TEST_F(test_fixture, test_name)\
52 IN_PROC_BROWSER_TEST_(test_fixture, test_name, test_fixture,\
53 ::testing::internal::GetTypeId<test_fixture>())
54
55 #define IN_PROC_BROWSER_TEST_P(test_case_name, test_name) \
56 class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
57 : public test_case_name { \
58 public: \
59 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {} \
60 protected: \
61 virtual void RunTestOnMainThread(); \
62 private: \
63 virtual void TestBody() {} \
64 static int AddToRegistry() { \
65 ::testing::UnitTest::GetInstance()->parameterized_test_registry(). \
66 GetTestCasePatternHolder<test_case_name>(\
67 #test_case_name, __FILE__, __LINE__)->AddTestPattern(\
68 #test_case_name, \
69 #test_name, \
70 new ::testing::internal::TestMetaFactory< \
71 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)>()); \
72 return 0; \
73 } \
74 static int gtest_registering_dummy_; \
75 GTEST_DISALLOW_COPY_AND_ASSIGN_(\
76 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)); \
77 }; \
78 int GTEST_TEST_CLASS_NAME_(test_case_name, \
79 test_name)::gtest_registering_dummy_ = \
80 GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
81 void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::RunTestOnMainThread()
82
83 #endif // defined(HAS_OUT_OF_PROC_TEST_RUNNER)
84
85 #endif // CONTENT_TEST_BROWSER_TEST_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/test/browser_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698