summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ssl
diff options
context:
space:
mode:
authorcreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 19:19:10 +0000
committercreis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-11 19:19:10 +0000
commit25396dab596e7e47262a8a9569c7570d72b1a5ea (patch)
tree47dc52b0a84bb59f78b163142fa86df9e77aaaee /chrome/browser/ssl
parent905e1d172dc2055a813b6cd30099ad747b8fe20b (diff)
downloadchromium_src-25396dab596e7e47262a8a9569c7570d72b1a5ea.zip
chromium_src-25396dab596e7e47262a8a9569c7570d72b1a5ea.tar.gz
chromium_src-25396dab596e7e47262a8a9569c7570d72b1a5ea.tar.bz2
Fixes navigation issues with interstitial pages.
Updates NavigationController so that the back and forward menus can be used while an interstitial page is showing. Also fixes tab cloning while an interstitial page is showing, so that the cloned tab does not have the interstitial navigation entry. BUG=37215 BUG=37894 TEST=SSLUITest.TestHTTPSExpiredCertAndGo{Back,Forward} TEST=NavigationControllerTest.CloneOmitsInterstitials Review URL: http://codereview.chromium.org/861001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ssl')
-rw-r--r--chrome/browser/ssl/ssl_browser_tests.cc71
1 files changed, 71 insertions, 0 deletions
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index bdaeb61..c21b481 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -220,6 +220,77 @@ IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndDontProceed) {
CheckUnauthenticatedState(tab);
}
+// Visits a page with https error and then goes back using GoToOffset.
+IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoBack) {
+ scoped_refptr<HTTPTestServer> http_server = PlainServer();
+ ASSERT_TRUE(http_server.get() != NULL);
+ scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
+ ASSERT_TRUE(bad_https_server.get() != NULL);
+
+ // First navigate to an HTTP page.
+ ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW(
+ L"files/ssl/google.html"));
+ TabContents* tab = browser()->GetSelectedTabContents();
+ NavigationEntry* entry = tab->controller().GetActiveEntry();
+ ASSERT_TRUE(entry);
+
+ // Now go to a bad HTTPS page that shows an interstitial.
+ ui_test_utils::NavigateToURL(browser(),
+ bad_https_server->TestServerPageW(L"files/ssl/google.html"));
+ CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
+ true); // Interstitial showing
+
+ // Simulate user clicking and holding on back button (crbug.com/37215).
+ tab->controller().GoToOffset(-1);
+
+ // We should be back at the original good page.
+ EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page());
+ CheckUnauthenticatedState(tab);
+}
+
+// Visits a page with https error and then goes forward using GoToOffset.
+IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndGoForward) {
+ scoped_refptr<HTTPTestServer> http_server = PlainServer();
+ ASSERT_TRUE(http_server.get() != NULL);
+ scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer();
+ ASSERT_TRUE(bad_https_server.get() != NULL);
+
+ // First navigate to two HTTP pages.
+ ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW(
+ L"files/ssl/google.html"));
+ TabContents* tab = browser()->GetSelectedTabContents();
+ NavigationEntry* entry1 = tab->controller().GetActiveEntry();
+ ASSERT_TRUE(entry1);
+ ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW(
+ L"files/ssl/blank_page.html"));
+ NavigationEntry* entry2 = tab->controller().GetActiveEntry();
+ ASSERT_TRUE(entry2);
+
+ // Now go back so that a page is in the forward history.
+ tab->controller().GoBack();
+ ui_test_utils::WaitForNavigation(&(tab->controller()));
+ ASSERT_TRUE(tab->controller().CanGoForward());
+ NavigationEntry* entry3 = tab->controller().GetActiveEntry();
+ ASSERT_TRUE(entry1 == entry3);
+
+ // Now go to a bad HTTPS page that shows an interstitial.
+ ui_test_utils::NavigateToURL(browser(),
+ bad_https_server->TestServerPageW(L"files/ssl/google.html"));
+ CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID,
+ true); // Interstitial showing
+
+ // Simulate user clicking and holding on forward button.
+ tab->controller().GoToOffset(1);
+ ui_test_utils::WaitForNavigation(&(tab->controller()));
+
+ // We should be showing the second good page.
+ EXPECT_FALSE(browser()->GetSelectedTabContents()->interstitial_page());
+ CheckUnauthenticatedState(tab);
+ EXPECT_FALSE(tab->controller().CanGoForward());
+ NavigationEntry* entry4 = tab->controller().GetActiveEntry();
+ EXPECT_TRUE(entry2 == entry4);
+}
+
// Open a page with a HTTPS error in a tab with no prior navigation (through a
// link with a blank target). This is to test that the lack of navigation entry
// does not cause any problems (it was causing a crasher, see