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

Unified Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2299843002: Fix the page's SSL status not being set on restore. (Closed)
Patch Set: add regression test and fix failing tests from initial patch 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/ssl_browser_tests.cc
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index f3e01a6f5ed5ee2fcfe2ed2dff4090fae88a6273..9883a32edb5c8f9be18a1da79632d52fe0a9944a 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -71,6 +71,7 @@
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/content_switches.h"
+#include "content/public/common/page_state.h"
#include "content/public/common/security_style.h"
#include "content/public/common/ssl_status.h"
#include "content/public/test/browser_test_utils.h"
@@ -3125,6 +3126,37 @@ IN_PROC_BROWSER_TEST_F(CertVerifierBrowserTest, MockCertVerifierSmokeTest) {
AuthState::SHOWING_INTERSTITIAL);
}
+IN_PROC_BROWSER_TEST_F(SSLUITest, RestoreHasSSLState) {
+ ASSERT_TRUE(https_server_.Start());
+ GURL url(https_server_.GetURL("/ssl/google.html"));
+ ui_test_utils::NavigateToURL(browser(), url);
+ WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
+ CheckAuthenticatedState(tab, AuthState::NONE);
+
+ NavigationEntry* entry = tab->GetController().GetActiveEntry();
nasko 2016/09/01 01:35:29 GetLastCommittedEntry(). GetActiveEntry is depreca
jam 2016/09/01 02:58:56 Done.
+ std::unique_ptr<NavigationEntry> restored_entry =
+ content::NavigationController::CreateNavigationEntry(
+ url, content::Referrer(), ui::PAGE_TRANSITION_RELOAD, false,
+ std::string(), tab->GetBrowserContext());
+ restored_entry->SetPageID(0);
+ restored_entry->SetPageState(entry->GetPageState());
+
+ WebContents::CreateParams params(tab->GetBrowserContext());
+ WebContents* tab2 = WebContents::Create(params);
+ tab->GetDelegate()->AddNewContents(
+ nullptr, tab2, WindowOpenDisposition::NEW_FOREGROUND_TAB, gfx::Rect(),
+ false, nullptr);
+ std::vector<std::unique_ptr<NavigationEntry>> entries;
+ entries.push_back(std::move(restored_entry));
+ content::TestNavigationObserver observer(tab2);
+ tab2->GetController().Restore(
+ entries.size() - 1,
+ NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries);
+ tab2->GetController().LoadIfNecessary();
+ observer.Wait();
+ CheckAuthenticatedState(tab2, AuthState::NONE);
+}
+
// TODO(jcampan): more tests to do below.
// Visit a page over https that contains a frame with a redirect.

Powered by Google App Engine
This is Rietveld 408576698