| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 : WebContentsObserver(tab), waiting_(false), seen_(false) {} | 71 : WebContentsObserver(tab), waiting_(false), seen_(false) {} |
| 72 | 72 |
| 73 void Wait() { | 73 void Wait() { |
| 74 if (seen_) | 74 if (seen_) |
| 75 return; | 75 return; |
| 76 | 76 |
| 77 waiting_ = true; | 77 waiting_ = true; |
| 78 content::RunMessageLoop(); | 78 content::RunMessageLoop(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual void DidFailProvisionalLoad( | 81 void DidFailProvisionalLoad( |
| 82 content::RenderFrameHost* render_frame_host, | 82 content::RenderFrameHost* render_frame_host, |
| 83 const GURL& validated_url, | 83 const GURL& validated_url, |
| 84 int error_code, | 84 int error_code, |
| 85 const base::string16& error_description) override { | 85 const base::string16& error_description) override { |
| 86 seen_ = true; | 86 seen_ = true; |
| 87 if (waiting_) | 87 if (waiting_) |
| 88 base::MessageLoopForUI::current()->Quit(); | 88 base::MessageLoopForUI::current()->Quit(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 private: | 91 private: |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 https_server_expired_(net::SpawnedTestServer::TYPE_HTTPS, | 180 https_server_expired_(net::SpawnedTestServer::TYPE_HTTPS, |
| 181 SSLOptions(SSLOptions::CERT_EXPIRED), | 181 SSLOptions(SSLOptions::CERT_EXPIRED), |
| 182 base::FilePath(kDocRoot)), | 182 base::FilePath(kDocRoot)), |
| 183 https_server_mismatched_(net::SpawnedTestServer::TYPE_HTTPS, | 183 https_server_mismatched_(net::SpawnedTestServer::TYPE_HTTPS, |
| 184 SSLOptions(SSLOptions::CERT_MISMATCHED_NAME), | 184 SSLOptions(SSLOptions::CERT_MISMATCHED_NAME), |
| 185 base::FilePath(kDocRoot)), | 185 base::FilePath(kDocRoot)), |
| 186 wss_server_expired_(net::SpawnedTestServer::TYPE_WSS, | 186 wss_server_expired_(net::SpawnedTestServer::TYPE_WSS, |
| 187 SSLOptions(SSLOptions::CERT_EXPIRED), | 187 SSLOptions(SSLOptions::CERT_EXPIRED), |
| 188 net::GetWebSocketTestDataDirectory()) {} | 188 net::GetWebSocketTestDataDirectory()) {} |
| 189 | 189 |
| 190 virtual void SetUpCommandLine(CommandLine* command_line) override { | 190 void SetUpCommandLine(CommandLine* command_line) override { |
| 191 // Browser will both run and display insecure content. | 191 // Browser will both run and display insecure content. |
| 192 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); | 192 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); |
| 193 // Use process-per-site so that navigating to a same-site page in a | 193 // Use process-per-site so that navigating to a same-site page in a |
| 194 // new tab will use the same process. | 194 // new tab will use the same process. |
| 195 command_line->AppendSwitch(switches::kProcessPerSite); | 195 command_line->AppendSwitch(switches::kProcessPerSite); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void CheckAuthenticatedState(WebContents* tab, | 198 void CheckAuthenticatedState(WebContents* tab, |
| 199 int expected_authentication_state) { | 199 int expected_authentication_state) { |
| 200 CheckSecurityState(tab, | 200 CheckSecurityState(tab, |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 typedef net::SpawnedTestServer::SSLOptions SSLOptions; | 358 typedef net::SpawnedTestServer::SSLOptions SSLOptions; |
| 359 | 359 |
| 360 DISALLOW_COPY_AND_ASSIGN(SSLUITest); | 360 DISALLOW_COPY_AND_ASSIGN(SSLUITest); |
| 361 }; | 361 }; |
| 362 | 362 |
| 363 class SSLUITestBlock : public SSLUITest { | 363 class SSLUITestBlock : public SSLUITest { |
| 364 public: | 364 public: |
| 365 SSLUITestBlock() : SSLUITest() {} | 365 SSLUITestBlock() : SSLUITest() {} |
| 366 | 366 |
| 367 // Browser will neither run nor display insecure content. | 367 // Browser will neither run nor display insecure content. |
| 368 virtual void SetUpCommandLine(CommandLine* command_line) override { | 368 void SetUpCommandLine(CommandLine* command_line) override { |
| 369 command_line->AppendSwitch(switches::kNoDisplayingInsecureContent); | 369 command_line->AppendSwitch(switches::kNoDisplayingInsecureContent); |
| 370 } | 370 } |
| 371 }; | 371 }; |
| 372 | 372 |
| 373 class SSLUITestIgnoreCertErrors : public SSLUITest { | 373 class SSLUITestIgnoreCertErrors : public SSLUITest { |
| 374 public: | 374 public: |
| 375 SSLUITestIgnoreCertErrors() : SSLUITest() {} | 375 SSLUITestIgnoreCertErrors() : SSLUITest() {} |
| 376 | 376 |
| 377 virtual void SetUpCommandLine(CommandLine* command_line) override { | 377 void SetUpCommandLine(CommandLine* command_line) override { |
| 378 // Browser will ignore certificate errors. | 378 // Browser will ignore certificate errors. |
| 379 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); | 379 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); |
| 380 } | 380 } |
| 381 }; | 381 }; |
| 382 | 382 |
| 383 // Visits a regular page over http. | 383 // Visits a regular page over http. |
| 384 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { | 384 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTP) { |
| 385 ASSERT_TRUE(test_server()->Start()); | 385 ASSERT_TRUE(test_server()->Start()); |
| 386 | 386 |
| 387 ui_test_utils::NavigateToURL(browser(), | 387 ui_test_utils::NavigateToURL(browser(), |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 | 1880 |
| 1881 // Visit a page over https that contains a frame with a redirect. | 1881 // Visit a page over https that contains a frame with a redirect. |
| 1882 | 1882 |
| 1883 // XMLHttpRequest insecure content in synchronous mode. | 1883 // XMLHttpRequest insecure content in synchronous mode. |
| 1884 | 1884 |
| 1885 // XMLHttpRequest insecure content in asynchronous mode. | 1885 // XMLHttpRequest insecure content in asynchronous mode. |
| 1886 | 1886 |
| 1887 // XMLHttpRequest over bad ssl in synchronous mode. | 1887 // XMLHttpRequest over bad ssl in synchronous mode. |
| 1888 | 1888 |
| 1889 // XMLHttpRequest over OK ssl in synchronous mode. | 1889 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |