| 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/browser/frame_host/navigation_controller_impl.h" | 5 #include "content/browser/frame_host/navigation_controller_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2041 RegisterForAllNavNotifications(¬ifications, &controller); | 2041 RegisterForAllNavNotifications(¬ifications, &controller); |
| 2042 | 2042 |
| 2043 const GURL url1("http://foo1"); | 2043 const GURL url1("http://foo1"); |
| 2044 main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); | 2044 main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); |
| 2045 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2045 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
| 2046 navigation_entry_committed_counter_ = 0; | 2046 navigation_entry_committed_counter_ = 0; |
| 2047 | 2047 |
| 2048 // Prereq: add a subframe with an initial auto-subframe navigation. | 2048 // Prereq: add a subframe with an initial auto-subframe navigation. |
| 2049 main_test_rfh()->OnCreateChildFrame( | 2049 main_test_rfh()->OnCreateChildFrame( |
| 2050 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, | 2050 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, |
| 2051 std::string(), blink::WebSandboxFlags::None, | 2051 std::string(), "uniqueName0", blink::WebSandboxFlags::None, |
| 2052 blink::WebFrameOwnerProperties()); | 2052 blink::WebFrameOwnerProperties()); |
| 2053 RenderFrameHostImpl* subframe = | 2053 RenderFrameHostImpl* subframe = |
| 2054 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); | 2054 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); |
| 2055 const GURL subframe_url("http://foo1/subframe"); | 2055 const GURL subframe_url("http://foo1/subframe"); |
| 2056 { | 2056 { |
| 2057 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2057 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 2058 params.page_id = 1; | 2058 params.page_id = 1; |
| 2059 params.nav_entry_id = 0; | 2059 params.nav_entry_id = 0; |
| 2060 params.did_create_new_entry = false; | 2060 params.did_create_new_entry = false; |
| 2061 params.url = subframe_url; | 2061 params.url = subframe_url; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2122 RegisterForAllNavNotifications(¬ifications, &controller); | 2122 RegisterForAllNavNotifications(¬ifications, &controller); |
| 2123 | 2123 |
| 2124 const GURL url1("http://foo/1"); | 2124 const GURL url1("http://foo/1"); |
| 2125 main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); | 2125 main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); |
| 2126 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2126 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
| 2127 navigation_entry_committed_counter_ = 0; | 2127 navigation_entry_committed_counter_ = 0; |
| 2128 | 2128 |
| 2129 // Add a subframe and navigate it. | 2129 // Add a subframe and navigate it. |
| 2130 main_test_rfh()->OnCreateChildFrame( | 2130 main_test_rfh()->OnCreateChildFrame( |
| 2131 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, | 2131 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, |
| 2132 std::string(), blink::WebSandboxFlags::None, | 2132 std::string(), "uniqueName0", blink::WebSandboxFlags::None, |
| 2133 blink::WebFrameOwnerProperties()); | 2133 blink::WebFrameOwnerProperties()); |
| 2134 RenderFrameHostImpl* subframe = | 2134 RenderFrameHostImpl* subframe = |
| 2135 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); | 2135 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); |
| 2136 const GURL url2("http://foo/2"); | 2136 const GURL url2("http://foo/2"); |
| 2137 { | 2137 { |
| 2138 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2138 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 2139 params.page_id = 1; | 2139 params.page_id = 1; |
| 2140 params.nav_entry_id = 0; | 2140 params.nav_entry_id = 0; |
| 2141 params.did_create_new_entry = false; | 2141 params.did_create_new_entry = false; |
| 2142 params.url = url2; | 2142 params.url = url2; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2168 entry->root_node()->children[0]->frame_entry.get(); | 2168 entry->root_node()->children[0]->frame_entry.get(); |
| 2169 EXPECT_EQ(url2, frame_entry->url()); | 2169 EXPECT_EQ(url2, frame_entry->url()); |
| 2170 } else { | 2170 } else { |
| 2171 // There are no subframe FrameNavigationEntries by default. | 2171 // There are no subframe FrameNavigationEntries by default. |
| 2172 EXPECT_EQ(0U, entry->root_node()->children.size()); | 2172 EXPECT_EQ(0U, entry->root_node()->children.size()); |
| 2173 } | 2173 } |
| 2174 | 2174 |
| 2175 // Add a second subframe and navigate. | 2175 // Add a second subframe and navigate. |
| 2176 main_test_rfh()->OnCreateChildFrame( | 2176 main_test_rfh()->OnCreateChildFrame( |
| 2177 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, | 2177 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, |
| 2178 std::string(), blink::WebSandboxFlags::None, | 2178 std::string(), "uniqueName1", blink::WebSandboxFlags::None, |
| 2179 blink::WebFrameOwnerProperties()); | 2179 blink::WebFrameOwnerProperties()); |
| 2180 RenderFrameHostImpl* subframe2 = | 2180 RenderFrameHostImpl* subframe2 = |
| 2181 contents()->GetFrameTree()->root()->child_at(1)->current_frame_host(); | 2181 contents()->GetFrameTree()->root()->child_at(1)->current_frame_host(); |
| 2182 const GURL url3("http://foo/3"); | 2182 const GURL url3("http://foo/3"); |
| 2183 { | 2183 { |
| 2184 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2184 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 2185 params.page_id = 1; | 2185 params.page_id = 1; |
| 2186 params.nav_entry_id = 0; | 2186 params.nav_entry_id = 0; |
| 2187 params.did_create_new_entry = false; | 2187 params.did_create_new_entry = false; |
| 2188 params.url = url3; | 2188 params.url = url3; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2214 entry->root_node()->children[1]->frame_entry.get(); | 2214 entry->root_node()->children[1]->frame_entry.get(); |
| 2215 EXPECT_EQ(url3, new_frame_entry->url()); | 2215 EXPECT_EQ(url3, new_frame_entry->url()); |
| 2216 } else { | 2216 } else { |
| 2217 // There are no subframe FrameNavigationEntries by default. | 2217 // There are no subframe FrameNavigationEntries by default. |
| 2218 EXPECT_EQ(0U, entry->root_node()->children.size()); | 2218 EXPECT_EQ(0U, entry->root_node()->children.size()); |
| 2219 } | 2219 } |
| 2220 | 2220 |
| 2221 // Add a nested subframe and navigate. | 2221 // Add a nested subframe and navigate. |
| 2222 subframe->OnCreateChildFrame(process()->GetNextRoutingID(), | 2222 subframe->OnCreateChildFrame(process()->GetNextRoutingID(), |
| 2223 blink::WebTreeScopeType::Document, std::string(), | 2223 blink::WebTreeScopeType::Document, std::string(), |
| 2224 blink::WebSandboxFlags::None, | 2224 "uniqueName2", blink::WebSandboxFlags::None, |
| 2225 blink::WebFrameOwnerProperties()); | 2225 blink::WebFrameOwnerProperties()); |
| 2226 RenderFrameHostImpl* subframe3 = contents() | 2226 RenderFrameHostImpl* subframe3 = contents() |
| 2227 ->GetFrameTree() | 2227 ->GetFrameTree() |
| 2228 ->root() | 2228 ->root() |
| 2229 ->child_at(0) | 2229 ->child_at(0) |
| 2230 ->child_at(0) | 2230 ->child_at(0) |
| 2231 ->current_frame_host(); | 2231 ->current_frame_host(); |
| 2232 const GURL url4("http://foo/4"); | 2232 const GURL url4("http://foo/4"); |
| 2233 { | 2233 { |
| 2234 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2234 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2279 // Main page. | 2279 // Main page. |
| 2280 const GURL url1("http://foo1"); | 2280 const GURL url1("http://foo1"); |
| 2281 main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); | 2281 main_test_rfh()->NavigateAndCommitRendererInitiated(1, true, url1); |
| 2282 EXPECT_EQ(1U, navigation_entry_committed_counter_); | 2282 EXPECT_EQ(1U, navigation_entry_committed_counter_); |
| 2283 NavigationEntry* entry1 = controller.GetLastCommittedEntry(); | 2283 NavigationEntry* entry1 = controller.GetLastCommittedEntry(); |
| 2284 navigation_entry_committed_counter_ = 0; | 2284 navigation_entry_committed_counter_ = 0; |
| 2285 | 2285 |
| 2286 // Prereq: add a subframe with an initial auto-subframe navigation. | 2286 // Prereq: add a subframe with an initial auto-subframe navigation. |
| 2287 main_test_rfh()->OnCreateChildFrame( | 2287 main_test_rfh()->OnCreateChildFrame( |
| 2288 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, | 2288 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, |
| 2289 std::string(), blink::WebSandboxFlags::None, | 2289 std::string(), "uniqueName0", blink::WebSandboxFlags::None, |
| 2290 blink::WebFrameOwnerProperties()); | 2290 blink::WebFrameOwnerProperties()); |
| 2291 RenderFrameHostImpl* subframe = | 2291 RenderFrameHostImpl* subframe = |
| 2292 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); | 2292 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); |
| 2293 const GURL subframe_url("http://foo1/subframe"); | 2293 const GURL subframe_url("http://foo1/subframe"); |
| 2294 { | 2294 { |
| 2295 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2295 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 2296 params.page_id = 1; | 2296 params.page_id = 1; |
| 2297 params.nav_entry_id = 0; | 2297 params.nav_entry_id = 0; |
| 2298 params.did_create_new_entry = false; | 2298 params.did_create_new_entry = false; |
| 2299 params.url = subframe_url; | 2299 params.url = subframe_url; |
| (...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3718 const GURL url("http://www.google.com/"); | 3718 const GURL url("http://www.google.com/"); |
| 3719 main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url); | 3719 main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url); |
| 3720 | 3720 |
| 3721 // We should be at the first navigation entry. | 3721 // We should be at the first navigation entry. |
| 3722 EXPECT_EQ(controller.GetEntryCount(), 1); | 3722 EXPECT_EQ(controller.GetEntryCount(), 1); |
| 3723 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); | 3723 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); |
| 3724 | 3724 |
| 3725 // Add and navigate a subframe that would normally count as in-page. | 3725 // Add and navigate a subframe that would normally count as in-page. |
| 3726 main_test_rfh()->OnCreateChildFrame( | 3726 main_test_rfh()->OnCreateChildFrame( |
| 3727 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, | 3727 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, |
| 3728 std::string(), blink::WebSandboxFlags::None, | 3728 std::string(), "uniqueName0", blink::WebSandboxFlags::None, |
| 3729 blink::WebFrameOwnerProperties()); | 3729 blink::WebFrameOwnerProperties()); |
| 3730 RenderFrameHostImpl* subframe = | 3730 RenderFrameHostImpl* subframe = |
| 3731 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); | 3731 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); |
| 3732 const GURL subframe_url("http://www.google.com/#"); | 3732 const GURL subframe_url("http://www.google.com/#"); |
| 3733 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 3733 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 3734 params.page_id = 0; | 3734 params.page_id = 0; |
| 3735 params.nav_entry_id = 0; | 3735 params.nav_entry_id = 0; |
| 3736 params.did_create_new_entry = false; | 3736 params.did_create_new_entry = false; |
| 3737 params.url = subframe_url; | 3737 params.url = subframe_url; |
| 3738 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 3738 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3885 | 3885 |
| 3886 // Now start a pending load to a totally different page, but don't commit it. | 3886 // Now start a pending load to a totally different page, but don't commit it. |
| 3887 const GURL url2("http://bar/"); | 3887 const GURL url2("http://bar/"); |
| 3888 controller.LoadURL( | 3888 controller.LoadURL( |
| 3889 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 3889 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 3890 | 3890 |
| 3891 // Send a subframe update from the first page, as if one had just | 3891 // Send a subframe update from the first page, as if one had just |
| 3892 // automatically loaded. Auto subframes don't increment the page ID. | 3892 // automatically loaded. Auto subframes don't increment the page ID. |
| 3893 main_test_rfh()->OnCreateChildFrame( | 3893 main_test_rfh()->OnCreateChildFrame( |
| 3894 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, | 3894 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, |
| 3895 std::string(), blink::WebSandboxFlags::None, | 3895 std::string(), "uniqueName0", blink::WebSandboxFlags::None, |
| 3896 blink::WebFrameOwnerProperties()); | 3896 blink::WebFrameOwnerProperties()); |
| 3897 RenderFrameHostImpl* subframe = | 3897 RenderFrameHostImpl* subframe = |
| 3898 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); | 3898 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); |
| 3899 const GURL url1_sub("http://foo/subframe"); | 3899 const GURL url1_sub("http://foo/subframe"); |
| 3900 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 3900 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 3901 params.page_id = controller.GetLastCommittedEntry()->GetPageID(); | 3901 params.page_id = controller.GetLastCommittedEntry()->GetPageID(); |
| 3902 params.nav_entry_id = 0; | 3902 params.nav_entry_id = 0; |
| 3903 params.did_create_new_entry = false; | 3903 params.did_create_new_entry = false; |
| 3904 params.url = url1_sub; | 3904 params.url = url1_sub; |
| 3905 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 3905 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
| (...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5123 EXPECT_EQ(default_ssl_status.connection_status, | 5123 EXPECT_EQ(default_ssl_status.connection_status, |
| 5124 details.ssl_status.connection_status); | 5124 details.ssl_status.connection_status); |
| 5125 EXPECT_EQ(default_ssl_status.content_status, | 5125 EXPECT_EQ(default_ssl_status.content_status, |
| 5126 details.ssl_status.content_status); | 5126 details.ssl_status.content_status); |
| 5127 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); | 5127 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); |
| 5128 | 5128 |
| 5129 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); | 5129 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); |
| 5130 } | 5130 } |
| 5131 | 5131 |
| 5132 } // namespace content | 5132 } // namespace content |
| OLD | NEW |