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_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "content/public/browser/render_view_host.h" | 10 #include "content/public/browser/render_view_host.h" |
11 #include "content/public/common/page_transition_types.h" | 11 #include "content/public/common/page_transition_types.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 #if defined(USE_AURA) | 15 #if defined(USE_AURA) |
15 #include "ui/aura/test/aura_test_helper.h" | 16 #include "ui/aura/test/aura_test_helper.h" |
16 #endif | 17 #endif |
17 | 18 |
18 namespace aura { | 19 namespace aura { |
19 namespace test { | 20 namespace test { |
20 class AuraTestHelper; | 21 class AuraTestHelper; |
21 } | 22 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 // Simulates a reload of the current page. | 150 // Simulates a reload of the current page. |
150 void Reload(); | 151 void Reload(); |
151 void FailedReload(); | 152 void FailedReload(); |
152 | 153 |
153 protected: | 154 protected: |
154 // testing::Test | 155 // testing::Test |
155 virtual void SetUp() OVERRIDE; | 156 virtual void SetUp() OVERRIDE; |
156 virtual void TearDown() OVERRIDE; | 157 virtual void TearDown() OVERRIDE; |
157 | 158 |
| 159 // Configures which TestBrowserThreads inside |thread_bundle| are backed by |
| 160 // real threads. Must be called before SetUp(). |
| 161 void SetRealThreadMask(int real_threads_mask) { |
| 162 DCHECK(thread_bundle_.get() == NULL); |
| 163 real_threads_mask_ = real_threads_mask; |
| 164 } |
| 165 |
| 166 TestBrowserThreadBundle* thread_bundle() { return thread_bundle_.get(); } |
| 167 |
158 #if defined(USE_AURA) | 168 #if defined(USE_AURA) |
159 aura::RootWindow* root_window() { return aura_test_helper_->root_window(); } | 169 aura::RootWindow* root_window() { return aura_test_helper_->root_window(); } |
160 #endif | 170 #endif |
161 | 171 |
162 // Replaces the RPH being used. | 172 // Replaces the RPH being used. |
163 void SetRenderProcessHostFactory(RenderProcessHostFactory* factory); | 173 void SetRenderProcessHostFactory(RenderProcessHostFactory* factory); |
164 | 174 |
165 // This browser context will be created in SetUp if it has not already been | 175 // This browser context will be created in SetUp if it has not already been |
166 // created. This allows tests to override the browser context if they so | 176 // created. This allows tests to override the browser context if they so |
167 // choose in their own SetUp function before calling the base class's (us) | 177 // choose in their own SetUp function before calling the base class's (us) |
168 // SetUp(). | 178 // SetUp(). |
169 scoped_ptr<BrowserContext> browser_context_; | 179 scoped_ptr<BrowserContext> browser_context_; |
170 | 180 |
171 base::MessageLoopForUI message_loop_; | |
172 | |
173 private: | 181 private: |
174 // It is important not to use this directly in the implementation as | 182 // It is important not to use this directly in the implementation as |
175 // web_contents() and SetContents() are virtual and may be | 183 // web_contents() and SetContents() are virtual and may be |
176 // overridden by subclasses. | 184 // overridden by subclasses. |
177 scoped_ptr<WebContents> contents_; | 185 scoped_ptr<WebContents> contents_; |
178 #if defined(OS_WIN) | 186 #if defined(OS_WIN) |
179 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; | 187 scoped_ptr<ui::ScopedOleInitializer> ole_initializer_; |
180 #endif | 188 #endif |
181 #if defined(USE_AURA) | 189 #if defined(USE_AURA) |
182 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; | 190 scoped_ptr<aura::test::AuraTestHelper> aura_test_helper_; |
183 #endif | 191 #endif |
184 RenderViewHostTestEnabler rvh_test_enabler_; | 192 RenderViewHostTestEnabler rvh_test_enabler_; |
185 | 193 |
| 194 int real_threads_mask_; |
| 195 scoped_ptr<TestBrowserThreadBundle> thread_bundle_; |
| 196 |
186 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); | 197 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTestHarness); |
187 }; | 198 }; |
188 | 199 |
189 } // namespace content | 200 } // namespace content |
190 | 201 |
191 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ | 202 #endif // CONTENT_PUBLIC_TEST_TEST_RENDERER_HOST_H_ |
OLD | NEW |