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

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, 4 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 // SiteInstance. 866 // SiteInstance.
867 browser_client.set_assign_site_for_url(false); 867 browser_client.set_assign_site_for_url(false);
868 const GURL native_url("non-site-url://stuffandthings"); 868 const GURL native_url("non-site-url://stuffandthings");
869 std::vector<std::unique_ptr<NavigationEntry>> entries; 869 std::vector<std::unique_ptr<NavigationEntry>> entries;
870 std::unique_ptr<NavigationEntry> new_entry = 870 std::unique_ptr<NavigationEntry> new_entry =
871 NavigationControllerImpl::CreateNavigationEntry( 871 NavigationControllerImpl::CreateNavigationEntry(
872 native_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, 872 native_url, Referrer(), ui::PAGE_TRANSITION_LINK, false,
873 std::string(), browser_context()); 873 std::string(), browser_context());
874 new_entry->SetPageID(0); 874 new_entry->SetPageID(0);
875 entries.push_back(std::move(new_entry)); 875 entries.push_back(std::move(new_entry));
876 controller().Restore( 876 controller().Restore(0, RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries);
877 0,
878 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY,
879 &entries);
880 ASSERT_EQ(0u, entries.size()); 877 ASSERT_EQ(0u, entries.size());
881 ASSERT_EQ(1, controller().GetEntryCount()); 878 ASSERT_EQ(1, controller().GetEntryCount());
882 879
883 controller().GoToIndex(0); 880 controller().GoToIndex(0);
884 NavigationEntry* entry = controller().GetPendingEntry(); 881 NavigationEntry* entry = controller().GetPendingEntry();
885 orig_rfh->PrepareForCommit(); 882 orig_rfh->PrepareForCommit();
886 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false, 883 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false,
887 native_url, ui::PAGE_TRANSITION_RELOAD); 884 native_url, ui::PAGE_TRANSITION_RELOAD);
888 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); 885 EXPECT_EQ(orig_instance, contents()->GetSiteInstance());
889 EXPECT_EQ(GURL(), contents()->GetSiteInstance()->GetSiteURL()); 886 EXPECT_EQ(GURL(), contents()->GetSiteInstance()->GetSiteURL());
(...skipping 26 matching lines...) Expand all
916 // ShouldAssignSiteForUrl override is disabled (i.e. returns true). 913 // ShouldAssignSiteForUrl override is disabled (i.e. returns true).
917 browser_client.set_assign_site_for_url(true); 914 browser_client.set_assign_site_for_url(true);
918 const GURL regular_url("http://www.yahoo.com"); 915 const GURL regular_url("http://www.yahoo.com");
919 std::vector<std::unique_ptr<NavigationEntry>> entries; 916 std::vector<std::unique_ptr<NavigationEntry>> entries;
920 std::unique_ptr<NavigationEntry> new_entry = 917 std::unique_ptr<NavigationEntry> new_entry =
921 NavigationControllerImpl::CreateNavigationEntry( 918 NavigationControllerImpl::CreateNavigationEntry(
922 regular_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, 919 regular_url, Referrer(), ui::PAGE_TRANSITION_LINK, false,
923 std::string(), browser_context()); 920 std::string(), browser_context());
924 new_entry->SetPageID(0); 921 new_entry->SetPageID(0);
925 entries.push_back(std::move(new_entry)); 922 entries.push_back(std::move(new_entry));
926 controller().Restore( 923 controller().Restore(0, RestoreType::LAST_SESSION_EXITED_CLEANLY, &entries);
927 0,
928 NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY,
929 &entries);
930 ASSERT_EQ(0u, entries.size()); 924 ASSERT_EQ(0u, entries.size());
931 925
932 ASSERT_EQ(1, controller().GetEntryCount()); 926 ASSERT_EQ(1, controller().GetEntryCount());
933 controller().GoToIndex(0); 927 controller().GoToIndex(0);
934 NavigationEntry* entry = controller().GetPendingEntry(); 928 NavigationEntry* entry = controller().GetPendingEntry();
935 orig_rfh->PrepareForCommit(); 929 orig_rfh->PrepareForCommit();
936 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false, 930 contents()->TestDidNavigate(orig_rfh, 0, entry->GetUniqueID(), false,
937 regular_url, ui::PAGE_TRANSITION_RELOAD); 931 regular_url, ui::PAGE_TRANSITION_RELOAD);
938 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); 932 EXPECT_EQ(orig_instance, contents()->GetSiteInstance());
939 EXPECT_TRUE(orig_instance->HasSite()); 933 EXPECT_TRUE(orig_instance->HasSite());
(...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after
3463 // An automatic navigation. 3457 // An automatic navigation.
3464 contents()->GetMainFrame()->SendNavigateWithModificationCallback( 3458 contents()->GetMainFrame()->SendNavigateWithModificationCallback(
3465 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); 3459 2, 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture));
3466 3460
3467 EXPECT_EQ(1u, dialog_manager.reset_count()); 3461 EXPECT_EQ(1u, dialog_manager.reset_count());
3468 3462
3469 contents()->SetJavaScriptDialogManagerForTesting(nullptr); 3463 contents()->SetJavaScriptDialogManagerForTesting(nullptr);
3470 } 3464 }
3471 3465
3472 } // namespace content 3466 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698