| 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 "base/time.h" | 5 #include "base/time.h" |
| 6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
| 7 #include "chrome/browser/profile.h" | 7 #include "chrome/browser/profile.h" |
| 8 #include "chrome/browser/tab_contents/interstitial_page.h" | 8 #include "chrome/browser/tab_contents/interstitial_page.h" |
| 9 #include "chrome/browser/tab_contents/navigation_entry.h" | 9 #include "chrome/browser/tab_contents/navigation_entry.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 10 #include "chrome/browser/tab_contents/tab_contents.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // Try to navigate to a new page. (to make sure bug 5800 is fixed). | 217 // Try to navigate to a new page. (to make sure bug 5800 is fixed). |
| 218 ui_test_utils::NavigateToURL(browser(), | 218 ui_test_utils::NavigateToURL(browser(), |
| 219 http_server->TestServerPageW(L"files/ssl/google.html")); | 219 http_server->TestServerPageW(L"files/ssl/google.html")); |
| 220 CheckUnauthenticatedState(tab); | 220 CheckUnauthenticatedState(tab); |
| 221 } | 221 } |
| 222 | 222 |
| 223 // Open a page with a HTTPS error in a tab with no prior navigation (through a | 223 // Open a page with a HTTPS error in a tab with no prior navigation (through a |
| 224 // link with a blank target). This is to test that the lack of navigation entry | 224 // link with a blank target). This is to test that the lack of navigation entry |
| 225 // does not cause any problems (it was causing a crasher, see | 225 // does not cause any problems (it was causing a crasher, see |
| 226 // http://crbug.com/19941). | 226 // http://crbug.com/19941). |
| 227 #if !defined(OS_LINUX) || !defined(TOOLKIT_VIEWS) |
| 227 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) { | 228 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorWithNoNavEntry) { |
| 229 #else |
| 230 // TODO(jcampan|oshima): On linux/views, the WaitForLoadStop call |
| 231 // below sometimes waits forever because LOAD_STOP notification can |
| 232 // happen before WaitLorLoadStop is called. Marking this test as Fleaky. |
| 233 // See http://crbug/28098. |
| 234 IN_PROC_BROWSER_TEST_F(SSLUITest, FLAKY_TestHTTPSErrorWithNoNavEntry) { |
| 235 #endif |
| 228 scoped_refptr<HTTPTestServer> http_server = PlainServer(); | 236 scoped_refptr<HTTPTestServer> http_server = PlainServer(); |
| 229 ASSERT_TRUE(http_server.get() != NULL); | 237 ASSERT_TRUE(http_server.get() != NULL); |
| 230 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); | 238 scoped_refptr<HTTPSTestServer> bad_https_server = BadCertServer(); |
| 231 ASSERT_TRUE(bad_https_server.get() != NULL); | 239 ASSERT_TRUE(bad_https_server.get() != NULL); |
| 232 | 240 |
| 233 // Load a page with a link that opens a new window (therefore with no history | 241 // Load a page with a link that opens a new window (therefore with no history |
| 234 // and no navigation entries). | 242 // and no navigation entries). |
| 235 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( | 243 ui_test_utils::NavigateToURL(browser(), http_server->TestServerPageW( |
| 236 L"files/ssl/page_with_blank_target.html")); | 244 L"files/ssl/page_with_blank_target.html")); |
| 237 | 245 |
| 238 bool success = false; | 246 bool success = false; |
| 239 // Simulate clicking the link (and therefore navigating to that new page). | 247 // Simulate clicking the link (and therefore navigating to that new page). |
| 240 // This will causes a new tab to be created. | 248 // This will causes a new tab to be created. |
| 241 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 249 EXPECT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 242 browser()->GetSelectedTabContents()->render_view_host(), L"", | 250 browser()->GetSelectedTabContents()->render_view_host(), L"", |
| 243 L"window.domAutomationController.send(navigateInNewTab());", | 251 L"window.domAutomationController.send(navigateInNewTab());", |
| 244 &success)); | 252 &success)); |
| 245 EXPECT_TRUE(success); | 253 EXPECT_TRUE(success); |
| 246 | 254 |
| 247 // By the time we got a response, the new tab should have been created and be | 255 // By the time we got a response, the new tab should have been created and be |
| 248 // the selected tab. | 256 // the selected tab. |
| 249 EXPECT_EQ(2, browser()->tab_count()); | 257 EXPECT_EQ(2, browser()->tab_count()); |
| 250 EXPECT_EQ(1, browser()->selected_index()); | 258 EXPECT_EQ(1, browser()->selected_index()); |
| 251 | 259 |
| 252 // TODO(jcampan|oshima): Following code waits forever on linux/views | |
| 253 // because LOAD_STOP notification is issued before WaitLorLoadStop | |
| 254 // is called. See http://crbug/28098. | |
| 255 #if !defined(OS_LINUX) || !defined(TOOLKIT_VIEWS) | 260 #if !defined(OS_LINUX) || !defined(TOOLKIT_VIEWS) |
| 256 // Since the navigation was initiated by the renderer (when we clicked on the | 261 // Since the navigation was initiated by the renderer (when we clicked on the |
| 257 // link) and since the main page network request failed, we won't get a | 262 // link) and since the main page network request failed, we won't get a |
| 258 // navigation entry committed. So we'll just wait for the load to stop. | 263 // navigation entry committed. So we'll just wait for the load to stop. |
| 259 ui_test_utils::WaitForLoadStop( | 264 ui_test_utils::WaitForLoadStop( |
| 260 &(browser()->GetSelectedTabContents()->controller())); | 265 &(browser()->GetSelectedTabContents()->controller())); |
| 261 #endif | 266 #endif |
| 262 | 267 |
| 263 // We should have an interstitial page showing. | 268 // We should have an interstitial page showing. |
| 264 ASSERT_TRUE(browser()->GetSelectedTabContents()->interstitial_page()); | 269 ASSERT_TRUE(browser()->GetSelectedTabContents()->interstitial_page()); |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 | 861 |
| 857 // Visit a page over https that contains a frame with a redirect. | 862 // Visit a page over https that contains a frame with a redirect. |
| 858 | 863 |
| 859 // XMLHttpRequest mixed in synchronous mode. | 864 // XMLHttpRequest mixed in synchronous mode. |
| 860 | 865 |
| 861 // XMLHttpRequest mixed in asynchronous mode. | 866 // XMLHttpRequest mixed in asynchronous mode. |
| 862 | 867 |
| 863 // XMLHttpRequest over bad ssl in synchronous mode. | 868 // XMLHttpRequest over bad ssl in synchronous mode. |
| 864 | 869 |
| 865 // XMLHttpRequest over OK ssl in synchronous mode. | 870 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |