| 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/frame_host/cross_process_frame_connector.h" | 10 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "content/public/test/mock_render_process_host.h" | 23 #include "content/public/test/mock_render_process_host.h" |
| 24 #include "content/test/test_render_view_host.h" | 24 #include "content/test/test_render_view_host.h" |
| 25 #include "ui/base/page_transition_types.h" | 25 #include "ui/base/page_transition_types.h" |
| 26 | 26 |
| 27 namespace content { | 27 namespace content { |
| 28 | 28 |
| 29 TestWebContents::TestWebContents(BrowserContext* browser_context) | 29 TestWebContents::TestWebContents(BrowserContext* browser_context) |
| 30 : WebContentsImpl(browser_context), | 30 : WebContentsImpl(browser_context), |
| 31 delegate_view_override_(NULL), | 31 delegate_view_override_(NULL), |
| 32 expect_set_history_offset_and_length_(false), | 32 expect_set_history_offset_and_length_(false), |
| 33 expect_set_history_offset_and_length_history_length_(0) { | 33 expect_set_history_offset_and_length_history_length_(0), |
| 34 } | 34 simulate_used_data_reduction_proxy_(false) {} |
| 35 | 35 |
| 36 TestWebContents* TestWebContents::Create(BrowserContext* browser_context, | 36 TestWebContents* TestWebContents::Create(BrowserContext* browser_context, |
| 37 SiteInstance* instance) { | 37 SiteInstance* instance) { |
| 38 TestWebContents* test_web_contents = new TestWebContents(browser_context); | 38 TestWebContents* test_web_contents = new TestWebContents(browser_context); |
| 39 test_web_contents->Init(WebContents::CreateParams(browser_context, instance)); | 39 test_web_contents->Init(WebContents::CreateParams(browser_context, instance)); |
| 40 return test_web_contents; | 40 return test_web_contents; |
| 41 } | 41 } |
| 42 | 42 |
| 43 TestWebContents::~TestWebContents() { | 43 TestWebContents::~TestWebContents() { |
| 44 EXPECT_FALSE(expect_set_history_offset_and_length_); | 44 EXPECT_FALSE(expect_set_history_offset_and_length_); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 CHECK(!browser_side_navigation || rfh->is_loading()); | 245 CHECK(!browser_side_navigation || rfh->is_loading()); |
| 246 CHECK(!browser_side_navigation || | 246 CHECK(!browser_side_navigation || |
| 247 !rfh->frame_tree_node()->navigation_request()); | 247 !rfh->frame_tree_node()->navigation_request()); |
| 248 | 248 |
| 249 int page_id = entry->GetPageID(); | 249 int page_id = entry->GetPageID(); |
| 250 if (page_id == -1) { | 250 if (page_id == -1) { |
| 251 // It's a new navigation, assign a never-seen page id to it. | 251 // It's a new navigation, assign a never-seen page id to it. |
| 252 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; | 252 page_id = GetMaxPageIDForSiteInstance(rfh->GetSiteInstance()) + 1; |
| 253 } | 253 } |
| 254 | 254 |
| 255 rfh->set_simulate_used_data_reduction_proxy( |
| 256 simulate_used_data_reduction_proxy_); |
| 255 rfh->SendNavigate(page_id, entry->GetUniqueID(), | 257 rfh->SendNavigate(page_id, entry->GetUniqueID(), |
| 256 GetController().GetPendingEntryIndex() == -1, | 258 GetController().GetPendingEntryIndex() == -1, |
| 257 entry->GetURL()); | 259 entry->GetURL()); |
| 258 // Simulate the SwapOut_ACK. This is needed when cross-site navigation | 260 // Simulate the SwapOut_ACK. This is needed when cross-site navigation |
| 259 // happens. | 261 // happens. |
| 260 if (old_rfh != rfh) | 262 if (old_rfh != rfh) |
| 261 old_rfh->OnSwappedOut(); | 263 old_rfh->OnSwappedOut(); |
| 262 } | 264 } |
| 263 | 265 |
| 264 void TestWebContents::ProceedWithCrossSiteNavigation() { | 266 void TestWebContents::ProceedWithCrossSiteNavigation() { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 345 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
| 344 } | 346 } |
| 345 | 347 |
| 346 void TestWebContents::SaveFrameWithHeaders(const GURL& url, | 348 void TestWebContents::SaveFrameWithHeaders(const GURL& url, |
| 347 const Referrer& referrer, | 349 const Referrer& referrer, |
| 348 const std::string& headers) { | 350 const std::string& headers) { |
| 349 save_frame_headers_ = headers; | 351 save_frame_headers_ = headers; |
| 350 } | 352 } |
| 351 | 353 |
| 352 } // namespace content | 354 } // namespace content |
| OLD | NEW |