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

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

Powered by Google App Engine
This is Rietveld 408576698