Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_unittest.cc

Issue 1635873003: Replicating WebFrame::uniqueName across renderers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dump-render-tree3
Patch Set: Fixing fallout from the new assert in FrameTree.cpp. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
2041 RegisterForAllNavNotifications(&notifications, &controller); 2041 RegisterForAllNavNotifications(&notifications, &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
2122 RegisterForAllNavNotifications(&notifications, &controller); 2122 RegisterForAllNavNotifications(&notifications, &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
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
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
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 1413 matching lines...) Expand 10 before | Expand all | Expand 10 after
3713 const GURL url("http://www.google.com/"); 3713 const GURL url("http://www.google.com/");
3714 main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url); 3714 main_test_rfh()->NavigateAndCommitRendererInitiated(0, true, url);
3715 3715
3716 // We should be at the first navigation entry. 3716 // We should be at the first navigation entry.
3717 EXPECT_EQ(controller.GetEntryCount(), 1); 3717 EXPECT_EQ(controller.GetEntryCount(), 1);
3718 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0); 3718 EXPECT_EQ(controller.GetLastCommittedEntryIndex(), 0);
3719 3719
3720 // Add and navigate a subframe that would normally count as in-page. 3720 // Add and navigate a subframe that would normally count as in-page.
3721 main_test_rfh()->OnCreateChildFrame( 3721 main_test_rfh()->OnCreateChildFrame(
3722 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, 3722 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document,
3723 std::string(), blink::WebSandboxFlags::None, 3723 std::string(), "uniqueName0", blink::WebSandboxFlags::None,
3724 blink::WebFrameOwnerProperties()); 3724 blink::WebFrameOwnerProperties());
3725 RenderFrameHostImpl* subframe = 3725 RenderFrameHostImpl* subframe =
3726 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); 3726 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host();
3727 const GURL subframe_url("http://www.google.com/#"); 3727 const GURL subframe_url("http://www.google.com/#");
3728 FrameHostMsg_DidCommitProvisionalLoad_Params params; 3728 FrameHostMsg_DidCommitProvisionalLoad_Params params;
3729 params.page_id = 0; 3729 params.page_id = 0;
3730 params.nav_entry_id = 0; 3730 params.nav_entry_id = 0;
3731 params.did_create_new_entry = false; 3731 params.did_create_new_entry = false;
3732 params.url = subframe_url; 3732 params.url = subframe_url;
3733 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; 3733 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
3880 3880
3881 // Now start a pending load to a totally different page, but don't commit it. 3881 // Now start a pending load to a totally different page, but don't commit it.
3882 const GURL url2("http://bar/"); 3882 const GURL url2("http://bar/");
3883 controller.LoadURL( 3883 controller.LoadURL(
3884 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); 3884 url2, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string());
3885 3885
3886 // Send a subframe update from the first page, as if one had just 3886 // Send a subframe update from the first page, as if one had just
3887 // automatically loaded. Auto subframes don't increment the page ID. 3887 // automatically loaded. Auto subframes don't increment the page ID.
3888 main_test_rfh()->OnCreateChildFrame( 3888 main_test_rfh()->OnCreateChildFrame(
3889 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document, 3889 process()->GetNextRoutingID(), blink::WebTreeScopeType::Document,
3890 std::string(), blink::WebSandboxFlags::None, 3890 std::string(), "uniqueName0", blink::WebSandboxFlags::None,
3891 blink::WebFrameOwnerProperties()); 3891 blink::WebFrameOwnerProperties());
3892 RenderFrameHostImpl* subframe = 3892 RenderFrameHostImpl* subframe =
3893 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host(); 3893 contents()->GetFrameTree()->root()->child_at(0)->current_frame_host();
3894 const GURL url1_sub("http://foo/subframe"); 3894 const GURL url1_sub("http://foo/subframe");
3895 FrameHostMsg_DidCommitProvisionalLoad_Params params; 3895 FrameHostMsg_DidCommitProvisionalLoad_Params params;
3896 params.page_id = controller.GetLastCommittedEntry()->GetPageID(); 3896 params.page_id = controller.GetLastCommittedEntry()->GetPageID();
3897 params.nav_entry_id = 0; 3897 params.nav_entry_id = 0;
3898 params.did_create_new_entry = false; 3898 params.did_create_new_entry = false;
3899 params.url = url1_sub; 3899 params.url = url1_sub;
3900 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; 3900 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME;
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
5118 EXPECT_EQ(default_ssl_status.connection_status, 5118 EXPECT_EQ(default_ssl_status.connection_status,
5119 details.ssl_status.connection_status); 5119 details.ssl_status.connection_status);
5120 EXPECT_EQ(default_ssl_status.content_status, 5120 EXPECT_EQ(default_ssl_status.content_status,
5121 details.ssl_status.content_status); 5121 details.ssl_status.content_status);
5122 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); 5122 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size());
5123 5123
5124 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); 5124 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count());
5125 } 5125 }
5126 5126
5127 } // namespace content 5127 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698