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

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

Issue 1422333009: OOPIF: History navigations for new child frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve comment. Created 5 years 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 EXPECT_EQ(0U, entry2->root_node()->children.size()); 2315 EXPECT_EQ(0U, entry2->root_node()->children.size());
2316 } 2316 }
2317 2317
2318 // Second manual subframe navigation should also make a new entry. 2318 // Second manual subframe navigation should also make a new entry.
2319 const GURL url3("http://foo3"); 2319 const GURL url3("http://foo3");
2320 params.page_id = 3; 2320 params.page_id = 3;
2321 params.nav_entry_id = 0; 2321 params.nav_entry_id = 0;
2322 params.did_create_new_entry = true; 2322 params.did_create_new_entry = true;
2323 params.url = url3; 2323 params.url = url3;
2324 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; 2324 params.transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME;
2325 params.page_state = PageState::CreateFromURL(url3);
2325 EXPECT_TRUE(controller.RendererDidNavigate(subframe, params, &details)); 2326 EXPECT_TRUE(controller.RendererDidNavigate(subframe, params, &details));
2326 EXPECT_EQ(1U, navigation_entry_committed_counter_); 2327 EXPECT_EQ(1U, navigation_entry_committed_counter_);
2327 navigation_entry_committed_counter_ = 0; 2328 navigation_entry_committed_counter_ = 0;
2328 NavigationEntryImpl* entry3 = controller.GetLastCommittedEntry(); 2329 NavigationEntryImpl* entry3 = controller.GetLastCommittedEntry();
2329 EXPECT_EQ(3, controller.GetEntryCount()); 2330 EXPECT_EQ(3, controller.GetEntryCount());
2330 EXPECT_EQ(2, controller.GetCurrentEntryIndex()); 2331 EXPECT_EQ(2, controller.GetCurrentEntryIndex());
2331 2332
2332 // Verify subframe entries if they're enabled (e.g. in --site-per-process). 2333 // Verify subframe entries if they're enabled (e.g. in --site-per-process).
2333 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) { 2334 if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
2334 // The entry should have a subframe FrameNavigationEntry. 2335 // The entry should have a subframe FrameNavigationEntry.
2335 ASSERT_EQ(1U, entry3->root_node()->children.size()); 2336 ASSERT_EQ(1U, entry3->root_node()->children.size());
2336 EXPECT_EQ(url3, entry3->root_node()->children[0]->frame_entry->url()); 2337 EXPECT_EQ(url3, entry3->root_node()->children[0]->frame_entry->url());
2337 } else { 2338 } else {
2338 // There are no subframe FrameNavigationEntries by default. 2339 // There are no subframe FrameNavigationEntries by default.
2339 EXPECT_EQ(0U, entry3->root_node()->children.size()); 2340 EXPECT_EQ(0U, entry3->root_node()->children.size());
2340 } 2341 }
2341 2342
2342 // Go back one. 2343 // Go back one.
2343 controller.GoBack(); 2344 controller.GoBack();
2344 params.page_id = 2; 2345 params.page_id = 2;
2345 params.nav_entry_id = entry2->GetUniqueID(); 2346 params.nav_entry_id = entry2->GetUniqueID();
2346 params.did_create_new_entry = false; 2347 params.did_create_new_entry = false;
2347 params.url = url2; 2348 params.url = url2;
2348 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; 2349 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME;
2350 params.page_state = PageState::CreateFromURL(url2);
2349 EXPECT_TRUE(controller.RendererDidNavigate(subframe, params, &details)); 2351 EXPECT_TRUE(controller.RendererDidNavigate(subframe, params, &details));
2350 EXPECT_EQ(1U, navigation_entry_committed_counter_); 2352 EXPECT_EQ(1U, navigation_entry_committed_counter_);
2351 navigation_entry_committed_counter_ = 0; 2353 navigation_entry_committed_counter_ = 0;
2352 EXPECT_EQ(entry2, controller.GetLastCommittedEntry()); 2354 EXPECT_EQ(entry2, controller.GetLastCommittedEntry());
2353 EXPECT_EQ(3, controller.GetEntryCount()); 2355 EXPECT_EQ(3, controller.GetEntryCount());
2354 EXPECT_EQ(1, controller.GetCurrentEntryIndex()); 2356 EXPECT_EQ(1, controller.GetCurrentEntryIndex());
2355 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); 2357 EXPECT_EQ(-1, controller.GetPendingEntryIndex());
2356 EXPECT_FALSE(controller.GetPendingEntry()); 2358 EXPECT_FALSE(controller.GetPendingEntry());
2357 2359
2358 // Go back one more. 2360 // Go back one more.
2359 controller.GoBack(); 2361 controller.GoBack();
2360 params.page_id = 1; 2362 params.page_id = 1;
2361 params.nav_entry_id = entry1->GetUniqueID(); 2363 params.nav_entry_id = entry1->GetUniqueID();
2362 params.did_create_new_entry = false; 2364 params.did_create_new_entry = false;
2363 params.url = url1; 2365 params.url = subframe_url;
2364 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; 2366 params.transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME;
2367 params.page_state = PageState::CreateFromURL(subframe_url);
2365 EXPECT_TRUE(controller.RendererDidNavigate(subframe, params, &details)); 2368 EXPECT_TRUE(controller.RendererDidNavigate(subframe, params, &details));
2366 EXPECT_EQ(1U, navigation_entry_committed_counter_); 2369 EXPECT_EQ(1U, navigation_entry_committed_counter_);
2367 navigation_entry_committed_counter_ = 0; 2370 navigation_entry_committed_counter_ = 0;
2368 EXPECT_EQ(entry1, controller.GetLastCommittedEntry()); 2371 EXPECT_EQ(entry1, controller.GetLastCommittedEntry());
2369 EXPECT_EQ(3, controller.GetEntryCount()); 2372 EXPECT_EQ(3, controller.GetEntryCount());
2370 EXPECT_EQ(0, controller.GetCurrentEntryIndex()); 2373 EXPECT_EQ(0, controller.GetCurrentEntryIndex());
2371 EXPECT_EQ(-1, controller.GetPendingEntryIndex()); 2374 EXPECT_EQ(-1, controller.GetPendingEntryIndex());
2372 EXPECT_FALSE(controller.GetPendingEntry()); 2375 EXPECT_FALSE(controller.GetPendingEntry());
2373 } 2376 }
2374 2377
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after
5090 EXPECT_EQ(default_ssl_status.connection_status, 5093 EXPECT_EQ(default_ssl_status.connection_status,
5091 details.ssl_status.connection_status); 5094 details.ssl_status.connection_status);
5092 EXPECT_EQ(default_ssl_status.content_status, 5095 EXPECT_EQ(default_ssl_status.content_status,
5093 details.ssl_status.content_status); 5096 details.ssl_status.content_status);
5094 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size()); 5097 EXPECT_EQ(0u, details.ssl_status.signed_certificate_timestamp_ids.size());
5095 5098
5096 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count()); 5099 EXPECT_EQ(1, main_test_rfh()->GetProcess()->bad_msg_count());
5097 } 5100 }
5098 5101
5099 } // namespace content 5102 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698