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 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "content/browser/renderer_host/frame_tree_node.h" | 7 #include "content/browser/renderer_host/frame_tree_node.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 DCHECK(interstitial_page_ == interstitial); | 229 DCHECK(interstitial_page_ == interstitial); |
230 interstitial_page_ = NULL; | 230 interstitial_page_ = NULL; |
231 } | 231 } |
232 | 232 |
233 private: | 233 private: |
234 TestInterstitialPage* interstitial_page_; | 234 TestInterstitialPage* interstitial_page_; |
235 }; | 235 }; |
236 | 236 |
237 class WebContentsImplTest : public RenderViewHostImplTestHarness { | 237 class WebContentsImplTest : public RenderViewHostImplTestHarness { |
238 public: | 238 public: |
239 WebContentsImplTest() | |
240 : ui_thread_(BrowserThread::UI, &message_loop_), | |
241 file_user_blocking_thread_( | |
242 BrowserThread::FILE_USER_BLOCKING, &message_loop_), | |
243 io_thread_(BrowserThread::IO, &message_loop_) { | |
244 } | |
245 | |
246 virtual void SetUp() { | 239 virtual void SetUp() { |
247 RenderViewHostImplTestHarness::SetUp(); | 240 RenderViewHostImplTestHarness::SetUp(); |
248 WebUIControllerFactory::RegisterFactory(&factory_); | 241 WebUIControllerFactory::RegisterFactory(&factory_); |
249 } | 242 } |
250 | 243 |
251 virtual void TearDown() { | 244 virtual void TearDown() { |
| 245 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); |
252 RenderViewHostImplTestHarness::TearDown(); | 246 RenderViewHostImplTestHarness::TearDown(); |
253 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); | |
254 } | 247 } |
255 | 248 |
256 private: | 249 private: |
257 WebContentsImplTestWebUIControllerFactory factory_; | 250 WebContentsImplTestWebUIControllerFactory factory_; |
258 TestBrowserThread ui_thread_; | |
259 TestBrowserThread file_user_blocking_thread_; | |
260 TestBrowserThread io_thread_; | |
261 }; | 251 }; |
262 | 252 |
263 class TestWebContentsObserver : public WebContentsObserver { | 253 class TestWebContentsObserver : public WebContentsObserver { |
264 public: | 254 public: |
265 TestWebContentsObserver(WebContents* contents) | 255 TestWebContentsObserver(WebContents* contents) |
266 : WebContentsObserver(contents) { | 256 : WebContentsObserver(contents) { |
267 } | 257 } |
268 virtual ~TestWebContentsObserver() {} | 258 virtual ~TestWebContentsObserver() {} |
269 | 259 |
270 virtual void DidFinishLoad(int64 frame_id, | 260 virtual void DidFinishLoad(int64 frame_id, |
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); | 2118 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); |
2129 | 2119 |
2130 contents()->OnFrameDetached(16, 265); | 2120 contents()->OnFrameDetached(16, 265); |
2131 EXPECT_EQ(4UL, root->child_at(2)->child_count()); | 2121 EXPECT_EQ(4UL, root->child_at(2)->child_count()); |
2132 | 2122 |
2133 contents()->OnFrameDetached(5, 15); | 2123 contents()->OnFrameDetached(5, 15); |
2134 EXPECT_EQ(2UL, root->child_count()); | 2124 EXPECT_EQ(2UL, root->child_count()); |
2135 } | 2125 } |
2136 | 2126 |
2137 } // namespace content | 2127 } // namespace content |
OLD | NEW |