diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-29 00:23:55 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-29 00:23:55 +0000 |
commit | a26023822aec02831957e541b61a6bdb3fac694e (patch) | |
tree | 2fa3d0368ddc4f75d6372721c6b07d8e2d7c37af | |
parent | 716476cf40c8d367b1325c5a46f4e5e886965c28 (diff) | |
download | chromium_src-a26023822aec02831957e541b61a6bdb3fac694e.zip chromium_src-a26023822aec02831957e541b61a6bdb3fac694e.tar.gz chromium_src-a26023822aec02831957e541b61a6bdb3fac694e.tar.bz2 |
Convert unix_hacker functions on NavigationController that are used by Chrome to CamelCase. This is in preparation for adding an interface around NavigationController.
BUG=98716
TBR=joi
Review URL: http://codereview.chromium.org/8989070
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115937 0039d316-1c4b-4281-b951-d872f2087c98
33 files changed, 297 insertions, 280 deletions
diff --git a/chrome/browser/alternate_nav_url_fetcher.cc b/chrome/browser/alternate_nav_url_fetcher.cc index a602bf3..04a2c4e 100644 --- a/chrome/browser/alternate_nav_url_fetcher.cc +++ b/chrome/browser/alternate_nav_url_fetcher.cc @@ -187,7 +187,7 @@ void AlternateNavURLFetcher::StartFetch(NavigationController* controller) { fetcher_.reset(content::URLFetcher::Create( GURL(alternate_nav_url_), content::URLFetcher::HEAD, this)); fetcher_->SetRequestContext( - controller_->browser_context()->GetRequestContext()); + controller_->GetBrowserContext()->GetRequestContext()); fetcher_->Start(); } diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc index ffb1cc1b..26e050c 100644 --- a/chrome/browser/automation/automation_provider_observers.cc +++ b/chrome/browser/automation/automation_provider_observers.cc @@ -259,7 +259,7 @@ void NavigationControllerRestoredObserver::Observe( } bool NavigationControllerRestoredObserver::FinishedRestoring() { - return (!controller_->needs_reload() && !controller_->GetPendingEntry() && + return (!controller_->NeedsReload() && !controller_->GetPendingEntry() && !controller_->tab_contents()->IsLoading()); } diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index f4f2284..9afdcae 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -765,7 +765,7 @@ void TestingAutomationProvider::GetRedirectsFrom(int tab_handle, LOG(ERROR) << "Can only handle one redirect query at once."; } else if (tab_tracker_->ContainsHandle(tab_handle)) { NavigationController* tab = tab_tracker_->GetResource(tab_handle); - Profile* profile = Profile::FromBrowserContext(tab->browser_context()); + Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); HistoryService* history_service = profile->GetHistoryService(Profile::EXPLICIT_ACCESS); @@ -1430,7 +1430,7 @@ void TestingAutomationProvider::GetDownloadDirectory( int handle, FilePath* download_directory) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); - DownloadManager* dlm = tab->browser_context()->GetDownloadManager(); + DownloadManager* dlm = tab->GetBrowserContext()->GetDownloadManager(); *download_directory = DownloadPrefs::FromDownloadManager(dlm)->download_path(); } diff --git a/chrome/browser/browser_commands_unittest.cc b/chrome/browser/browser_commands_unittest.cc index eb2f601..b2cd8da 100644 --- a/chrome/browser/browser_commands_unittest.cc +++ b/chrome/browser/browser_commands_unittest.cc @@ -74,7 +74,7 @@ TEST_F(BrowserCommandsTest, DuplicateTab) { // Verify the stack of urls. NavigationController& controller = browser()->GetTabContentsAt(1)->GetController(); - ASSERT_EQ(3, controller.entry_count()); + ASSERT_EQ(3, controller.GetEntryCount()); ASSERT_EQ(2, controller.GetCurrentEntryIndex()); ASSERT_TRUE(url1 == controller.GetEntryAtIndex(0)->GetURL()); ASSERT_TRUE(url2 == controller.GetEntryAtIndex(1)->GetURL()); diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc index 839b474..34aef3f 100644 --- a/chrome/browser/extensions/extension_message_service.cc +++ b/chrome/browser/extensions/extension_message_service.cc @@ -199,7 +199,7 @@ void ExtensionMessageService::OpenChannelToTab( contents->tab_contents()->GetRenderViewHost()->routing_id(); } - if (contents && contents->tab_contents()->GetController().needs_reload()) { + if (contents && contents->tab_contents()->GetController().NeedsReload()) { // The tab isn't loaded yet. Don't attempt to connect. Treat this as a // disconnect. DispatchOnDisconnect(MessagePort(source, MSG_ROUTING_CONTROL), @@ -287,7 +287,7 @@ int ExtensionMessageService::OpenSpecialChannelToTab( TabContents* target_tab_contents, IPC::Message::Sender* source) { DCHECK(target_tab_contents); - if (target_tab_contents->GetController().needs_reload()) { + if (target_tab_contents->GetController().NeedsReload()) { // The tab isn't loaded yet. Don't attempt to connect. return -1; } diff --git a/chrome/browser/extensions/extension_navigation_observer.cc b/chrome/browser/extensions/extension_navigation_observer.cc index 23c8575..5fed51a 100644 --- a/chrome/browser/extensions/extension_navigation_observer.cc +++ b/chrome/browser/extensions/extension_navigation_observer.cc @@ -31,7 +31,7 @@ void ExtensionNavigationObserver::Observe( NavigationController* controller = content::Source<NavigationController>(source).ptr(); if (!profile_->IsSameProfile( - Profile::FromBrowserContext(controller->browser_context()))) + Profile::FromBrowserContext(controller->GetBrowserContext()))) return; PromptToEnableExtensionIfNecessary(controller); diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc index e2e65a8..0d88559 100644 --- a/chrome/browser/extensions/extension_tabs_module.cc +++ b/chrome/browser/extensions/extension_tabs_module.cc @@ -1614,7 +1614,7 @@ bool DetectTabLanguageFunction::RunImpl() { return false; } - if (contents->tab_contents()->GetController().needs_reload()) { + if (contents->tab_contents()->GetController().NeedsReload()) { // If the tab hasn't been loaded, don't wait for the tab to load. error_ = keys::kCannotDetermineLanguageOfUnloadedTab; return false; diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 49b0278..c1e0fbf 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -837,7 +837,7 @@ void ExternalTabContainer::Observe(int type, if (InitNavigationInfo(&navigation_info, commit->type, commit->previous_entry_index - tab_contents_->tab_contents()-> - GetController().last_committed_entry_index())) + GetController().GetLastCommittedEntryIndex())) automation_->Send(new AutomationMsg_DidNavigate(tab_handle_, navigation_info)); } diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index d0e5316..2a10222 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -314,7 +314,7 @@ IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { // We should have two entries. One corresponding to the page the user was // first on, and one for the search page. - EXPECT_EQ(2, preview_tab->GetController().entry_count()); + EXPECT_EQ(2, preview_tab->GetController().GetEntryCount()); // Check that the value is reflected and onsubmit is called. EXPECT_EQ("true 1 0 1 true d false defghi true 3 3", diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index 5b7edbd..942b3a2 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -430,7 +430,7 @@ void InstantLoader::TabContentsDelegateImpl::NavigationStateChanged( const WebContents* source, unsigned changed_flags) { if (!loader_->ready() && !registered_render_widget_host_ && - source->GetController().entry_count()) { + source->GetController().GetEntryCount()) { // The load has been committed. Install an observer that waits for the // first paint then makes the preview active. We wait for the load to be // committed before waiting on paint as there is always an initial paint diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc index 4aa2c9c..3451ade 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc @@ -147,7 +147,7 @@ SafeBrowsingBlockingPage::SafeBrowsingBlockingPage( RecordUserAction(SHOW); if (!is_main_frame_load_blocked_) { navigation_entry_index_to_remove_ = - tab()->GetController().last_committed_entry_index(); + tab()->GetController().GetLastCommittedEntryIndex(); } else { navigation_entry_index_to_remove_ = -1; } @@ -610,7 +610,7 @@ void SafeBrowsingBlockingPage::DontProceed() { // current entry if it has been committed again, which is possible on a page // that had a subresource warning. int last_committed_index = - tab()->GetController().last_committed_entry_index(); + tab()->GetController().GetLastCommittedEntryIndex(); if (navigation_entry_index_to_remove_ != -1 && navigation_entry_index_to_remove_ != last_committed_index && !tab()->IsBeingDestroyed()) { diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index 138fb1e..ffc4e0d 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -283,7 +283,7 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceDontProceed) { // We did not proceed, we should be back to the first page, the 2nd one should // have been removed from the navigation controller. - ASSERT_EQ(1, controller().entry_count()); + ASSERT_EQ(1, controller().GetEntryCount()); EXPECT_EQ(kGoogleURL, controller().GetActiveEntry()->GetURL().spec()); // A report should have been sent. @@ -314,7 +314,7 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMalwareResourceProceed) { EXPECT_FALSE(GetSafeBrowsingBlockingPage()); // We did proceed, we should be back to showing the page. - ASSERT_EQ(1, controller().entry_count()); + ASSERT_EQ(1, controller().GetEntryCount()); EXPECT_EQ(kGoodURL, controller().GetActiveEntry()->GetURL().spec()); // A report should have been sent. @@ -356,7 +356,7 @@ TEST_F(SafeBrowsingBlockingPageTest, // We did not proceed, we should be back to the first page, the 2nd one should // have been removed from the navigation controller. - ASSERT_EQ(1, controller().entry_count()); + ASSERT_EQ(1, controller().GetEntryCount()); EXPECT_EQ(kGoogleURL, controller().GetActiveEntry()->GetURL().spec()); // A report should have been sent. @@ -412,7 +412,7 @@ TEST_F(SafeBrowsingBlockingPageTest, // We did not proceed, we should be back to the first page, the 2nd one should // have been removed from the navigation controller. - ASSERT_EQ(1, controller().entry_count()); + ASSERT_EQ(1, controller().GetEntryCount()); EXPECT_EQ(kGoogleURL, controller().GetActiveEntry()->GetURL().spec()); // No report should have been sent -- we don't create a report the @@ -463,7 +463,7 @@ TEST_F(SafeBrowsingBlockingPageTest, PageWithMultipleMalwareResourceProceed) { EXPECT_EQ(OK, user_response()); // We did proceed, we should be back to the initial page. - ASSERT_EQ(1, controller().entry_count()); + ASSERT_EQ(1, controller().GetEntryCount()); EXPECT_EQ(kGoodURL, controller().GetActiveEntry()->GetURL().spec()); // No report should have been sent -- we don't create a report the @@ -498,7 +498,7 @@ TEST_F(SafeBrowsingBlockingPageTest, NavigatingBackAndForth) { // We are back on the good page. sb_interstitial = GetSafeBrowsingBlockingPage(); ASSERT_FALSE(sb_interstitial); - ASSERT_EQ(2, controller().entry_count()); + ASSERT_EQ(2, controller().GetEntryCount()); EXPECT_EQ(kGoodURL, controller().GetActiveEntry()->GetURL().spec()); // Navigate forward to the malware URL. @@ -512,7 +512,7 @@ TEST_F(SafeBrowsingBlockingPageTest, NavigatingBackAndForth) { Navigate(kBadURL, 2); // Commit the navigation. sb_interstitial = GetSafeBrowsingBlockingPage(); ASSERT_FALSE(sb_interstitial); - ASSERT_EQ(2, controller().entry_count()); + ASSERT_EQ(2, controller().GetEntryCount()); EXPECT_EQ(kBadURL, controller().GetActiveEntry()->GetURL().spec()); // Two reports should have been sent. diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index ff7cf00..e7e28c9 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -562,7 +562,7 @@ void SessionService::Observe(int type, TabNavigationPathPrunedFromBack( tab->restore_tab_helper()->window_id(), tab->restore_tab_helper()->session_id(), - tab->tab_contents()->GetController().entry_count()); + tab->tab_contents()->GetController().GetEntryCount()); } RecordSessionUpdateHistogramData(content::NOTIFICATION_NAV_LIST_PRUNED, &last_updated_nav_list_pruned_time_); @@ -1121,9 +1121,9 @@ void SessionService::BuildCommandsForTab( current_index - max_persist_navigation_count); const int max_index = std::min(current_index + max_persist_navigation_count, - tab->tab_contents()->GetController().entry_count()); + tab->tab_contents()->GetController().GetEntryCount()); const int pending_index = - tab->tab_contents()->GetController().pending_entry_index(); + tab->tab_contents()->GetController().GetPendingEntryIndex(); if (tab_to_available_range) { (*tab_to_available_range)[session_id.id()] = std::pair<int, int>(min_index, max_index); diff --git a/chrome/browser/sessions/tab_restore_service.cc b/chrome/browser/sessions/tab_restore_service.cc index 1fed2156..f4c651b 100644 --- a/chrome/browser/sessions/tab_restore_service.cc +++ b/chrome/browser/sessions/tab_restore_service.cc @@ -486,8 +486,8 @@ void TabRestoreService::PopulateTab(Tab* tab, int index, TabRestoreServiceDelegate* delegate, NavigationController* controller) { - const int pending_index = controller->pending_entry_index(); - int entry_count = controller->entry_count(); + const int pending_index = controller->GetPendingEntryIndex(); + int entry_count = controller->GetEntryCount(); if (entry_count == 0 && pending_index == 0) entry_count++; tab->navigations.resize(static_cast<int>(entry_count)); @@ -513,7 +513,7 @@ void TabRestoreService::PopulateTab(Tab* tab, tab->extension_app_id = extension->id(); } - tab->session_storage_namespace = controller->session_storage_namespace(); + tab->session_storage_namespace = controller->GetSessionStorageNamespace(); // Delegate may be NULL during unit tests. if (delegate) { diff --git a/chrome/browser/sessions/tab_restore_service_browsertest.cc b/chrome/browser/sessions/tab_restore_service_browsertest.cc index d664597..0022a2e 100644 --- a/chrome/browser/sessions/tab_restore_service_browsertest.cc +++ b/chrome/browser/sessions/tab_restore_service_browsertest.cc @@ -190,7 +190,7 @@ TEST_F(TabRestoreServiceTest, DontRestorePrintPreviewTab) { GURL printPreviewURL(chrome::kChromeUIPrintURL); NavigateAndCommit(printPreviewURL); EXPECT_EQ(printPreviewURL, contents()->GetURL()); - EXPECT_EQ(4, controller().entry_count()); + EXPECT_EQ(4, controller().GetEntryCount()); // Have the service record the tab. service_->CreateHistoricalTab(&controller(), -1); diff --git a/chrome/browser/tabs/pinned_tab_codec.cc b/chrome/browser/tabs/pinned_tab_codec.cc index 74a9920..ad1eea1 100644 --- a/chrome/browser/tabs/pinned_tab_codec.cc +++ b/chrome/browser/tabs/pinned_tab_codec.cc @@ -58,7 +58,7 @@ static void EncodePinnedTab(TabStripModel* model, } else { NavigationEntry* entry = tab_contents->tab_contents()->GetController().GetActiveEntry(); - if (!entry && tab_contents->tab_contents()->GetController().entry_count()) + if (!entry && tab_contents->tab_contents()->GetController().GetEntryCount()) entry = tab_contents->tab_contents()->GetController().GetEntryAtIndex(0); if (entry) { value->SetString(kURL, entry->GetURL().spec()); diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc index d5bca5c..53319d8 100644 --- a/chrome/browser/tabs/tab_strip_model.cc +++ b/chrome/browser/tabs/tab_strip_model.cc @@ -1121,7 +1121,7 @@ bool TabStripModel::IsNewTabAtEndOfTabStrip( return url.SchemeIs(chrome::kChromeUIScheme) && url.host() == chrome::kChromeUINewTabHost && contents == GetContentsAt(count() - 1) && - contents->tab_contents()->GetController().entry_count() == 1; + contents->tab_contents()->GetController().GetEntryCount() == 1; } bool TabStripModel::InternalCloseTabs(const std::vector<int>& in_indices, diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 23fae44..08e69b3 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1377,7 +1377,7 @@ bool Browser::NavigateToIndexWithDisposition(int index, WindowOpenDisposition disp) { NavigationController& controller = GetOrCloneTabForDisposition(disp)->GetController(); - if (index < 0 || index >= controller.entry_count()) + if (index < 0 || index >= controller.GetEntryCount()) return false; controller.GoToIndex(index); return true; @@ -3374,7 +3374,8 @@ void Browser::TabReplacedAt(TabStripModel* tab_strip_model, TabInsertedAt(new_contents, index, (index == tab_handler_->GetTabStripModel()->active_index())); - int entry_count = new_contents->tab_contents()->GetController().entry_count(); + int entry_count = + new_contents->tab_contents()->GetController().GetEntryCount(); if (entry_count > 0) { // Send out notification so that observers are updated appropriately. new_contents->tab_contents()->GetController().NotifyEntryChanged( diff --git a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc index 1c02b63..fc598b3 100644 --- a/chrome/browser/ui/search_engines/search_engine_tab_helper.cc +++ b/chrome/browser/ui/search_engines/search_engine_tab_helper.cc @@ -99,7 +99,7 @@ void SearchEngineTabHelper::OnPageHasOSDD( if (IsFormSubmit(base_entry)) { // If the current page is a form submit, find the last page that was not // a form submit and use its url to generate the keyword from. - int index = controller.last_committed_entry_index() - 1; + int index = controller.GetLastCommittedEntryIndex() - 1; while (index >= 0 && IsFormSubmit(controller.GetEntryAtIndex(index))) index--; if (index >= 0) @@ -142,7 +142,7 @@ void SearchEngineTabHelper::GenerateKeywordIfNecessary( return; const NavigationController& controller = web_contents()->GetController(); - int last_index = controller.last_committed_entry_index(); + int last_index = controller.GetLastCommittedEntryIndex(); // When there was no previous page, the last index will be 0. This is // normally due to a form submit that opened in a new tab. // TODO(brettw) bug 916126: we should support keywords when form submits diff --git a/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc b/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc index f4138d5..024fc1a 100644 --- a/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc +++ b/chrome/browser/ui/sync/tab_contents_wrapper_synced_tab_delegate.cc @@ -53,12 +53,12 @@ int TabContentsWrapperSyncedTabDelegate::GetCurrentEntryIndex() const { } int TabContentsWrapperSyncedTabDelegate::GetEntryCount() const { - return tab_contents_wrapper_->tab_contents()->GetController().entry_count(); + return tab_contents_wrapper_->tab_contents()->GetController().GetEntryCount(); } int TabContentsWrapperSyncedTabDelegate::GetPendingEntryIndex() const { return tab_contents_wrapper_->tab_contents()->GetController(). - pending_entry_index(); + GetPendingEntryIndex(); } NavigationEntry* TabContentsWrapperSyncedTabDelegate::GetPendingEntry() const { diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc index 093cb92..1a06fa2 100644 --- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc +++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc @@ -291,7 +291,7 @@ int BackForwardMenuModel::GetHistoryItemCount() const { if (model_type_ == FORWARD_MENU) { // Only count items from n+1 to end (if n is current entry) - items = contents->GetController().entry_count() - + items = contents->GetController().GetEntryCount() - contents->GetController().GetCurrentEntryIndex() - 1; } else { items = contents->GetController().GetCurrentEntryIndex(); @@ -335,7 +335,7 @@ int BackForwardMenuModel::GetIndexOfNextChapterStop(int start_from, TabContents* contents = GetTabContents(); NavigationController& controller = contents->GetController(); - int max_count = controller.entry_count(); + int max_count = controller.GetEntryCount(); if (start_from < 0 || start_from >= max_count) return -1; // Out of bounds. @@ -443,7 +443,7 @@ int BackForwardMenuModel::MenuIndexToNavEntryIndex(int index) const { NavigationEntry* BackForwardMenuModel::GetNavigationEntry(int index) const { int controller_index = MenuIndexToNavEntryIndex(index); NavigationController& controller = GetTabContents()->GetController(); - if (controller_index >= 0 && controller_index < controller.entry_count()) + if (controller_index >= 0 && controller_index < controller.GetEntryCount()) return controller.GetEntryAtIndex(controller_index); NOTREACHED(); diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc index 3db97da..6bf2515 100644 --- a/chrome/browser/ui/toolbar/toolbar_model.cc +++ b/chrome/browser/ui/toolbar/toolbar_model.cc @@ -46,7 +46,7 @@ string16 ToolbarModel::GetText() const { NavigationController* navigation_controller = GetNavigationController(); if (navigation_controller) { Profile* profile = - Profile::FromBrowserContext(navigation_controller->browser_context()); + Profile::FromBrowserContext(navigation_controller->GetBrowserContext()); languages = profile->GetPrefs()->GetString(prefs::kAcceptLanguages); NavigationEntry* entry = navigation_controller->GetVisibleEntry(); if (!ShouldDisplayURL()) { diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc index f0a6571..ba38fd0 100644 --- a/chrome/test/base/browser_with_test_window_test.cc +++ b/chrome/test/base/browser_with_test_window_test.cc @@ -93,7 +93,7 @@ void BrowserWithTestWindowTest::CommitPendingLoad( // we need to send the preexisting page ID. We can tell these apart because // renavigations will have a pending_entry_index while new ones won't (they'll // just have a standalong pending_entry that isn't in the list already). - if (controller->pending_entry_index() >= 0) { + if (controller->GetPendingEntryIndex() >= 0) { test_rvh->SendNavigateWithTransition( controller->GetPendingEntry()->GetPageID(), controller->GetPendingEntry()->GetURL(), diff --git a/content/browser/ssl/ssl_manager.cc b/content/browser/ssl/ssl_manager.cc index 577b2d1..2330516 100644 --- a/content/browser/ssl/ssl_manager.cc +++ b/content/browser/ssl/ssl_manager.cc @@ -59,7 +59,7 @@ void SSLManager::NotifySSLInternalStateChanged( NavigationController* controller) { content::NotificationService::current()->Notify( content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, - content::Source<content::BrowserContext>(controller->browser_context()), + content::Source<content::BrowserContext>(controller->GetBrowserContext()), content::NotificationService::NoDetails()); } @@ -121,7 +121,8 @@ SSLManager::SSLManager(NavigationController* controller) content::Source<NavigationController>(controller_)); registrar_.Add( this, content::NOTIFICATION_SSL_INTERNAL_STATE_CHANGED, - content::Source<content::BrowserContext>(controller_->browser_context())); + content::Source<content::BrowserContext>( + controller_->GetBrowserContext())); } SSLManager::~SSLManager() { diff --git a/content/browser/ssl/ssl_policy_backend.cc b/content/browser/ssl/ssl_policy_backend.cc index 56bf076..f44c26c 100644 --- a/content/browser/ssl/ssl_policy_backend.cc +++ b/content/browser/ssl/ssl_policy_backend.cc @@ -9,7 +9,7 @@ #include "content/public/browser/browser_context.h" SSLPolicyBackend::SSLPolicyBackend(NavigationController* controller) - : ssl_host_state_(controller->browser_context()->GetSSLHostState()), + : ssl_host_state_(controller->GetBrowserContext()->GetSSLHostState()), controller_(controller) { DCHECK(controller_); } diff --git a/content/browser/tab_contents/navigation_controller.cc b/content/browser/tab_contents/navigation_controller.cc index c22532b..8b4f48f4 100644 --- a/content/browser/tab_contents/navigation_controller.cc +++ b/content/browser/tab_contents/navigation_controller.cc @@ -148,12 +148,16 @@ NavigationController::~NavigationController() { content::NotificationService::NoDetails()); } +content::BrowserContext* NavigationController::GetBrowserContext() const { + return browser_context_; +} + void NavigationController::Restore( int selected_navigation, bool from_last_session, std::vector<NavigationEntry*>* entries) { // Verify that this controller is unused and that the input is valid. - DCHECK(entry_count() == 0 && !GetPendingEntry()); + DCHECK(GetEntryCount() == 0 && !GetPendingEntry()); DCHECK(selected_navigation >= 0 && selected_navigation < static_cast<int>(entries->size())); @@ -353,6 +357,14 @@ bool NavigationController::CanViewSource() const { is_supported_mime_type && !tab_contents_->GetInterstitialPage(); } +int NavigationController::GetLastCommittedEntryIndex() const { + return last_committed_entry_index_; +} + +int NavigationController::GetEntryCount() const { + return static_cast<int>(entries_.size()); +} + NavigationEntry* NavigationController::GetEntryAtIndex( int index) const { return entries_.at(index).get(); @@ -363,7 +375,7 @@ NavigationEntry* NavigationController::GetEntryAtOffset( int index = (transient_entry_index_ != -1) ? transient_entry_index_ + offset : last_committed_entry_index_ + offset; - if (index < 0 || index >= entry_count()) + if (index < 0 || index >= GetEntryCount()) return NULL; return entries_[index].get(); @@ -454,7 +466,7 @@ void NavigationController::GoToOffset(int offset) { int index = (transient_entry_index_ != -1) ? transient_entry_index_ + offset : last_committed_entry_index_ + offset; - if (index < 0 || index >= entry_count()) + if (index < 0 || index >= GetEntryCount()) return; GoToIndex(index); @@ -545,7 +557,7 @@ bool NavigationController::RendererDidNavigate( // Save the previous state before we clobber it. if (GetLastCommittedEntry()) { details->previous_url = GetLastCommittedEntry()->GetURL(); - details->previous_entry_index = last_committed_entry_index(); + details->previous_entry_index = GetLastCommittedEntryIndex(); } else { details->previous_url = GURL(); details->previous_entry_index = -1; @@ -950,13 +962,13 @@ bool NavigationController::IsURLInPageNavigation(const GURL& url) const { void NavigationController::CopyStateFrom(const NavigationController& source) { // Verify that we look new. - DCHECK(entry_count() == 0 && !GetPendingEntry()); + DCHECK(GetEntryCount() == 0 && !GetPendingEntry()); - if (source.entry_count() == 0) + if (source.GetEntryCount() == 0) return; // Nothing new to do. needs_reload_ = true; - InsertEntriesFrom(source, source.entry_count()); + InsertEntriesFrom(source, source.GetEntryCount()); session_storage_namespace_ = source.session_storage_namespace_->Clone(); @@ -974,11 +986,12 @@ void NavigationController::CopyStateFromAndPrune(NavigationController* source) { int32 minimum_page_id = last_committed ? last_committed->GetPageID() : -1; // This code is intended for use when the last entry is the active entry. - DCHECK((transient_entry_index_ != -1 && - transient_entry_index_ == entry_count() - 1) || - (pending_entry_ && (pending_entry_index_ == -1 || - pending_entry_index_ == entry_count() - 1)) || - (!pending_entry_ && last_committed_entry_index_ == entry_count() - 1)); + DCHECK( + (transient_entry_index_ != -1 && + transient_entry_index_ == GetEntryCount() - 1) || + (pending_entry_ && (pending_entry_index_ == -1 || + pending_entry_index_ == GetEntryCount() - 1)) || + (!pending_entry_ && last_committed_entry_index_ == GetEntryCount() - 1)); // Remove all the entries leaving the active entry. PruneAllButActive(); @@ -988,19 +1001,19 @@ void NavigationController::CopyStateFromAndPrune(NavigationController* source) { int max_source_index = source->pending_entry_index_ != -1 ? source->pending_entry_index_ : source->last_committed_entry_index_; if (max_source_index == -1) - max_source_index = source->entry_count(); + max_source_index = source->GetEntryCount(); else max_source_index++; InsertEntriesFrom(*source, max_source_index); // Adjust indices such that the last entry and pending are at the end now. - last_committed_entry_index_ = entry_count() - 1; + last_committed_entry_index_ = GetEntryCount() - 1; if (pending_entry_index_ != -1) - pending_entry_index_ = entry_count() - 1; + pending_entry_index_ = GetEntryCount() - 1; if (transient_entry_index_ != -1) { // There's a transient entry. In this case we want the last committed to // point to the previous entry. - transient_entry_index_ = entry_count() - 1; + transient_entry_index_ = GetEntryCount() - 1; if (last_committed_entry_index_ != -1) last_committed_entry_index_--; } @@ -1013,14 +1026,14 @@ void NavigationController::CopyStateFromAndPrune(NavigationController* source) { void NavigationController::PruneAllButActive() { if (transient_entry_index_ != -1) { // There is a transient entry. Prune up to it. - DCHECK_EQ(entry_count() - 1, transient_entry_index_); + DCHECK_EQ(GetEntryCount() - 1, transient_entry_index_); entries_.erase(entries_.begin(), entries_.begin() + transient_entry_index_); transient_entry_index_ = 0; last_committed_entry_index_ = -1; pending_entry_index_ = -1; } else if (!pending_entry_) { // There's no pending entry. Leave the last entry (if there is one). - if (!entry_count()) + if (!GetEntryCount()) return; DCHECK(last_committed_entry_index_ >= 0); @@ -1048,8 +1061,17 @@ void NavigationController::PruneAllButActive() { } } +bool NavigationController::NeedsReload() const { + return needs_reload_; +} + +SessionStorageNamespace* + NavigationController::GetSessionStorageNamespace() const { + return session_storage_namespace_; +} + void NavigationController::RemoveEntryAtIndexInternal(int index) { - DCHECK(index < entry_count()); + DCHECK(index < GetEntryCount()); DCHECK(index != last_committed_entry_index_); DiscardNonCommittedEntries(); @@ -1074,6 +1096,10 @@ NavigationEntry* NavigationController::GetPendingEntry() const { return pending_entry_; } +int NavigationController::GetPendingEntryIndex() const { + return pending_entry_index_; +} + void NavigationController::InsertOrReplaceEntry(NavigationEntryImpl* entry, bool replace) { DCHECK(entry->GetTransitionType() != content::PAGE_TRANSITION_AUTO_SUBFRAME); @@ -1238,10 +1264,10 @@ void NavigationController::NotifyEntryChanged(const NavigationEntry* entry, void NavigationController::FinishRestore(int selected_index, bool from_last_session) { - DCHECK(selected_index >= 0 && selected_index < entry_count()); + DCHECK(selected_index >= 0 && selected_index < GetEntryCount()); ConfigureEntriesForRestore(&entries_, from_last_session); - set_max_restored_page_id(static_cast<int32>(entry_count())); + set_max_restored_page_id(static_cast<int32>(GetEntryCount())); last_committed_entry_index_ = selected_index; } @@ -1283,7 +1309,7 @@ NavigationEntry* NavigationController::GetTransientEntry() const { void NavigationController::InsertEntriesFrom( const NavigationController& source, int max_index) { - DCHECK_LE(max_index, source.entry_count()); + DCHECK_LE(max_index, source.GetEntryCount()); size_t insert_index = 0; for (int i = 0; i < max_index; i++) { // When cloning a tab, copy all entries except interstitial pages diff --git a/content/browser/tab_contents/navigation_controller.h b/content/browser/tab_contents/navigation_controller.h index 36a5ef9..e581753 100644 --- a/content/browser/tab_contents/navigation_controller.h +++ b/content/browser/tab_contents/navigation_controller.h @@ -56,9 +56,7 @@ class CONTENT_EXPORT NavigationController { ~NavigationController(); // Returns the browser context for this controller. It can never be NULL. - content::BrowserContext* browser_context() const { - return browser_context_; - } + content::BrowserContext* GetBrowserContext() const; // Sets the browser context for this controller. void set_browser_context(content::BrowserContext* browser_context) { @@ -108,18 +106,14 @@ class CONTENT_EXPORT NavigationController { bool CanViewSource() const; // Returns the index of the last committed entry. - int last_committed_entry_index() const { - return last_committed_entry_index_; - } + int GetLastCommittedEntryIndex() const; // Navigation list ----------------------------------------------------------- // Returns the number of entries in the NavigationController, excluding // the pending entry if there is one, but including the transient entry if // any. - int entry_count() const { - return static_cast<int>(entries_.size()); - } + int GetEntryCount() const; content::NavigationEntry* GetEntryAtIndex(int index) const; @@ -152,9 +146,7 @@ class CONTENT_EXPORT NavigationController { // Returns the index of the pending entry or -1 if the pending entry // corresponds to a new navigation (created via LoadURL). - int pending_entry_index() const { - return pending_entry_index_; - } + int GetPendingEntryIndex() const; // Transient entry ----------------------------------------------------------- @@ -309,7 +301,7 @@ class CONTENT_EXPORT NavigationController { // Returns true if a reload happens when activated (SetActive(true) is // invoked). This is true for session/tab restore and cloned tabs. - bool needs_reload() const { return needs_reload_; } + bool NeedsReload() const; // Sets the max restored page ID this NavigationController has seen, if it // was restored from a previous session. @@ -322,9 +314,7 @@ class CONTENT_EXPORT NavigationController { int32 max_restored_page_id() const { return max_restored_page_id_; } // The session storage namespace that all child render views should use. - SessionStorageNamespace* session_storage_namespace() const { - return session_storage_namespace_; - } + SessionStorageNamespace* GetSessionStorageNamespace() const; // Disables checking for a repost and prompting the user. This is used during // testing. diff --git a/content/browser/tab_contents/navigation_controller_unittest.cc b/content/browser/tab_contents/navigation_controller_unittest.cc index 0870a4a..8bd3805 100644 --- a/content/browser/tab_contents/navigation_controller_unittest.cc +++ b/content/browser/tab_contents/navigation_controller_unittest.cc @@ -80,9 +80,9 @@ class TestWebContentsDelegate : public content::WebContentsDelegate { TEST_F(NavigationControllerTest, Defaults) { EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().GetLastCommittedEntry()); - EXPECT_EQ(controller().pending_entry_index(), -1); - EXPECT_EQ(controller().last_committed_entry_index(), -1); - EXPECT_EQ(controller().entry_count(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), -1); + EXPECT_EQ(controller().GetEntryCount(), 0); EXPECT_FALSE(controller().CanGoBack()); EXPECT_FALSE(controller().CanGoForward()); } @@ -101,9 +101,9 @@ TEST_F(NavigationControllerTest, LoadURL) { EXPECT_EQ(0U, notifications.size()); // The load should now be pending. - EXPECT_EQ(controller().entry_count(), 0); - EXPECT_EQ(controller().last_committed_entry_index(), -1); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 0); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), -1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_FALSE(controller().GetLastCommittedEntry()); EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -118,9 +118,9 @@ TEST_F(NavigationControllerTest, LoadURL) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The load should now be committed. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -132,9 +132,9 @@ TEST_F(NavigationControllerTest, LoadURL) { url2, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); // The load should now be pending. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(controller().GetPendingEntry()); // TODO(darin): maybe this should really be true? @@ -150,9 +150,9 @@ TEST_F(NavigationControllerTest, LoadURL) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The load should now be committed. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -185,9 +185,9 @@ TEST_F(NavigationControllerTest, LoadURL_SamePage) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // We should not have produced a new session history entry. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -215,9 +215,9 @@ TEST_F(NavigationControllerTest, LoadURL_Discarded) { EXPECT_EQ(0U, notifications.size()); // Should not have produced a new session history entry. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -246,8 +246,8 @@ TEST_F(NavigationControllerTest, LoadURL_NoPending) { // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_EQ(1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); + EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(kNewURL, controller().GetActiveEntry()->GetURL()); } @@ -282,8 +282,8 @@ TEST_F(NavigationControllerTest, LoadURL_NewPending) { // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_EQ(1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); + EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(kNewURL, controller().GetActiveEntry()->GetURL()); } @@ -313,8 +313,8 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { // pending. controller().GoBack(); EXPECT_EQ(0U, notifications.size()); - EXPECT_EQ(0, controller().pending_entry_index()); - EXPECT_EQ(1, controller().last_committed_entry_index()); + EXPECT_EQ(0, controller().GetPendingEntryIndex()); + EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); // Before that commits, do a new navigation. const GURL kNewURL("http://foo/see"); @@ -325,8 +325,8 @@ TEST_F(NavigationControllerTest, LoadURL_ExistingPending) { // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_EQ(2, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); + EXPECT_EQ(2, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(kNewURL, controller().GetActiveEntry()->GetURL()); } @@ -358,8 +358,8 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); - EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_EQ(1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); + EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); // Before that commits, a back navigation from the renderer commits. rvh()->SendNavigate(0, kExistingURL1); @@ -368,8 +368,8 @@ TEST_F(NavigationControllerTest, LoadURL_BackPreemptsPending) { // just made should be committed. EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_EQ(0, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); + EXPECT_EQ(0, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(kExistingURL1, controller().GetActiveEntry()->GetURL()); } @@ -394,9 +394,9 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) { kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_TRUE(controller().GetPendingEntry()); - EXPECT_EQ(-1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(1, delegate->navigation_state_change_count()); // Before that commits, a document.write and location.reload can cause the @@ -405,9 +405,9 @@ TEST_F(NavigationControllerTest, LoadURL_IgnorePreemptsPending) { // This should clear the pending entry and notify of a navigation state // change, so that we do not keep displaying kNewURL. - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_FALSE(controller().GetPendingEntry()); - EXPECT_EQ(-1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(2, delegate->navigation_state_change_count()); contents()->SetDelegate(NULL); @@ -432,9 +432,9 @@ TEST_F(NavigationControllerTest, LoadURL_AbortCancelsPending) { kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_TRUE(controller().GetPendingEntry()); - EXPECT_EQ(-1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(1, delegate->navigation_state_change_count()); // It may abort before committing, if it's a download or due to a stop or @@ -452,9 +452,9 @@ TEST_F(NavigationControllerTest, LoadURL_AbortCancelsPending) { // This should clear the pending entry and notify of a navigation state // change, so that we do not keep displaying kNewURL. - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_FALSE(controller().GetPendingEntry()); - EXPECT_EQ(-1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(2, delegate->navigation_state_change_count()); contents()->SetDelegate(NULL); @@ -480,9 +480,9 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) { kNewURL, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_EQ(0U, notifications.size()); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_TRUE(controller().GetPendingEntry()); - EXPECT_EQ(-1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(1, delegate->navigation_state_change_count()); // Now the navigation redirects. @@ -513,9 +513,9 @@ TEST_F(NavigationControllerTest, LoadURL_RedirectAbortCancelsPending) { // This should clear the pending entry and notify of a navigation state // change, so that we do not keep displaying kNewURL. - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_FALSE(controller().GetPendingEntry()); - EXPECT_EQ(-1, controller().last_committed_entry_index()); + EXPECT_EQ(-1, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(2, delegate->navigation_state_change_count()); contents()->SetDelegate(NULL); @@ -538,9 +538,9 @@ TEST_F(NavigationControllerTest, Reload) { EXPECT_EQ(0U, notifications.size()); // The reload is pending. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -551,9 +551,9 @@ TEST_F(NavigationControllerTest, Reload) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now the reload is committed. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -582,9 +582,9 @@ TEST_F(NavigationControllerTest, Reload_GeneratesNewPage) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Now the reload is committed. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -610,9 +610,9 @@ TEST_F(NavigationControllerTest, Back) { EXPECT_EQ(0U, notifications.size()); // We should now have a pending navigation to go back. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -623,9 +623,9 @@ TEST_F(NavigationControllerTest, Back) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The back navigation completed successfully. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -657,9 +657,9 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { EXPECT_EQ(0U, notifications.size()); // We should now have a pending navigation to go back. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_FALSE(controller().CanGoBack()); @@ -671,9 +671,9 @@ TEST_F(NavigationControllerTest, Back_GeneratesNewPage) { // The back navigation resulted in a completely new navigation. // TODO(darin): perhaps this behavior will be confusing to users? - EXPECT_EQ(controller().entry_count(), 3); - EXPECT_EQ(controller().last_committed_entry_index(), 2); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 3); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 2); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -703,13 +703,13 @@ TEST_F(NavigationControllerTest, Back_NewPending) { controller().LoadURL( kUrl3, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_EQ(kUrl3, controller().GetPendingEntry()->GetURL()); controller().GoBack(); // The pending navigation should now be the "back" item and the new one // should be gone. - EXPECT_EQ(0, controller().pending_entry_index()); + EXPECT_EQ(0, controller().GetPendingEntryIndex()); EXPECT_EQ(kUrl1, controller().GetPendingEntry()->GetURL()); } @@ -736,8 +736,8 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { // That second URL should be the last committed and it should have gotten the // new title. EXPECT_EQ(kUrl2, controller().GetEntryWithPageID(site_instance, 1)->GetURL()); - EXPECT_EQ(1, controller().last_committed_entry_index()); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); // Now go forward to the last item again and say it was committed. controller().GoForward(); @@ -745,18 +745,18 @@ TEST_F(NavigationControllerTest, Back_OtherBackPending) { // Now start going back one to the second page. It will be pending. controller().GoBack(); - EXPECT_EQ(1, controller().pending_entry_index()); - EXPECT_EQ(2, controller().last_committed_entry_index()); + EXPECT_EQ(1, controller().GetPendingEntryIndex()); + EXPECT_EQ(2, controller().GetLastCommittedEntryIndex()); // Not synthesize a totally new back event to the first page. This will not // match the pending one. rvh()->SendNavigate(0, kUrl1); // The committed navigation should clear the pending entry. - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); // But the navigated entry should be the last committed. - EXPECT_EQ(0, controller().last_committed_entry_index()); + EXPECT_EQ(0, controller().GetLastCommittedEntryIndex()); EXPECT_EQ(kUrl1, controller().GetLastCommittedEntry()->GetURL()); } @@ -784,9 +784,9 @@ TEST_F(NavigationControllerTest, Forward) { controller().GoForward(); // We should now have a pending navigation to go forward. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), 1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), 1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -797,9 +797,9 @@ TEST_F(NavigationControllerTest, Forward) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // The forward navigation completed successfully. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -831,9 +831,9 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { EXPECT_EQ(0U, notifications.size()); // Should now have a pending navigation to go forward. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 0); - EXPECT_EQ(controller().pending_entry_index(), 1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); + EXPECT_EQ(controller().GetPendingEntryIndex(), 1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -844,9 +844,9 @@ TEST_F(NavigationControllerTest, Forward_GeneratesNewPage) { content::NOTIFICATION_NAV_LIST_PRUNED, content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -876,7 +876,7 @@ TEST_F(NavigationControllerTest, Redirect) { url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(controller().GetPendingEntry()); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); ViewHostMsg_FrameNavigate_Params params; @@ -898,10 +898,10 @@ TEST_F(NavigationControllerTest, Redirect) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE); - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(url2, controller().GetActiveEntry()->GetURL()); @@ -934,7 +934,7 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(controller().GetPendingEntry()); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); ViewHostMsg_FrameNavigate_Params params; @@ -956,10 +956,10 @@ TEST_F(NavigationControllerTest, PostThenRedirect) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_SAME_PAGE); - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(url2, controller().GetActiveEntry()->GetURL()); EXPECT_FALSE(controller().GetActiveEntry()->GetHasPostData()); @@ -981,7 +981,7 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { url1, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); EXPECT_TRUE(controller().GetPendingEntry()); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_EQ(url1, controller().GetActiveEntry()->GetURL()); ViewHostMsg_FrameNavigate_Params params; @@ -1003,10 +1003,10 @@ TEST_F(NavigationControllerTest, ImmediateRedirect) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.type == content::NAVIGATION_TYPE_NEW_PAGE); - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); EXPECT_TRUE(controller().GetLastCommittedEntry()); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_EQ(url2, controller().GetActiveEntry()->GetURL()); @@ -1044,7 +1044,7 @@ TEST_F(NavigationControllerTest, NewSubframe) { EXPECT_FALSE(details.is_main_frame); // The new entry should be appended. - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); // New entry should refer to the new page, but the old URL (entries only // reflect the toplevel URL). @@ -1102,7 +1102,7 @@ TEST_F(NavigationControllerTest, AutoSubframe) { EXPECT_EQ(0U, notifications.size()); // There should still be only one entry. - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); } // Tests navigation and then going back to a subframe navigation. @@ -1132,7 +1132,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); // Second manual subframe navigation should also make a new entry. const GURL url3("http://foo3"); @@ -1141,7 +1141,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(3, controller().entry_count()); + EXPECT_EQ(3, controller().GetEntryCount()); EXPECT_EQ(2, controller().GetCurrentEntryIndex()); // Go back one. @@ -1151,7 +1151,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(3, controller().entry_count()); + EXPECT_EQ(3, controller().GetEntryCount()); EXPECT_EQ(1, controller().GetCurrentEntryIndex()); // Go back one more. @@ -1161,7 +1161,7 @@ TEST_F(NavigationControllerTest, BackSubframe) { EXPECT_TRUE(controller().RendererDidNavigate(params, &details)); EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); - EXPECT_EQ(3, controller().entry_count()); + EXPECT_EQ(3, controller().GetEntryCount()); EXPECT_EQ(0, controller().GetCurrentEntryIndex()); } @@ -1181,9 +1181,9 @@ TEST_F(NavigationControllerTest, LinkClick) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); // Should not have produced a new session history entry. - EXPECT_EQ(controller().entry_count(), 2); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 2); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -1218,7 +1218,7 @@ TEST_F(NavigationControllerTest, InPage) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_FALSE(details.did_replace_entry); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); // Go back one. ViewHostMsg_FrameNavigate_Params back_params(params); @@ -1231,7 +1231,7 @@ TEST_F(NavigationControllerTest, InPage) { // is_in_page is false in that case but should be true. // See comment in AreURLsInPageNavigation() in navigation_controller.cc // EXPECT_TRUE(details.is_in_page); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); EXPECT_EQ(0, controller().GetCurrentEntryIndex()); EXPECT_EQ(back_params.url, controller().GetActiveEntry()->GetURL()); @@ -1244,7 +1244,7 @@ TEST_F(NavigationControllerTest, InPage) { EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); EXPECT_EQ(1, controller().GetCurrentEntryIndex()); EXPECT_EQ(forward_params.url, controller().GetActiveEntry()->GetURL()); @@ -1299,7 +1299,7 @@ TEST_F(NavigationControllerTest, InPage_Replace) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_TRUE(details.did_replace_entry); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); } // Tests for http://crbug.com/40395 @@ -1349,7 +1349,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_TRUE(details.is_in_page); EXPECT_TRUE(details.did_replace_entry); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); } // Perform a client redirect to a new page. @@ -1372,7 +1372,7 @@ TEST_F(NavigationControllerTest, ClientRedirectAfterInPageNavigation) { EXPECT_TRUE(notifications.Check1AndReset( content::NOTIFICATION_NAV_ENTRY_COMMITTED)); EXPECT_FALSE(details.is_in_page); - EXPECT_EQ(3, controller().entry_count()); + EXPECT_EQ(3, controller().GetEntryCount()); } // Verify that BACK brings us back to http://foo2/. @@ -1434,7 +1434,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { rvh()->SendNavigate(url_index, url); } - EXPECT_EQ(controller().entry_count(), kMaxEntryCount); + EXPECT_EQ(controller().GetEntryCount(), kMaxEntryCount); // Created a PrunedListener to observe prune notifications. PrunedListener listener(&controller()); @@ -1452,7 +1452,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { EXPECT_EQ(1, listener.details_.count); // We expect http://www.a.com/0 to be gone. - EXPECT_EQ(controller().entry_count(), kMaxEntryCount); + EXPECT_EQ(controller().GetEntryCount(), kMaxEntryCount); EXPECT_EQ(controller().GetEntryAtIndex(0)->GetURL(), GURL("http:////www.a.com/1")); @@ -1465,7 +1465,7 @@ TEST_F(NavigationControllerTest, EnforceMaxNavigationCount) { rvh()->SendNavigate(url_index, url); url_index++; } - EXPECT_EQ(controller().entry_count(), kMaxEntryCount); + EXPECT_EQ(controller().GetEntryCount(), kMaxEntryCount); EXPECT_EQ(controller().GetEntryAtIndex(0)->GetURL(), GURL("http:////www.a.com/4")); @@ -1503,7 +1503,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { // After navigating, we should have one entry, and it should be "pending". // It should now have a SiteInstance and no restore_type. our_controller.GoToIndex(0); - EXPECT_EQ(1, our_controller.entry_count()); + EXPECT_EQ(1, our_controller.GetEntryCount()); EXPECT_EQ(our_controller.GetEntryAtIndex(0), our_controller.GetPendingEntry()); EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); @@ -1528,8 +1528,8 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { // There should be no longer any pending entry and one committed one. This // means that we were able to locate the entry, assign its site instance, and // commit it properly. - EXPECT_EQ(1, our_controller.entry_count()); - EXPECT_EQ(0, our_controller.last_committed_entry_index()); + EXPECT_EQ(1, our_controller.GetEntryCount()); + EXPECT_EQ(0, our_controller.GetLastCommittedEntryIndex()); EXPECT_FALSE(our_controller.GetPendingEntry()); EXPECT_EQ(url, NavigationEntryImpl::FromNavigationEntry( @@ -1570,7 +1570,7 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { // After navigating, we should have one entry, and it should be "pending". // It should now have a SiteInstance and no restore_type. our_controller.GoToIndex(0); - EXPECT_EQ(1, our_controller.entry_count()); + EXPECT_EQ(1, our_controller.GetEntryCount()); EXPECT_EQ(our_controller.GetEntryAtIndex(0), our_controller.GetPendingEntry()); EXPECT_EQ(0, our_controller.GetEntryAtIndex(0)->GetPageID()); @@ -1608,8 +1608,8 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { our_controller.RendererDidNavigate(params, &details); // There should be no pending entry and one committed one. - EXPECT_EQ(1, our_controller.entry_count()); - EXPECT_EQ(0, our_controller.last_committed_entry_index()); + EXPECT_EQ(1, our_controller.GetEntryCount()); + EXPECT_EQ(0, our_controller.GetLastCommittedEntryIndex()); EXPECT_FALSE(our_controller.GetPendingEntry()); EXPECT_EQ(url, NavigationEntryImpl::FromNavigationEntry( @@ -1671,22 +1671,22 @@ TEST_F(NavigationControllerTest, RemoveEntry) { rvh()->SendNavigate(4, url5); // Try to remove the last entry. Will fail because it is the current entry. - controller().RemoveEntryAtIndex(controller().entry_count() - 1); - EXPECT_EQ(5, controller().entry_count()); - EXPECT_EQ(4, controller().last_committed_entry_index()); + controller().RemoveEntryAtIndex(controller().GetEntryCount() - 1); + EXPECT_EQ(5, controller().GetEntryCount()); + EXPECT_EQ(4, controller().GetLastCommittedEntryIndex()); // Go back and remove the last entry. controller().GoBack(); rvh()->SendNavigate(3, url4); - controller().RemoveEntryAtIndex(controller().entry_count() - 1); - EXPECT_EQ(4, controller().entry_count()); - EXPECT_EQ(3, controller().last_committed_entry_index()); + controller().RemoveEntryAtIndex(controller().GetEntryCount() - 1); + EXPECT_EQ(4, controller().GetEntryCount()); + EXPECT_EQ(3, controller().GetLastCommittedEntryIndex()); EXPECT_FALSE(controller().GetPendingEntry()); // Remove an entry which is not the last committed one. controller().RemoveEntryAtIndex(0); - EXPECT_EQ(3, controller().entry_count()); - EXPECT_EQ(2, controller().last_committed_entry_index()); + EXPECT_EQ(3, controller().GetEntryCount()); + EXPECT_EQ(2, controller().GetLastCommittedEntryIndex()); EXPECT_FALSE(controller().GetPendingEntry()); // Remove the 2 remaining entries. @@ -1694,8 +1694,8 @@ TEST_F(NavigationControllerTest, RemoveEntry) { controller().RemoveEntryAtIndex(0); // This should leave us with only the last committed entry. - EXPECT_EQ(1, controller().entry_count()); - EXPECT_EQ(0, controller().last_committed_entry_index()); + EXPECT_EQ(1, controller().GetEntryCount()); + EXPECT_EQ(0, controller().GetLastCommittedEntryIndex()); } // Tests the transient entry, making sure it goes away with all navigations. @@ -1729,9 +1729,9 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Check our state. EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); - EXPECT_EQ(controller().entry_count(), 3); - EXPECT_EQ(controller().last_committed_entry_index(), 1); - EXPECT_EQ(controller().pending_entry_index(), -1); + EXPECT_EQ(controller().GetEntryCount(), 3); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); + EXPECT_EQ(controller().GetPendingEntryIndex(), -1); EXPECT_TRUE(controller().GetLastCommittedEntry()); EXPECT_FALSE(controller().GetPendingEntry()); EXPECT_TRUE(controller().CanGoBack()); @@ -1745,7 +1745,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // We should have navigated, transient entry should be gone. EXPECT_EQ(url2, controller().GetActiveEntry()->GetURL()); - EXPECT_EQ(controller().entry_count(), 3); + EXPECT_EQ(controller().GetEntryCount(), 3); // Add a transient again, then navigate with no pending entry this time. transient_entry = new NavigationEntryImpl; @@ -1755,7 +1755,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { rvh()->SendNavigate(3, url3); // Transient entry should be gone. EXPECT_EQ(url3, controller().GetActiveEntry()->GetURL()); - EXPECT_EQ(controller().entry_count(), 4); + EXPECT_EQ(controller().GetEntryCount(), 4); // Initiate a navigation, add a transient then commit navigation. controller().LoadURL( @@ -1766,7 +1766,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(transient_url, controller().GetActiveEntry()->GetURL()); rvh()->SendNavigate(4, url4); EXPECT_EQ(url4, controller().GetActiveEntry()->GetURL()); - EXPECT_EQ(controller().entry_count(), 5); + EXPECT_EQ(controller().GetEntryCount(), 5); // Add a transient and go back. This should simply remove the transient. transient_entry = new NavigationEntryImpl; @@ -1778,7 +1778,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { controller().GoBack(); // Transient entry should be gone. EXPECT_EQ(url4, controller().GetActiveEntry()->GetURL()); - EXPECT_EQ(controller().entry_count(), 5); + EXPECT_EQ(controller().GetEntryCount(), 5); rvh()->SendNavigate(3, url3); // Add a transient and go to an entry before the current one. @@ -1822,7 +1822,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { EXPECT_EQ(url3, controller().GetVisibleEntry()->GetURL()); // Ensure the URLS are correct. - EXPECT_EQ(controller().entry_count(), 5); + EXPECT_EQ(controller().GetEntryCount(), 5); EXPECT_EQ(controller().GetEntryAtIndex(0)->GetURL(), url0); EXPECT_EQ(controller().GetEntryAtIndex(1)->GetURL(), url1); EXPECT_EQ(controller().GetEntryAtIndex(2)->GetURL(), url2); @@ -1907,8 +1907,8 @@ TEST_F(NavigationControllerTest, SameSubframe) { rvh()->SendNavigate(0, url); // We should be at the first navigation entry. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); // Navigate a subframe that would normally count as in-page. const GURL subframe("http://www.google.com/#"); @@ -1924,8 +1924,8 @@ TEST_F(NavigationControllerTest, SameSubframe) { EXPECT_FALSE(controller().RendererDidNavigate(params, &details)); // Nothing should have changed. - EXPECT_EQ(controller().entry_count(), 1); - EXPECT_EQ(controller().last_committed_entry_index(), 0); + EXPECT_EQ(controller().GetEntryCount(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 0); } // Make sure that on cloning a tabcontents and going back needs_reload is false. @@ -1938,11 +1938,11 @@ TEST_F(NavigationControllerTest, CloneAndGoBack) { scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); - ASSERT_EQ(2, clone->GetController().entry_count()); - EXPECT_TRUE(clone->GetController().needs_reload()); + ASSERT_EQ(2, clone->GetController().GetEntryCount()); + EXPECT_TRUE(clone->GetController().NeedsReload()); clone->GetController().GoBack(); // Navigating back should have triggered needs_reload_ to go false. - EXPECT_FALSE(clone->GetController().needs_reload()); + EXPECT_FALSE(clone->GetController().NeedsReload()); } // Make sure that cloning a tabcontents doesn't copy interstitials. @@ -1960,7 +1960,7 @@ TEST_F(NavigationControllerTest, CloneOmitsInterstitials) { scoped_ptr<TabContents> clone(controller().tab_contents()->Clone()); - ASSERT_EQ(2, clone->GetController().entry_count()); + ASSERT_EQ(2, clone->GetController().GetEntryCount()); } // Tests a subframe navigation while a toplevel navigation is pending. @@ -2019,7 +2019,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune) { // other_controller should now contain the 3 urls: url1, url2 and url3. - ASSERT_EQ(3, other_controller.entry_count()); + ASSERT_EQ(3, other_controller.GetEntryCount()); ASSERT_EQ(2, other_controller.GetCurrentEntryIndex()); @@ -2046,7 +2046,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune2) { // other_controller should now contain the 1 url: url1. - ASSERT_EQ(1, other_controller.entry_count()); + ASSERT_EQ(1, other_controller.GetEntryCount()); ASSERT_EQ(0, other_controller.GetCurrentEntryIndex()); @@ -2074,7 +2074,7 @@ TEST_F(NavigationControllerTest, CopyStateFromAndPrune3) { // other_controller should now contain 1 entry for url1, and a pending entry // for url3. - ASSERT_EQ(1, other_controller.entry_count()); + ASSERT_EQ(1, other_controller.GetEntryCount()); EXPECT_EQ(0, other_controller.GetCurrentEntryIndex()); @@ -2102,7 +2102,7 @@ TEST_F(NavigationControllerTest, HistoryNavigate) { // Simulate the page calling history.back(), it should not create a pending // entry. contents()->OnGoToEntryAtOffset(-1); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); // The actual cross-navigation is suspended until the current RVH tells us // it unloaded, simulate that. contents()->ProceedWithCrossSiteNavigation(); @@ -2117,7 +2117,7 @@ TEST_F(NavigationControllerTest, HistoryNavigate) { // Now test history.forward() contents()->OnGoToEntryAtOffset(1); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); // The actual cross-navigation is suspended until the current RVH tells us // it unloaded, simulate that. contents()->ProceedWithCrossSiteNavigation(); @@ -2129,7 +2129,7 @@ TEST_F(NavigationControllerTest, HistoryNavigate) { // Make sure an extravagant history.go() doesn't break. contents()->OnGoToEntryAtOffset(120); // Out of bounds. - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); message = process()->sink().GetFirstMessageMatching(ViewMsg_Navigate::ID); EXPECT_TRUE(message == NULL); } @@ -2140,7 +2140,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForSingle) { NavigateAndCommit(url1); controller().PruneAllButActive(); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_EQ(controller().GetEntryAtIndex(0)->GetURL(), url1); } @@ -2159,7 +2159,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForLast) { controller().PruneAllButActive(); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_EQ(controller().GetEntryAtIndex(0)->GetURL(), url1); } @@ -2177,7 +2177,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForIntermediate) { controller().PruneAllButActive(); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_EQ(controller().GetEntryAtIndex(0)->GetURL(), url2); } @@ -2194,7 +2194,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForPending) { controller().PruneAllButActive(); - EXPECT_EQ(0, controller().pending_entry_index()); + EXPECT_EQ(0, controller().GetPendingEntryIndex()); } // Test call to PruneAllButActive for transient entry. @@ -2217,8 +2217,7 @@ TEST_F(NavigationControllerTest, PruneAllButActiveForTransient) { controller().PruneAllButActive(); - EXPECT_EQ(-1, controller().pending_entry_index()); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); EXPECT_EQ(controller().GetTransientEntry()->GetURL(), transient_url); } @@ -2240,10 +2239,10 @@ TEST_F(NavigationControllerTest, StopOnHistoryNavigationToCurrentPage) { contents()->CommitPendingNavigation(); controller().GoForward(); - EXPECT_EQ(1, controller().pending_entry_index()); + EXPECT_EQ(1, controller().GetPendingEntryIndex()); controller().GoBack(); - EXPECT_EQ(-1, controller().pending_entry_index()); + EXPECT_EQ(-1, controller().GetPendingEntryIndex()); } /* TODO(brettw) These test pass on my local machine but fail on the XP buildbot diff --git a/content/browser/tab_contents/render_view_host_manager.cc b/content/browser/tab_contents/render_view_host_manager.cc index 4c4c636..2e64fd0 100644 --- a/content/browser/tab_contents/render_view_host_manager.cc +++ b/content/browser/tab_contents/render_view_host_manager.cc @@ -65,7 +65,7 @@ void RenderViewHostManager::Init(content::BrowserContext* browser_context, site_instance = SiteInstance::CreateSiteInstance(browser_context); render_view_host_ = RenderViewHostFactory::Create( site_instance, render_view_delegate_, routing_id, delegate_-> - GetControllerForRenderManager().session_storage_namespace()); + GetControllerForRenderManager().GetSessionStorageNamespace()); // Keep track of renderer processes as they start to shut down. registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSING, @@ -342,7 +342,7 @@ bool RenderViewHostManager::ShouldSwapProcessesForNavigation( const GURL& current_url = (cur_entry) ? cur_entry->GetURL() : render_view_host_->site_instance()->site(); content::BrowserContext* browser_context = - delegate_->GetControllerForRenderManager().browser_context(); + delegate_->GetControllerForRenderManager().GetBrowserContext(); const content::WebUIFactory* web_ui_factory = content::WebUIFactory::Get(); if (web_ui_factory->UseWebUIForURL(browser_context, current_url)) { // Force swap if it's not an acceptable URL for Web UI. @@ -380,7 +380,7 @@ SiteInstance* RenderViewHostManager::GetSiteInstanceForEntry( const GURL& dest_url = entry.GetURL(); NavigationController& controller = delegate_->GetControllerForRenderManager(); - content::BrowserContext* browser_context = controller.browser_context(); + content::BrowserContext* browser_context = controller.GetBrowserContext(); // If the entry has an instance already we should use it. if (entry.site_instance()) @@ -515,7 +515,7 @@ bool RenderViewHostManager::CreatePendingRenderView( pending_render_view_host_ = RenderViewHostFactory::Create( instance, render_view_delegate_, MSG_ROUTING_NONE, delegate_-> - GetControllerForRenderManager().session_storage_namespace()); + GetControllerForRenderManager().GetSessionStorageNamespace()); // Prevent the process from exiting while we're trying to use it. pending_render_view_host_->process()->AddPendingView(); diff --git a/content/browser/tab_contents/render_view_host_manager_unittest.cc b/content/browser/tab_contents/render_view_host_manager_unittest.cc index 6ad75931..6621154 100644 --- a/content/browser/tab_contents/render_view_host_manager_unittest.cc +++ b/content/browser/tab_contents/render_view_host_manager_unittest.cc @@ -241,7 +241,7 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { int32 new_id = contents()->GetMaxPageIDForSiteInstance( active_rvh()->site_instance()) + 1; pending_rvh()->SendNavigate(new_id, kUrl); - EXPECT_EQ(controller().last_committed_entry_index(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); ASSERT_TRUE(controller().GetLastCommittedEntry()); EXPECT_TRUE(kUrl == controller().GetLastCommittedEntry()->GetURL()); EXPECT_FALSE(controller().GetPendingEntry()); @@ -258,7 +258,7 @@ TEST_F(RenderViewHostManagerTest, AlwaysSendEnableViewSourceMode) { EXPECT_FALSE(pending_rvh()); EXPECT_TRUE(last_rvh == rvh()); rvh()->SendNavigate(new_id, kUrl); // The same page_id returned. - EXPECT_EQ(controller().last_committed_entry_index(), 1); + EXPECT_EQ(controller().GetLastCommittedEntryIndex(), 1); EXPECT_FALSE(controller().GetPendingEntry()); // New message should be sent out to make sure to enter view-source mode. EXPECT_TRUE(process()->sink().GetUniqueMessageMatching( diff --git a/content/browser/tab_contents/tab_contents.cc b/content/browser/tab_contents/tab_contents.cc index eefa3f6..9fec8e9 100644 --- a/content/browser/tab_contents/tab_contents.cc +++ b/content/browser/tab_contents/tab_contents.cc @@ -166,14 +166,14 @@ void MakeNavigateParams(const NavigationEntryImpl& entry, ViewMsg_Navigate_Params* params) { params->page_id = entry.GetPageID(); params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); - params->current_history_list_offset = controller.last_committed_entry_index(); - params->current_history_list_length = controller.entry_count(); + params->current_history_list_offset = controller.GetLastCommittedEntryIndex(); + params->current_history_list_length = controller.GetEntryCount(); params->url = entry.GetURL(); params->referrer = entry.GetReferrer(); params->transition = entry.GetTransitionType(); params->state = entry.GetContentState(); params->navigation_type = - GetNavigationType(controller.browser_context(), entry, reload_type); + GetNavigationType(controller.GetBrowserContext(), entry, reload_type); params->request_time = base::Time::Now(); params->extra_headers = entry.extra_headers(); params->transferred_request_child_id = @@ -361,7 +361,7 @@ const NavigationController& TabContents::GetController() const { } content::BrowserContext* TabContents::GetBrowserContext() const { - return controller_.browser_context(); + return controller_.GetBrowserContext(); } void TabContents::SetViewType(content::ViewType type) { diff --git a/content/browser/tab_contents/tab_contents_unittest.cc b/content/browser/tab_contents/tab_contents_unittest.cc index bd73255..248cc17 100644 --- a/content/browser/tab_contents/tab_contents_unittest.cc +++ b/content/browser/tab_contents/tab_contents_unittest.cc @@ -979,7 +979,7 @@ TEST_F(TabContentsTest, // Navigate to a page. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial controller().LoadURL(GURL("http://www.evil.com"), content::Referrer(), @@ -1016,7 +1016,7 @@ TEST_F(TabContentsTest, entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); } // Test navigating to a page (with the navigation initiated from the renderer, @@ -1027,7 +1027,7 @@ TEST_F(TabContentsTest, // Navigate to a page. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial (no pending entry, the interstitial would have been // triggered by clicking on a link). @@ -1061,7 +1061,7 @@ TEST_F(TabContentsTest, entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); } // Test navigating to a page that shows an interstitial without creating a new @@ -1071,7 +1071,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationDontProceed) { // Navigate to a page. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. TestInterstitialPage::InterstitialState state = @@ -1105,7 +1105,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationDontProceed) { entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); } // Test navigating to a page (with the navigation initiated from the browser, @@ -1116,7 +1116,7 @@ TEST_F(TabContentsTest, // Navigate to a page. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial controller().LoadURL(GURL("http://www.evil.com"), content::Referrer(), @@ -1164,7 +1164,7 @@ TEST_F(TabContentsTest, ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url3); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); } // Test navigating to a page (with the navigation initiated from the renderer, @@ -1175,7 +1175,7 @@ TEST_F(TabContentsTest, // Navigate to a page. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. TestInterstitialPage::InterstitialState state = @@ -1219,7 +1219,7 @@ TEST_F(TabContentsTest, ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url3); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); } // Test navigating to a page that shows an interstitial without creating a new @@ -1229,7 +1229,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationProceed) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. TestInterstitialPage::InterstitialState state = @@ -1266,7 +1266,7 @@ TEST_F(TabContentsTest, ShowInterstitialNoNewNavigationProceed) { ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); } // Test navigating to a page that shows an interstitial, then navigating away. @@ -1295,7 +1295,7 @@ TEST_F(TabContentsTest, ShowInterstitialThenGoBack) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show interstitial. TestInterstitialPage::InterstitialState state = @@ -1328,7 +1328,7 @@ TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenGoBack) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show interstitial. TestInterstitialPage::InterstitialState state = @@ -1366,7 +1366,7 @@ TEST_F(TabContentsTest, ShowInterstitialCrashRendererThenNavigate) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show interstitial. TestInterstitialPage::InterstitialState state = @@ -1412,7 +1412,7 @@ TEST_F(TabContentsTest, ShowInterstitialProceedMultipleCommands) { // Navigate to a page so we have a navigation entry in the controller. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. TestInterstitialPage::InterstitialState state = @@ -1446,7 +1446,7 @@ TEST_F(TabContentsTest, ShowInterstitialOnInterstitial) { // Navigate to a page so we have a navigation entry in the controller. GURL start_url("http://www.google.com"); rvh()->SendNavigate(1, start_url); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. TestInterstitialPage::InterstitialState state1 = @@ -1487,7 +1487,7 @@ TEST_F(TabContentsTest, ShowInterstitialOnInterstitial) { NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == landing_url); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); } // Test showing an interstitial, proceeding and then navigating to another @@ -1496,7 +1496,7 @@ TEST_F(TabContentsTest, ShowInterstitialProceedShowInterstitial) { // Navigate to a page so we have a navigation entry in the controller. GURL start_url("http://www.google.com"); rvh()->SendNavigate(1, start_url); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Show an interstitial. TestInterstitialPage::InterstitialState state1 = @@ -1542,7 +1542,7 @@ TEST_F(TabContentsTest, ShowInterstitialProceedShowInterstitial) { NavigationEntry* entry = controller().GetActiveEntry(); ASSERT_TRUE(entry != NULL); EXPECT_TRUE(entry->GetURL() == landing_url); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); } // Test that navigating away from an interstitial while it's loading cause it @@ -1733,7 +1733,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { // Navigate to a page. GURL url1("http://www.google.com"); rvh()->SendNavigate(1, url1); - EXPECT_EQ(1, controller().entry_count()); + EXPECT_EQ(1, controller().GetEntryCount()); // Initiate a browser navigation that will trigger the interstitial controller().LoadURL(GURL("http://www.evil.com"), content::Referrer(), @@ -1750,7 +1750,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { interstitial->Show(); interstitial->TestDidNavigate(1, url2); EXPECT_TRUE(interstitial->is_showing()); - EXPECT_EQ(2, controller().entry_count()); + EXPECT_EQ(2, controller().GetEntryCount()); // Create another NavigationController. GURL url3("http://foo2"); @@ -1764,7 +1764,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneSourceInterstitial) { other_controller.CopyStateFromAndPrune(&controller()); // The merged controller should only have two entries: url1 and url2. - ASSERT_EQ(2, other_controller.entry_count()); + ASSERT_EQ(2, other_controller.GetEntryCount()); EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->GetURL()); @@ -1800,7 +1800,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneTargetInterstitial) { interstitial->Show(); interstitial->TestDidNavigate(1, url3); EXPECT_TRUE(interstitial->is_showing()); - EXPECT_EQ(2, other_controller.entry_count()); + EXPECT_EQ(2, other_controller.GetEntryCount()); other_contents->ExpectSetHistoryLengthAndPrune( NavigationEntryImpl::FromNavigationEntry( other_controller.GetEntryAtIndex(0))->site_instance(), 1, @@ -1808,7 +1808,7 @@ TEST_F(TabContentsTest, CopyStateFromAndPruneTargetInterstitial) { other_controller.CopyStateFromAndPrune(&controller()); // The merged controller should only have two entries: url1 and url2. - ASSERT_EQ(2, other_controller.entry_count()); + ASSERT_EQ(2, other_controller.GetEntryCount()); EXPECT_EQ(1, other_controller.GetCurrentEntryIndex()); EXPECT_EQ(url1, other_controller.GetEntryAtIndex(0)->GetURL()); EXPECT_EQ(url3, other_controller.GetEntryAtIndex(1)->GetURL()); diff --git a/content/shell/shell.cc b/content/shell/shell.cc index 9c758910..71baa66 100644 --- a/content/shell/shell.cc +++ b/content/shell/shell.cc @@ -99,7 +99,7 @@ void Shell::Stop() { void Shell::UpdateNavigationControls() { int current_index = tab_contents_->GetController().GetCurrentEntryIndex(); - int max_index = tab_contents_->GetController().entry_count() - 1; + int max_index = tab_contents_->GetController().GetEntryCount() - 1; PlatformEnableUIControl(BACK_BUTTON, current_index > 0); PlatformEnableUIControl(FORWARD_BUTTON, current_index < max_index); |