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/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // | 73 // |
74 // TearDownInProcessBrowserTestFixture() is called after BrowserMain() exits to | 74 // TearDownInProcessBrowserTestFixture() is called after BrowserMain() exits to |
75 // cleanup things setup for running the browser. | 75 // cleanup things setup for running the browser. |
76 // | 76 // |
77 // By default InProcessBrowserTest creates a single Browser (as returned from | 77 // By default InProcessBrowserTest creates a single Browser (as returned from |
78 // the CreateBrowser method). You can obviously create more as needed. | 78 // the CreateBrowser method). You can obviously create more as needed. |
79 | 79 |
80 // InProcessBrowserTest disables the sandbox when running. | 80 // InProcessBrowserTest disables the sandbox when running. |
81 // | 81 // |
82 // See ui_test_utils for a handful of methods designed for use with this class. | 82 // See ui_test_utils for a handful of methods designed for use with this class. |
| 83 // |
| 84 // It's possible to write browser tests that span a restart by splitting each |
| 85 // run of the browser process into a separate test. Example: |
| 86 // |
| 87 // IN_PROC_BROWSER_TEST_F(Foo, PRE_Bar) { |
| 88 // do something |
| 89 // } |
| 90 // |
| 91 // IN_PROC_BROWSER_TEST_F(Foo, Bar) { |
| 92 // verify something persisted from before |
| 93 // } |
| 94 // |
| 95 // This is recursive, so PRE_PRE_Bar would run before PRE_BAR. |
83 class InProcessBrowserTest : public BrowserTestBase { | 96 class InProcessBrowserTest : public BrowserTestBase { |
84 public: | 97 public: |
85 InProcessBrowserTest(); | 98 InProcessBrowserTest(); |
86 virtual ~InProcessBrowserTest(); | 99 virtual ~InProcessBrowserTest(); |
87 | 100 |
88 // Configures everything for an in process browser test, then invokes | 101 // Configures everything for an in process browser test, then invokes |
89 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. | 102 // BrowserMain. BrowserMain ends up invoking RunTestOnMainThreadLoop. |
90 virtual void SetUp() OVERRIDE; | 103 virtual void SetUp() OVERRIDE; |
91 | 104 |
92 // Restores state configured in SetUp. | 105 // Restores state configured in SetUp. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 #if defined(OS_CHROMEOS) | 220 #if defined(OS_CHROMEOS) |
208 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 221 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
209 #endif // defined(OS_CHROMEOS) | 222 #endif // defined(OS_CHROMEOS) |
210 | 223 |
211 #if defined(OS_MACOSX) | 224 #if defined(OS_MACOSX) |
212 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; | 225 base::mac::ScopedNSAutoreleasePool* autorelease_pool_; |
213 #endif // OS_MACOSX | 226 #endif // OS_MACOSX |
214 }; | 227 }; |
215 | 228 |
216 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ | 229 #endif // CHROME_TEST_BASE_IN_PROCESS_BROWSER_TEST_H_ |
OLD | NEW |