| 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" |
| 11 #include "content/browser/frame_host/navigation_entry_impl.h" | 11 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 12 #include "content/browser/frame_host/navigator.h" | 12 #include "content/browser/frame_host/navigator.h" |
| 13 #include "content/browser/renderer_host/render_view_host_impl.h" | 13 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 14 #include "content/browser/site_instance_impl.h" | 14 #include "content/browser/site_instance_impl.h" |
| 15 #include "content/common/frame_messages.h" | 15 #include "content/common/frame_messages.h" |
| 16 #include "content/common/view_messages.h" | 16 #include "content/common/view_messages.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "content/public/browser/notification_source.h" | 18 #include "content/public/browser/notification_source.h" |
| 19 #include "content/public/browser/notification_types.h" | 19 #include "content/public/browser/notification_types.h" |
| 20 #include "content/public/common/page_state.h" | 20 #include "content/public/common/page_state.h" |
| 21 #include "content/public/common/page_transition_types.h" | |
| 22 #include "content/public/test/mock_render_process_host.h" | 21 #include "content/public/test/mock_render_process_host.h" |
| 23 #include "content/test/test_render_view_host.h" | 22 #include "content/test/test_render_view_host.h" |
| 23 #include "ui/base/page_transition_types.h" |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 | 26 |
| 27 TestWebContents::TestWebContents(BrowserContext* browser_context) | 27 TestWebContents::TestWebContents(BrowserContext* browser_context) |
| 28 : WebContentsImpl(browser_context, NULL), | 28 : WebContentsImpl(browser_context, NULL), |
| 29 delegate_view_override_(NULL), | 29 delegate_view_override_(NULL), |
| 30 expect_set_history_length_and_prune_(false), | 30 expect_set_history_length_and_prune_(false), |
| 31 expect_set_history_length_and_prune_site_instance_(NULL), | 31 expect_set_history_length_and_prune_site_instance_(NULL), |
| 32 expect_set_history_length_and_prune_history_length_(0), | 32 expect_set_history_length_and_prune_history_length_(0), |
| 33 expect_set_history_length_and_prune_min_page_id_(-1) { | 33 expect_set_history_length_and_prune_min_page_id_(-1) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 TestRenderFrameHost* TestWebContents::GetPendingMainFrame() const { | 56 TestRenderFrameHost* TestWebContents::GetPendingMainFrame() const { |
| 57 return static_cast<TestRenderFrameHost*>( | 57 return static_cast<TestRenderFrameHost*>( |
| 58 GetRenderManager()->pending_frame_host()); | 58 GetRenderManager()->pending_frame_host()); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host, | 61 void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host, |
| 62 int page_id, | 62 int page_id, |
| 63 const GURL& url, | 63 const GURL& url, |
| 64 PageTransition transition) { | 64 ui::PageTransition transition) { |
| 65 TestDidNavigateWithReferrer(render_frame_host, | 65 TestDidNavigateWithReferrer(render_frame_host, |
| 66 page_id, | 66 page_id, |
| 67 url, | 67 url, |
| 68 Referrer(), | 68 Referrer(), |
| 69 transition); | 69 transition); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void TestWebContents::TestDidNavigateWithReferrer( | 72 void TestWebContents::TestDidNavigateWithReferrer( |
| 73 RenderFrameHost* render_frame_host, | 73 RenderFrameHost* render_frame_host, |
| 74 int page_id, | 74 int page_id, |
| 75 const GURL& url, | 75 const GURL& url, |
| 76 const Referrer& referrer, | 76 const Referrer& referrer, |
| 77 PageTransition transition) { | 77 ui::PageTransition transition) { |
| 78 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 78 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 79 | 79 |
| 80 params.page_id = page_id; | 80 params.page_id = page_id; |
| 81 params.url = url; | 81 params.url = url; |
| 82 params.referrer = referrer; | 82 params.referrer = referrer; |
| 83 params.transition = transition; | 83 params.transition = transition; |
| 84 params.redirects = std::vector<GURL>(); | 84 params.redirects = std::vector<GURL>(); |
| 85 params.should_update_history = false; | 85 params.should_update_history = false; |
| 86 params.searchable_form_url = GURL(); | 86 params.searchable_form_url = GURL(); |
| 87 params.searchable_form_encoding = std::string(); | 87 params.searchable_form_encoding = std::string(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 117 | 117 |
| 118 WebContents* TestWebContents::Clone() { | 118 WebContents* TestWebContents::Clone() { |
| 119 WebContentsImpl* contents = | 119 WebContentsImpl* contents = |
| 120 Create(GetBrowserContext(), SiteInstance::Create(GetBrowserContext())); | 120 Create(GetBrowserContext(), SiteInstance::Create(GetBrowserContext())); |
| 121 contents->GetController().CopyStateFrom(controller_); | 121 contents->GetController().CopyStateFrom(controller_); |
| 122 return contents; | 122 return contents; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void TestWebContents::NavigateAndCommit(const GURL& url) { | 125 void TestWebContents::NavigateAndCommit(const GURL& url) { |
| 126 GetController().LoadURL( | 126 GetController().LoadURL( |
| 127 url, Referrer(), PAGE_TRANSITION_LINK, std::string()); | 127 url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 128 GURL loaded_url(url); | 128 GURL loaded_url(url); |
| 129 bool reverse_on_redirect = false; | 129 bool reverse_on_redirect = false; |
| 130 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( | 130 BrowserURLHandlerImpl::GetInstance()->RewriteURLIfNecessary( |
| 131 &loaded_url, GetBrowserContext(), &reverse_on_redirect); | 131 &loaded_url, GetBrowserContext(), &reverse_on_redirect); |
| 132 | 132 |
| 133 // LoadURL created a navigation entry, now simulate the RenderView sending | 133 // LoadURL created a navigation entry, now simulate the RenderView sending |
| 134 // a notification that it actually navigated. | 134 // a notification that it actually navigated. |
| 135 CommitPendingNavigation(); | 135 CommitPendingNavigation(); |
| 136 } | 136 } |
| 137 | 137 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 } | 250 } |
| 251 | 251 |
| 252 void TestWebContents::ShowCreatedWidget(int route_id, | 252 void TestWebContents::ShowCreatedWidget(int route_id, |
| 253 const gfx::Rect& initial_pos) { | 253 const gfx::Rect& initial_pos) { |
| 254 } | 254 } |
| 255 | 255 |
| 256 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { | 256 void TestWebContents::ShowCreatedFullscreenWidget(int route_id) { |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace content | 259 } // namespace content |
| OLD | NEW |