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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 2225343002: Navigation: move RestoreType and ReloadType into a separate file (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: [rebase] Created 4 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 // SiteInstance. 867 // SiteInstance.
868 browser_client.set_assign_site_for_url(false); 868 browser_client.set_assign_site_for_url(false);
869 const GURL native_url("non-site-url://stuffandthings"); 869 const GURL native_url("non-site-url://stuffandthings");
870 std::vector<std::unique_ptr<NavigationEntry>> entries; 870 std::vector<std::unique_ptr<NavigationEntry>> entries;
871 std::unique_ptr<NavigationEntry> new_entry = 871 std::unique_ptr<NavigationEntry> new_entry =
872 NavigationControllerImpl::CreateNavigationEntry( 872 NavigationControllerImpl::CreateNavigationEntry(
873 native_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, 873 native_url, Referrer(), ui::PAGE_TRANSITION_LINK, false,
874 std::string(), browser_context()); 874 std::string(), browser_context());
875 new_entry->SetPageID(0); 875 new_entry->SetPageID(0);
876 entries.push_back(std::move(new_entry)); 876 entries.push_back(std::move(new_entry));
877 controller().Restore( 877 controller().Restore(0, RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries);
878 0,
879 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY,
880 &entries);
881 ASSERT_EQ(0u, entries.size()); 878 ASSERT_EQ(0u, entries.size());
882 ASSERT_EQ(1, controller().GetEntryCount()); 879 ASSERT_EQ(1, controller().GetEntryCount());
883 880
884 controller().GoToIndex(0); 881 controller().GoToIndex(0);
885 NavigationEntry* entry = controller().GetPendingEntry(); 882 NavigationEntry* entry = controller().GetPendingEntry();
886 orig_rfh->PrepareForCommit(); 883 orig_rfh->PrepareForCommit();
887 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false, 884 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false,
888 native_url, ui::PAGE_TRANSITION_RELOAD); 885 native_url, ui::PAGE_TRANSITION_RELOAD);
889 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); 886 EXPECT_EQ(orig_instance, contents()->GetSiteInstance());
890 EXPECT_EQ(GURL(), contents()->GetSiteInstance()->GetSiteURL()); 887 EXPECT_EQ(GURL(), contents()->GetSiteInstance()->GetSiteURL());
(...skipping 26 matching lines...) Expand all
917 // ShouldAssignSiteForUrl override is disabled (i.e. returns true). 914 // ShouldAssignSiteForUrl override is disabled (i.e. returns true).
918 browser_client.set_assign_site_for_url(true); 915 browser_client.set_assign_site_for_url(true);
919 const GURL regular_url("http://www.yahoo.com"); 916 const GURL regular_url("http://www.yahoo.com");
920 std::vector<std::unique_ptr<NavigationEntry>> entries; 917 std::vector<std::unique_ptr<NavigationEntry>> entries;
921 std::unique_ptr<NavigationEntry> new_entry = 918 std::unique_ptr<NavigationEntry> new_entry =
922 NavigationControllerImpl::CreateNavigationEntry( 919 NavigationControllerImpl::CreateNavigationEntry(
923 regular_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, 920 regular_url, Referrer(), ui::PAGE_TRANSITION_LINK, false,
924 std::string(), browser_context()); 921 std::string(), browser_context());
925 new_entry->SetPageID(0); 922 new_entry->SetPageID(0);
926 entries.push_back(std::move(new_entry)); 923 entries.push_back(std::move(new_entry));
927 controller().Restore( 924 controller().Restore(0, RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries);
928 0,
929 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY,
930 &entries);
931 ASSERT_EQ(0u, entries.size()); 925 ASSERT_EQ(0u, entries.size());
932 926
933 ASSERT_EQ(1, controller().GetEntryCount()); 927 ASSERT_EQ(1, controller().GetEntryCount());
934 controller().GoToIndex(0); 928 controller().GoToIndex(0);
935 NavigationEntry* entry = controller().GetPendingEntry(); 929 NavigationEntry* entry = controller().GetPendingEntry();
936 orig_rfh->PrepareForCommit(); 930 orig_rfh->PrepareForCommit();
937 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false, 931 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false,
938 regular_url, ui::PAGE_TRANSITION_RELOAD); 932 regular_url, ui::PAGE_TRANSITION_RELOAD);
939 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); 933 EXPECT_EQ(orig_instance, contents()->GetSiteInstance());
940 EXPECT_TRUE(orig_instance->HasSite()); 934 EXPECT_TRUE(orig_instance->HasSite());
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after
3456 // An automatic navigation. 3450 // An automatic navigation.
3457 contents()->GetMainFrame()->SendNavigateWithModificationCallback( 3451 contents()->GetMainFrame()->SendNavigateWithModificationCallback(
3458 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); 3452 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture));
3459 3453
3460 EXPECT_EQ(1u, dialog_manager.reset_count()); 3454 EXPECT_EQ(1u, dialog_manager.reset_count());
3461 3455
3462 contents()->SetJavaScriptDialogManagerForTesting(nullptr); 3456 contents()->SetJavaScriptDialogManagerForTesting(nullptr);
3463 } 3457 }
3464 3458
3465 } // namespace content 3459 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/browser/web_contents/web_contents_view_aura_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698