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 CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 6 #define CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/common/page_transition_types.h" | 12 #include "content/public/common/page_transition_types.h" |
13 #include "content/public/test/browser_test.h" | 13 #include "content/public/test/browser_test.h" |
14 #include "content/public/test/browser_test_base.h" | 14 #include "content/public/test/browser_test_base.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 #if defined(OS_CHROMEOS) | 17 #if defined(OS_CHROMEOS) |
18 #include "chrome/browser/chromeos/cros/cros_library.h" | 18 #include "chrome/browser/chromeos/cros/cros_library.h" |
19 #endif // defined(OS_CHROMEOS) | 19 #endif // defined(OS_CHROMEOS) |
20 | 20 |
21 namespace base { | |
21 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) |
22 namespace base { | |
23 namespace mac { | 23 namespace mac { |
24 class ScopedNSAutoreleasePool; | 24 class ScopedNSAutoreleasePool; |
25 } // namespace mac | 25 } // namespace mac |
26 #endif // defined(OS_MACOSX) | |
27 | |
28 #if defined(OS_WIN) && defined(USE_AURA) | |
29 namespace win { | |
30 class ScopedCOMInitializer; | |
31 } | |
32 #endif // defined(OS_WIN) && defined(USE_AURA) | |
26 } // namespace base | 33 } // namespace base |
27 #endif // OS_MACOSX | |
28 | 34 |
29 class Browser; | 35 class Browser; |
30 class CommandLine; | 36 class CommandLine; |
31 class Profile; | 37 class Profile; |
32 | 38 |
33 namespace content { | 39 namespace content { |
34 class ContentRendererClient; | 40 class ContentRendererClient; |
35 } | 41 } |
36 | 42 |
37 namespace net { | 43 namespace net { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 // IN_PROC_BROWSER_TEST_F(Foo, Bar) { | 95 // IN_PROC_BROWSER_TEST_F(Foo, Bar) { |
90 // verify something persisted from before | 96 // verify something persisted from before |
91 // } | 97 // } |
92 // | 98 // |
93 // This is recursive, so PRE_PRE_Bar would run before PRE_BAR. | 99 // This is recursive, so PRE_PRE_Bar would run before PRE_BAR. |
94 class InProcessBrowserTest : public content::BrowserTestBase { | 100 class InProcessBrowserTest : public content::BrowserTestBase { |
95 public: | 101 public: |
96 InProcessBrowserTest(); | 102 InProcessBrowserTest(); |
97 virtual ~InProcessBrowserTest(); | 103 virtual ~InProcessBrowserTest(); |
98 | 104 |
105 // Sets up the stuff shared by all browser tests in this test case. | |
106 static void SetUpTestCase(); | |
107 | |
108 // Restores state configured in SetUpTestCase after all browser tests in this | |
109 // test case have ran. | |
grt (UTC plus 2)
2013/06/20 23:10:06
nit: ran -> run
gab
2013/06/20 23:47:21
Arg, I keep making this grammatical mistake!
| |
110 static void TearDownTestCase(); | |
111 | |
99 // Configures everything for an in process browser test, then invokes | 112 // Configures everything for an in process browser test, then invokes |
100 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. | 113 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. |
101 virtual void SetUp() OVERRIDE; | 114 virtual void SetUp() OVERRIDE; |
102 | 115 |
103 // Restores state configured in SetUp. | 116 // Restores state configured in SetUp. |
104 virtual void TearDown() OVERRIDE; | 117 virtual void TearDown() OVERRIDE; |
105 | 118 |
106 protected: | 119 protected: |
107 // Returns the browser created by CreateBrowser. | 120 // Returns the browser created by CreateBrowser. |
108 Browser* browser() const { return browser_; } | 121 Browser* browser() const { return browser_; } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 // True if we should exit the tests after the last browser instance closes. | 215 // True if we should exit the tests after the last browser instance closes. |
203 bool exit_when_last_browser_closes_; | 216 bool exit_when_last_browser_closes_; |
204 | 217 |
205 #if defined(OS_CHROMEOS) | 218 #if defined(OS_CHROMEOS) |
206 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 219 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
207 #endif // defined(OS_CHROMEOS) | 220 #endif // defined(OS_CHROMEOS) |
208 | 221 |
209 #if defined(OS_MACOSX) | 222 #if defined(OS_MACOSX) |
210 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; | 223 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; |
211 #endif // OS_MACOSX | 224 #endif // OS_MACOSX |
225 | |
226 #if defined(OS_WIN) && defined(USE_AURA) | |
227 static base::win::ScopedCOMInitializer* com_initializer_; | |
228 #endif | |
212 }; | 229 }; |
213 | 230 |
214 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 231 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
OLD | NEW |