Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_render_frame_host.h" | 5 #include "content/test/test_render_frame_host.h" |
| 6 | 6 |
| 7 #include "content/browser/frame_host/frame_tree.h" | 7 #include "content/browser/frame_host/frame_tree.h" |
| 8 #include "content/common/frame_messages.h" | 8 #include "content/common/frame_messages.h" |
| 9 #include "content/test/test_render_view_host.h" | 9 #include "content/test/test_render_view_host.h" |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 void TestRenderFrameHost::SendNavigateWithTransition( | 40 void TestRenderFrameHost::SendNavigateWithTransition( |
| 41 int page_id, | 41 int page_id, |
| 42 const GURL& url, | 42 const GURL& url, |
| 43 PageTransition transition) { | 43 PageTransition transition) { |
| 44 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); | 44 SendNavigateWithTransitionAndResponseCode(page_id, url, transition, 200); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void TestRenderFrameHost::SendFailedNavigate(int page_id, const GURL& url) { | 47 void TestRenderFrameHost::SendFailedNavigate(int page_id, const GURL& url) { |
| 48 SendNavigateWithTransitionAndResponseCode( | 48 SendNavigateWithTransitionAndResponseCode( |
| 49 page_id, url, PAGE_TRANSITION_LINK, 500); | 49 page_id, url, PAGE_TRANSITION_RELOAD, 500); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void TestRenderFrameHost::SendNavigateWithTransitionAndResponseCode( | 52 void TestRenderFrameHost::SendNavigateWithTransitionAndResponseCode( |
| 53 int page_id, | 53 int page_id, |
| 54 const GURL& url, PageTransition transition, | 54 const GURL& url, PageTransition transition, |
| 55 int response_code) { | 55 int response_code) { |
| 56 // DidStartProvisionalLoad may delete the pending entry that holds |url|, | 56 // DidStartProvisionalLoad may delete the pending entry that holds |url|, |
| 57 // so we keep a copy of it to use in SendNavigateWithParameters. | 57 // so we keep a copy of it to use in SendNavigateWithParameters. |
| 58 GURL url_copy(url); | 58 GURL url_copy(url); |
| 59 OnDidStartProvisionalLoadForFrame(-1, url_copy); | 59 OnDidStartProvisionalLoadForFrame(-1, url_copy); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 params.referrer = Referrer(); | 106 params.referrer = Referrer(); |
| 107 params.transition = transition; | 107 params.transition = transition; |
| 108 params.redirects = redirects; | 108 params.redirects = redirects; |
| 109 params.should_update_history = true; | 109 params.should_update_history = true; |
| 110 params.searchable_form_url = GURL(); | 110 params.searchable_form_url = GURL(); |
| 111 params.searchable_form_encoding = std::string(); | 111 params.searchable_form_encoding = std::string(); |
| 112 params.security_info = std::string(); | 112 params.security_info = std::string(); |
| 113 params.gesture = NavigationGestureUser; | 113 params.gesture = NavigationGestureUser; |
| 114 params.contents_mime_type = contents_mime_type_; | 114 params.contents_mime_type = contents_mime_type_; |
| 115 params.is_post = false; | 115 params.is_post = false; |
| 116 params.was_within_same_page = false; | |
| 117 params.http_status_code = response_code; | 116 params.http_status_code = response_code; |
| 118 params.socket_address.set_host("2001:db8::1"); | 117 params.socket_address.set_host("2001:db8::1"); |
| 119 params.socket_address.set_port(80); | 118 params.socket_address.set_port(80); |
| 120 params.history_list_was_cleared = simulate_history_list_was_cleared_; | 119 params.history_list_was_cleared = simulate_history_list_was_cleared_; |
| 121 params.original_request_url = original_request_url; | 120 params.original_request_url = original_request_url; |
| 122 | 121 |
| 122 url::Replacements<char> replacements; | |
| 123 replacements.ClearRef(); | |
| 124 params.was_within_same_page = transition != PAGE_TRANSITION_RELOAD && | |
|
nasko
2014/05/29 22:59:30
Why have the transition type being checked? Wouldn
Nate Chapin
2014/05/29 23:03:46
A link transition can be based on this code.
On t
| |
| 125 transition != PAGE_TRANSITION_TYPED && | |
| 126 url.ReplaceComponents(replacements) == | |
| 127 GetLastCommittedURL().ReplaceComponents(replacements); | |
| 128 | |
| 123 params.page_state = PageState::CreateForTesting( | 129 params.page_state = PageState::CreateForTesting( |
| 124 url, | 130 url, |
| 125 false, | 131 false, |
| 126 file_path_for_history_item ? "data" : NULL, | 132 file_path_for_history_item ? "data" : NULL, |
| 127 file_path_for_history_item); | 133 file_path_for_history_item); |
| 128 | 134 |
| 129 FrameHostMsg_DidCommitProvisionalLoad msg(1, params); | 135 FrameHostMsg_DidCommitProvisionalLoad msg(1, params); |
| 130 OnNavigate(msg); | 136 OnNavigate(msg); |
| 131 } | 137 } |
| 132 | 138 |
| 133 } // namespace content | 139 } // namespace content |
| OLD | NEW |