| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 #include "chrome/browser/profile.h" | 6 #include "chrome/browser/profile.h" |
| 7 #include "chrome/browser/tab_contents/interstitial_page.h" | 7 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 8 #include "chrome/browser/tab_contents/navigation_entry.h" | 8 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 9 #include "chrome/browser/tab_contents/tab_contents.h" | 9 #include "chrome/browser/tab_contents/tab_contents.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 169 |
| 170 // We should be back to the original good page. | 170 // We should be back to the original good page. |
| 171 CheckAuthenticatedState(tab, false, false); | 171 CheckAuthenticatedState(tab, false, false); |
| 172 | 172 |
| 173 // Try to navigate to a new page. (to make sure bug 5800 is fixed). | 173 // Try to navigate to a new page. (to make sure bug 5800 is fixed). |
| 174 ui_test_utils::NavigateToURL(browser(), | 174 ui_test_utils::NavigateToURL(browser(), |
| 175 http_server->TestServerPageW(L"files/ssl/google.html")); | 175 http_server->TestServerPageW(L"files/ssl/google.html")); |
| 176 CheckUnauthenticatedState(tab); | 176 CheckUnauthenticatedState(tab); |
| 177 } | 177 } |
| 178 | 178 |
| 179 // Open a page with a HTTPS error in a tab with no prior navigation (through a |
| 180 // link with a blank target). This is to test that the lack of navigation entry |
| 181 // does not cause any problems (it was causing a crasher, see |
| 182 // http://crbug.com/19941). |
| 183 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) { |
| 184 scoped_refptr<HTTPTestServer> http_server = PlainServer(); |
| 185 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); |
| 186 |
| 187 // Load a page with a link that opens a new window (therefore with no history |
| 188 // and no navigation entries). |
| 189 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( |
| 190 L"files/ssl/page_with_blank_target.html")); |
| 191 |
| 192 bool success = false; |
| 193 // Simulate clicking the link (and therefore navigating to that new page). |
| 194 // This will causes a new tab to be created. |
| 195 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 196 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| 197 L"window.domAutomationController.send(navigateInNewTab());", |
| 198 &success)); |
| 199 EXPECT_TRUE(success); |
| 200 |
| 201 // By the time we got a response, the new tab should have been created and be |
| 202 // the selected tab. |
| 203 EXPECT_EQ(2, browser()->tab_count()); |
| 204 EXPECT_EQ(1, browser()->selected_index()); |
| 205 |
| 206 // Since the navigation was initiated by the renderer (when we clicked on the |
| 207 // link) and since the main page network request failed, we won't get a |
| 208 // navigation entry committed. So we'll just wait for the load to stop. |
| 209 ui_test_utils::WaitForLoadStop( |
| 210 &(browser()->GetSelectedTabContents()->controller())); |
| 211 |
| 212 // We should have an interstitial page showing. |
| 213 ASSERT_TRUE(browser()->GetSelectedTabContents()->interstitial_page()); |
| 214 } |
| 215 |
| 179 // | 216 // |
| 180 // Mixed contents | 217 // Mixed contents |
| 181 // | 218 // |
| 182 | 219 |
| 183 // Visits a page with mixed content. | 220 // Visits a page with mixed content. |
| 184 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContents) { | 221 IN_PROC_BROWSER_TEST_F(SSLUITest, TestMixedContents) { |
| 185 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); | 222 scoped_refptr<HTTPSTestServer> https_server = GoodCertServer(); |
| 186 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 223 scoped_refptr<HTTPTestServer> http_server = PlainServer(); |
| 187 | 224 |
| 188 // Load a page with mixed-content, the default behavior is to show the mixed | 225 // Load a page with mixed-content, the default behavior is to show the mixed |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 | 758 |
| 722 // Visit a page over https that contains a frame with a redirect. | 759 // Visit a page over https that contains a frame with a redirect. |
| 723 | 760 |
| 724 // XMLHttpRequest mixed in synchronous mode. | 761 // XMLHttpRequest mixed in synchronous mode. |
| 725 | 762 |
| 726 // XMLHttpRequest mixed in asynchronous mode. | 763 // XMLHttpRequest mixed in asynchronous mode. |
| 727 | 764 |
| 728 // XMLHttpRequest over bad ssl in synchronous mode. | 765 // XMLHttpRequest over bad ssl in synchronous mode. |
| 729 | 766 |
| 730 // XMLHttpRequest over OK ssl in synchronous mode. | 767 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |