| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 private: | 603 private: |
| 604 typedef net::SpawnedTestServer::SSLOptions SSLOptions; | 604 typedef net::SpawnedTestServer::SSLOptions SSLOptions; |
| 605 | 605 |
| 606 DISALLOW_COPY_AND_ASSIGN(SSLUITest); | 606 DISALLOW_COPY_AND_ASSIGN(SSLUITest); |
| 607 }; | 607 }; |
| 608 | 608 |
| 609 class SSLUITestBlock : public SSLUITest { | 609 class SSLUITestBlock : public SSLUITest { |
| 610 public: | 610 public: |
| 611 SSLUITestBlock() : SSLUITest() {} | 611 SSLUITestBlock() : SSLUITest() {} |
| 612 | 612 |
| 613 // Browser will neither run nor display insecure content. | 613 // Browser will not run insecure content. |
| 614 void SetUpCommandLine(base::CommandLine* command_line) override { | 614 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 615 command_line->AppendSwitch(switches::kNoDisplayingInsecureContent); | 615 // By overriding SSLUITest, we won't apply the flag that allows running |
| 616 // insecure content. |
| 616 } | 617 } |
| 617 }; | 618 }; |
| 618 | 619 |
| 619 class SSLUITestIgnoreCertErrors : public SSLUITest { | 620 class SSLUITestIgnoreCertErrors : public SSLUITest { |
| 620 public: | 621 public: |
| 621 SSLUITestIgnoreCertErrors() : SSLUITest() {} | 622 SSLUITestIgnoreCertErrors() : SSLUITest() {} |
| 622 | 623 |
| 623 void SetUpCommandLine(base::CommandLine* command_line) override { | 624 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 624 // Browser will ignore certificate errors. | 625 // Browser will ignore certificate errors. |
| 625 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); | 626 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2337 | 2338 |
| 2338 int img_width; | 2339 int img_width; |
| 2339 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 2340 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
| 2340 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); | 2341 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); |
| 2341 // In order to check that the image was loaded, we check its width. | 2342 // In order to check that the image was loaded, we check its width. |
| 2342 // The actual image (Google logo) is 114 pixels wide, so we assume a good | 2343 // The actual image (Google logo) is 114 pixels wide, so we assume a good |
| 2343 // image is greater than 100. | 2344 // image is greater than 100. |
| 2344 EXPECT_GT(img_width, 100); | 2345 EXPECT_GT(img_width, 100); |
| 2345 } | 2346 } |
| 2346 | 2347 |
| 2347 // Test that when the browser blocks displaying insecure content (images), the | |
| 2348 // indicator shows a secure page, because the blocking made the otherwise | |
| 2349 // unsafe page safe (the notification of this state is handled by other means). | |
| 2350 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureImage) { | |
| 2351 ASSERT_TRUE(embedded_test_server()->Start()); | |
| 2352 ASSERT_TRUE(https_server_.Start()); | |
| 2353 | |
| 2354 std::string replacement_path; | |
| 2355 GetFilePathWithHostAndPortReplacement( | |
| 2356 "/ssl/page_displays_insecure_content.html", | |
| 2357 embedded_test_server()->host_port_pair(), &replacement_path); | |
| 2358 | |
| 2359 ui_test_utils::NavigateToURL(browser(), | |
| 2360 https_server_.GetURL(replacement_path)); | |
| 2361 | |
| 2362 CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(), | |
| 2363 AuthState::NONE); | |
| 2364 } | |
| 2365 | |
| 2366 // Test that when the browser blocks displaying insecure content (iframes), the | 2348 // Test that when the browser blocks displaying insecure content (iframes), the |
| 2367 // indicator shows a secure page, because the blocking made the otherwise | 2349 // indicator shows a secure page, because the blocking made the otherwise |
| 2368 // unsafe page safe (the notification of this state is handled by other means) | 2350 // unsafe page safe (the notification of this state is handled by other means) |
| 2369 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { | 2351 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { |
| 2370 ASSERT_TRUE(embedded_test_server()->Start()); | 2352 ASSERT_TRUE(embedded_test_server()->Start()); |
| 2371 ASSERT_TRUE(https_server_.Start()); | 2353 ASSERT_TRUE(https_server_.Start()); |
| 2372 | 2354 |
| 2373 std::string replacement_path; | 2355 std::string replacement_path; |
| 2374 GetFilePathWithHostAndPortReplacement( | 2356 GetFilePathWithHostAndPortReplacement( |
| 2375 "/ssl/page_displays_insecure_iframe.html", | 2357 "/ssl/page_displays_insecure_iframe.html", |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3016 | 2998 |
| 3017 // Visit a page over https that contains a frame with a redirect. | 2999 // Visit a page over https that contains a frame with a redirect. |
| 3018 | 3000 |
| 3019 // XMLHttpRequest insecure content in synchronous mode. | 3001 // XMLHttpRequest insecure content in synchronous mode. |
| 3020 | 3002 |
| 3021 // XMLHttpRequest insecure content in asynchronous mode. | 3003 // XMLHttpRequest insecure content in asynchronous mode. |
| 3022 | 3004 |
| 3023 // XMLHttpRequest over bad ssl in synchronous mode. | 3005 // XMLHttpRequest over bad ssl in synchronous mode. |
| 3024 | 3006 |
| 3025 // XMLHttpRequest over OK ssl in synchronous mode. | 3007 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |