| 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 "content/test/test_web_contents.h" | 5 #include "content/test/test_web_contents.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "content/browser/browser_url_handler_impl.h" | 9 #include "content/browser/browser_url_handler_impl.h" |
| 10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 RenderViewHostDelegateView* TestWebContents::GetDelegateView() { | 163 RenderViewHostDelegateView* TestWebContents::GetDelegateView() { |
| 164 if (delegate_view_override_) | 164 if (delegate_view_override_) |
| 165 return delegate_view_override_; | 165 return delegate_view_override_; |
| 166 return WebContentsImpl::GetDelegateView(); | 166 return WebContentsImpl::GetDelegateView(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void TestWebContents::SetOpener(TestWebContents* opener) { | 169 void TestWebContents::SetOpener(TestWebContents* opener) { |
| 170 // This is normally only set in the WebContents constructor, which also | 170 // This is normally only set in the WebContents constructor, which also |
| 171 // registers an observer for when the opener gets closed. | 171 // registers an observer for when the opener gets closed. |
| 172 opener_ = opener; | 172 opener_ = opener; |
| 173 registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, | 173 AddDestructionObserver(opener_); |
| 174 Source<WebContents>(opener_)); | |
| 175 } | 174 } |
| 176 | 175 |
| 177 void TestWebContents::AddPendingContents(TestWebContents* contents) { | 176 void TestWebContents::AddPendingContents(TestWebContents* contents) { |
| 178 // This is normally only done in WebContentsImpl::CreateNewWindow. | 177 // This is normally only done in WebContentsImpl::CreateNewWindow. |
| 179 pending_contents_[contents->GetRenderViewHost()->GetRoutingID()] = contents; | 178 pending_contents_[contents->GetRenderViewHost()->GetRoutingID()] = contents; |
| 180 registrar_.Add(this, NOTIFICATION_WEB_CONTENTS_DESTROYED, | 179 AddDestructionObserver(contents); |
| 181 Source<WebContents>(contents)); | |
| 182 } | 180 } |
| 183 | 181 |
| 184 void TestWebContents::ExpectSetHistoryLengthAndPrune( | 182 void TestWebContents::ExpectSetHistoryLengthAndPrune( |
| 185 const SiteInstance* site_instance, | 183 const SiteInstance* site_instance, |
| 186 int history_length, | 184 int history_length, |
| 187 int32 min_page_id) { | 185 int32 min_page_id) { |
| 188 expect_set_history_length_and_prune_ = true; | 186 expect_set_history_length_and_prune_ = true; |
| 189 expect_set_history_length_and_prune_site_instance_ = | 187 expect_set_history_length_and_prune_site_instance_ = |
| 190 static_cast<const SiteInstanceImpl*>(site_instance); | 188 static_cast<const SiteInstanceImpl*>(site_instance); |
| 191 expect_set_history_length_and_prune_history_length_ = history_length; | 189 expect_set_history_length_and_prune_history_length_ = history_length; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 239 } |
| 242 | 240 |
| 243 void TestWebContents::ShowCreatedWidget(int route_id, | 241 void TestWebContents::ShowCreatedWidget(int route_id, |
| 244 const gfx::Rect& initial_pos) { | 242 const gfx::Rect& initial_pos) { |
| 245 } | 243 } |
| 246 | 244 |
| 247 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 245 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
| 248 } | 246 } |
| 249 | 247 |
| 250 } // namespace content | 248 } // namespace content |
| OLD | NEW |