| 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 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 2178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2189 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 2189 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
| 2190 params.should_update_history = false; | 2190 params.should_update_history = false; |
| 2191 params.gesture = NavigationGestureUser; | 2191 params.gesture = NavigationGestureUser; |
| 2192 params.method = "GET"; | 2192 params.method = "GET"; |
| 2193 params.page_state = PageState::CreateFromURL(subframe_url); | 2193 params.page_state = PageState::CreateFromURL(subframe_url); |
| 2194 | 2194 |
| 2195 // Navigating should do nothing. | 2195 // Navigating should do nothing. |
| 2196 subframe->SendRendererInitiatedNavigationRequest(subframe_url, false); | 2196 subframe->SendRendererInitiatedNavigationRequest(subframe_url, false); |
| 2197 subframe->PrepareForCommit(); | 2197 subframe->PrepareForCommit(); |
| 2198 subframe->SendNavigateWithParams(¶ms); | 2198 subframe->SendNavigateWithParams(¶ms); |
| 2199 EXPECT_EQ(0U, notifications.size()); | 2199 |
| 2200 // In UseSubframeNavigationEntries mode, we notify of a PageState update to |
| 2201 // the entry here rather than during UpdateState. |
| 2202 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 2203 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED)); |
| 2204 else |
| 2205 EXPECT_EQ(0U, notifications.size()); |
| 2200 } | 2206 } |
| 2201 | 2207 |
| 2202 // Now do a new navigation in the frame. | 2208 // Now do a new navigation in the frame. |
| 2203 const GURL url2("http://foo2"); | 2209 const GURL url2("http://foo2"); |
| 2204 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2210 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 2205 params.page_id = 2; | 2211 params.page_id = 2; |
| 2206 params.nav_entry_id = 0; | 2212 params.nav_entry_id = 0; |
| 2207 params.frame_unique_name = unique_name; | 2213 params.frame_unique_name = unique_name; |
| 2208 params.did_create_new_entry = true; | 2214 params.did_create_new_entry = true; |
| 2209 params.url = url2; | 2215 params.url = url2; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 2282 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
| 2277 params.should_update_history = false; | 2283 params.should_update_history = false; |
| 2278 params.gesture = NavigationGestureUser; | 2284 params.gesture = NavigationGestureUser; |
| 2279 params.method = "GET"; | 2285 params.method = "GET"; |
| 2280 params.page_state = PageState::CreateFromURL(url2); | 2286 params.page_state = PageState::CreateFromURL(url2); |
| 2281 | 2287 |
| 2282 // Navigating should do nothing. | 2288 // Navigating should do nothing. |
| 2283 subframe->SendRendererInitiatedNavigationRequest(url2, false); | 2289 subframe->SendRendererInitiatedNavigationRequest(url2, false); |
| 2284 subframe->PrepareForCommit(); | 2290 subframe->PrepareForCommit(); |
| 2285 subframe->SendNavigateWithParams(¶ms); | 2291 subframe->SendNavigateWithParams(¶ms); |
| 2286 EXPECT_EQ(0U, notifications.size()); | 2292 |
| 2293 // In UseSubframeNavigationEntries mode, we notify of a PageState update to |
| 2294 // the entry here rather than during UpdateState. |
| 2295 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 2296 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED)); |
| 2297 else |
| 2298 EXPECT_EQ(0U, notifications.size()); |
| 2287 } | 2299 } |
| 2288 | 2300 |
| 2289 // There should still be only one entry. | 2301 // There should still be only one entry. |
| 2290 EXPECT_EQ(1, controller.GetEntryCount()); | 2302 EXPECT_EQ(1, controller.GetEntryCount()); |
| 2291 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); | 2303 NavigationEntryImpl* entry = controller.GetLastCommittedEntry(); |
| 2292 EXPECT_EQ(url1, entry->GetURL()); | 2304 EXPECT_EQ(url1, entry->GetURL()); |
| 2293 EXPECT_EQ(1, entry->GetPageID()); | 2305 EXPECT_EQ(1, entry->GetPageID()); |
| 2294 FrameNavigationEntry* root_entry = entry->root_node()->frame_entry.get(); | 2306 FrameNavigationEntry* root_entry = entry->root_node()->frame_entry.get(); |
| 2295 EXPECT_EQ(url1, root_entry->url()); | 2307 EXPECT_EQ(url1, root_entry->url()); |
| 2296 | 2308 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2325 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 2337 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
| 2326 params.should_update_history = false; | 2338 params.should_update_history = false; |
| 2327 params.gesture = NavigationGestureUser; | 2339 params.gesture = NavigationGestureUser; |
| 2328 params.method = "GET"; | 2340 params.method = "GET"; |
| 2329 params.page_state = PageState::CreateFromURL(url3); | 2341 params.page_state = PageState::CreateFromURL(url3); |
| 2330 | 2342 |
| 2331 // Navigating should do nothing. | 2343 // Navigating should do nothing. |
| 2332 subframe2->SendRendererInitiatedNavigationRequest(url3, false); | 2344 subframe2->SendRendererInitiatedNavigationRequest(url3, false); |
| 2333 subframe2->PrepareForCommit(); | 2345 subframe2->PrepareForCommit(); |
| 2334 subframe2->SendNavigateWithParams(¶ms); | 2346 subframe2->SendNavigateWithParams(¶ms); |
| 2335 EXPECT_EQ(0U, notifications.size()); | 2347 |
| 2348 // In UseSubframeNavigationEntries mode, we notify of a PageState update to |
| 2349 // the entry here rather than during UpdateState. |
| 2350 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 2351 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED)); |
| 2352 else |
| 2353 EXPECT_EQ(0U, notifications.size()); |
| 2336 } | 2354 } |
| 2337 | 2355 |
| 2338 // There should still be only one entry, mostly unchanged. | 2356 // There should still be only one entry, mostly unchanged. |
| 2339 EXPECT_EQ(1, controller.GetEntryCount()); | 2357 EXPECT_EQ(1, controller.GetEntryCount()); |
| 2340 EXPECT_EQ(entry, controller.GetLastCommittedEntry()); | 2358 EXPECT_EQ(entry, controller.GetLastCommittedEntry()); |
| 2341 EXPECT_EQ(url1, entry->GetURL()); | 2359 EXPECT_EQ(url1, entry->GetURL()); |
| 2342 EXPECT_EQ(1, entry->GetPageID()); | 2360 EXPECT_EQ(1, entry->GetPageID()); |
| 2343 EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get()); | 2361 EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get()); |
| 2344 EXPECT_EQ(url1, root_entry->url()); | 2362 EXPECT_EQ(url1, root_entry->url()); |
| 2345 | 2363 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; | 2397 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; |
| 2380 params.should_update_history = false; | 2398 params.should_update_history = false; |
| 2381 params.gesture = NavigationGestureUser; | 2399 params.gesture = NavigationGestureUser; |
| 2382 params.method = "GET"; | 2400 params.method = "GET"; |
| 2383 params.page_state = PageState::CreateFromURL(url4); | 2401 params.page_state = PageState::CreateFromURL(url4); |
| 2384 | 2402 |
| 2385 // Navigating should do nothing. | 2403 // Navigating should do nothing. |
| 2386 subframe3->SendRendererInitiatedNavigationRequest(url4, false); | 2404 subframe3->SendRendererInitiatedNavigationRequest(url4, false); |
| 2387 subframe3->PrepareForCommit(); | 2405 subframe3->PrepareForCommit(); |
| 2388 subframe3->SendNavigateWithParams(¶ms); | 2406 subframe3->SendNavigateWithParams(¶ms); |
| 2389 EXPECT_EQ(0U, notifications.size()); | 2407 |
| 2408 // In UseSubframeNavigationEntries mode, we notify of a PageState update to |
| 2409 // the entry here rather than during UpdateState. |
| 2410 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 2411 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED)); |
| 2412 else |
| 2413 EXPECT_EQ(0U, notifications.size()); |
| 2390 } | 2414 } |
| 2391 | 2415 |
| 2392 // There should still be only one entry, mostly unchanged. | 2416 // There should still be only one entry, mostly unchanged. |
| 2393 EXPECT_EQ(1, controller.GetEntryCount()); | 2417 EXPECT_EQ(1, controller.GetEntryCount()); |
| 2394 EXPECT_EQ(entry, controller.GetLastCommittedEntry()); | 2418 EXPECT_EQ(entry, controller.GetLastCommittedEntry()); |
| 2395 EXPECT_EQ(url1, entry->GetURL()); | 2419 EXPECT_EQ(url1, entry->GetURL()); |
| 2396 EXPECT_EQ(1, entry->GetPageID()); | 2420 EXPECT_EQ(1, entry->GetPageID()); |
| 2397 EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get()); | 2421 EXPECT_EQ(root_entry, entry->root_node()->frame_entry.get()); |
| 2398 EXPECT_EQ(url1, root_entry->url()); | 2422 EXPECT_EQ(url1, root_entry->url()); |
| 2399 | 2423 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2448 params.should_update_history = false; | 2472 params.should_update_history = false; |
| 2449 params.gesture = NavigationGestureUser; | 2473 params.gesture = NavigationGestureUser; |
| 2450 params.method = "GET"; | 2474 params.method = "GET"; |
| 2451 params.page_state = PageState::CreateFromURL(subframe_url); | 2475 params.page_state = PageState::CreateFromURL(subframe_url); |
| 2452 params.item_sequence_number = item_sequence_number1; | 2476 params.item_sequence_number = item_sequence_number1; |
| 2453 | 2477 |
| 2454 // Navigating should do nothing. | 2478 // Navigating should do nothing. |
| 2455 subframe->SendRendererInitiatedNavigationRequest(subframe_url, false); | 2479 subframe->SendRendererInitiatedNavigationRequest(subframe_url, false); |
| 2456 subframe->PrepareForCommit(); | 2480 subframe->PrepareForCommit(); |
| 2457 subframe->SendNavigateWithParams(¶ms); | 2481 subframe->SendNavigateWithParams(¶ms); |
| 2458 EXPECT_EQ(0U, notifications.size()); | 2482 |
| 2483 // In UseSubframeNavigationEntries mode, we notify of a PageState update to |
| 2484 // the entry here rather than during UpdateState. |
| 2485 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) |
| 2486 EXPECT_TRUE(notifications.Check1AndReset(NOTIFICATION_NAV_ENTRY_CHANGED)); |
| 2487 else |
| 2488 EXPECT_EQ(0U, notifications.size()); |
| 2459 } | 2489 } |
| 2460 | 2490 |
| 2461 // First manual subframe navigation. | 2491 // First manual subframe navigation. |
| 2462 const GURL url2("http://foo2"); | 2492 const GURL url2("http://foo2"); |
| 2463 int64_t item_sequence_number2 = base::Time::Now().ToDoubleT() * 1000000; | 2493 int64_t item_sequence_number2 = base::Time::Now().ToDoubleT() * 1000000; |
| 2464 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 2494 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 2465 params.page_id = 2; | 2495 params.page_id = 2; |
| 2466 params.nav_entry_id = 0; | 2496 params.nav_entry_id = 0; |
| 2467 params.frame_unique_name = unique_name; | 2497 params.frame_unique_name = unique_name; |
| 2468 params.did_create_new_entry = true; | 2498 params.did_create_new_entry = true; |
| (...skipping 2861 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5330 EXPECT_EQ(default_ssl_status.connection_status, | 5360 EXPECT_EQ(default_ssl_status.connection_status, |
| 5331 observer.details().ssl_status.connection_status); | 5361 observer.details().ssl_status.connection_status); |
| 5332 EXPECT_EQ(default_ssl_status.content_status, | 5362 EXPECT_EQ(default_ssl_status.content_status, |
| 5333 observer.details().ssl_status.content_status); | 5363 observer.details().ssl_status.content_status); |
| 5334 EXPECT_EQ(default_ssl_status.sct_statuses, | 5364 EXPECT_EQ(default_ssl_status.sct_statuses, |
| 5335 observer.details().ssl_status.sct_statuses); | 5365 observer.details().ssl_status.sct_statuses); |
| 5336 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); | 5366 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); |
| 5337 } | 5367 } |
| 5338 | 5368 |
| 5339 } // namespace content | 5369 } // namespace content |
| OLD | NEW |