| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 DCHECK(interstitial_page_ == interstitial); | 228 DCHECK(interstitial_page_ == interstitial); |
| 229 interstitial_page_ = NULL; | 229 interstitial_page_ = NULL; |
| 230 } | 230 } |
| 231 | 231 |
| 232 private: | 232 private: |
| 233 TestInterstitialPage* interstitial_page_; | 233 TestInterstitialPage* interstitial_page_; |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 class WebContentsImplTest : public RenderViewHostImplTestHarness { | 236 class WebContentsImplTest : public RenderViewHostImplTestHarness { |
| 237 public: | 237 public: |
| 238 WebContentsImplTest() | |
| 239 : ui_thread_(BrowserThread::UI, &message_loop_), | |
| 240 file_user_blocking_thread_( | |
| 241 BrowserThread::FILE_USER_BLOCKING, &message_loop_), | |
| 242 io_thread_(BrowserThread::IO, &message_loop_) { | |
| 243 } | |
| 244 | |
| 245 virtual void SetUp() { | 238 virtual void SetUp() { |
| 246 RenderViewHostImplTestHarness::SetUp(); | 239 RenderViewHostImplTestHarness::SetUp(); |
| 247 WebUIControllerFactory::RegisterFactory(&factory_); | 240 WebUIControllerFactory::RegisterFactory(&factory_); |
| 248 } | 241 } |
| 249 | 242 |
| 250 virtual void TearDown() { | 243 virtual void TearDown() { |
| 244 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); |
| 251 RenderViewHostImplTestHarness::TearDown(); | 245 RenderViewHostImplTestHarness::TearDown(); |
| 252 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); | |
| 253 } | 246 } |
| 254 | 247 |
| 255 private: | 248 private: |
| 256 WebContentsImplTestWebUIControllerFactory factory_; | 249 WebContentsImplTestWebUIControllerFactory factory_; |
| 257 TestBrowserThread ui_thread_; | |
| 258 TestBrowserThread file_user_blocking_thread_; | |
| 259 TestBrowserThread io_thread_; | |
| 260 }; | 250 }; |
| 261 | 251 |
| 262 class TestWebContentsObserver : public WebContentsObserver { | 252 class TestWebContentsObserver : public WebContentsObserver { |
| 263 public: | 253 public: |
| 264 TestWebContentsObserver(WebContents* contents) | 254 TestWebContentsObserver(WebContents* contents) |
| 265 : WebContentsObserver(contents) { | 255 : WebContentsObserver(contents) { |
| 266 } | 256 } |
| 267 virtual ~TestWebContentsObserver() {} | 257 virtual ~TestWebContentsObserver() {} |
| 268 | 258 |
| 269 virtual void DidFinishLoad(int64 frame_id, | 259 virtual void DidFinishLoad(int64 frame_id, |
| (...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); | 2100 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); |
| 2111 | 2101 |
| 2112 contents()->OnFrameDetached(16, 265); | 2102 contents()->OnFrameDetached(16, 265); |
| 2113 EXPECT_EQ(4UL, root->child_at(2)->child_count()); | 2103 EXPECT_EQ(4UL, root->child_at(2)->child_count()); |
| 2114 | 2104 |
| 2115 contents()->OnFrameDetached(5, 15); | 2105 contents()->OnFrameDetached(5, 15); |
| 2116 EXPECT_EQ(2UL, root->child_count()); | 2106 EXPECT_EQ(2UL, root->child_count()); |
| 2117 } | 2107 } |
| 2118 | 2108 |
| 2119 } // namespace content | 2109 } // namespace content |
| OLD | NEW |