| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 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   virtual 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: | 
| 92   bool waiting_; | 92   bool waiting_; | 
| 93   bool seen_; | 93   bool seen_; | 
| 94 }; | 94 }; | 
| 95 | 95 | 
| (...skipping 84 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   virtual 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   virtual 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   virtual 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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 729   // as page title. | 729   // as page title. | 
| 730   const base::string16 result = watcher.WaitAndGetTitle(); | 730   const base::string16 result = watcher.WaitAndGetTitle(); | 
| 731   EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); | 731   EXPECT_TRUE(LowerCaseEqualsASCII(result, "pass")); | 
| 732 } | 732 } | 
| 733 | 733 | 
| 734 #if defined(USE_NSS) | 734 #if defined(USE_NSS) | 
| 735 class SSLUITestWithClientCert : public SSLUITest { | 735 class SSLUITestWithClientCert : public SSLUITest { | 
| 736   public: | 736   public: | 
| 737    SSLUITestWithClientCert() : cert_db_(NULL) {} | 737    SSLUITestWithClientCert() : cert_db_(NULL) {} | 
| 738 | 738 | 
| 739    virtual void SetUpOnMainThread() OVERRIDE { | 739    virtual void SetUpOnMainThread() override { | 
| 740      SSLUITest::SetUpOnMainThread(); | 740      SSLUITest::SetUpOnMainThread(); | 
| 741 | 741 | 
| 742      base::RunLoop loop; | 742      base::RunLoop loop; | 
| 743      GetNSSCertDatabaseForProfile( | 743      GetNSSCertDatabaseForProfile( | 
| 744          browser()->profile(), | 744          browser()->profile(), | 
| 745          base::Bind(&SSLUITestWithClientCert::DidGetCertDatabase, | 745          base::Bind(&SSLUITestWithClientCert::DidGetCertDatabase, | 
| 746                     base::Unretained(this), | 746                     base::Unretained(this), | 
| 747                     &loop)); | 747                     &loop)); | 
| 748      loop.Run(); | 748      loop.Run(); | 
| 749    } | 749    } | 
| (...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1878 | 1878 | 
| 1879 // Visit a page over https that contains a frame with a redirect. | 1879 // Visit a page over https that contains a frame with a redirect. | 
| 1880 | 1880 | 
| 1881 // XMLHttpRequest insecure content in synchronous mode. | 1881 // XMLHttpRequest insecure content in synchronous mode. | 
| 1882 | 1882 | 
| 1883 // XMLHttpRequest insecure content in asynchronous mode. | 1883 // XMLHttpRequest insecure content in asynchronous mode. | 
| 1884 | 1884 | 
| 1885 // XMLHttpRequest over bad ssl in synchronous mode. | 1885 // XMLHttpRequest over bad ssl in synchronous mode. | 
| 1886 | 1886 | 
| 1887 // XMLHttpRequest over OK ssl in synchronous mode. | 1887 // XMLHttpRequest over OK ssl in synchronous mode. | 
| OLD | NEW | 
|---|