Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1309)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 2167513002: Remove InsecureContentInfobarDelegate, which has been broken for a while (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 ui_test_utils::NavigateToURL(browser(), 599 ui_test_utils::NavigateToURL(browser(),
600 https_server_.GetURL(replacement_path)); 600 https_server_.GetURL(replacement_path));
601 } 601 }
602 602
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 {
610 public:
611 SSLUITestBlock() : SSLUITest() {}
612
613 // Browser will neither run nor display insecure content.
614 void SetUpCommandLine(base::CommandLine* command_line) override {
615 command_line->AppendSwitch(switches::kNoDisplayingInsecureContent);
616 }
617 };
618
619 class SSLUITestIgnoreCertErrors : public SSLUITest { 609 class SSLUITestIgnoreCertErrors : public SSLUITest {
620 public: 610 public:
621 SSLUITestIgnoreCertErrors() : SSLUITest() {} 611 SSLUITestIgnoreCertErrors() : SSLUITest() {}
622 612
623 void SetUpCommandLine(base::CommandLine* command_line) override { 613 void SetUpCommandLine(base::CommandLine* command_line) override {
624 // Browser will ignore certificate errors. 614 // Browser will ignore certificate errors.
625 command_line->AppendSwitch(switches::kIgnoreCertificateErrors); 615 command_line->AppendSwitch(switches::kIgnoreCertificateErrors);
626 } 616 }
627 }; 617 };
628 618
(...skipping 1708 matching lines...) Expand 10 before | Expand all | Expand 10 after
2337 2327
2338 int img_width; 2328 int img_width;
2339 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( 2329 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
2340 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); 2330 tab, "window.domAutomationController.send(ImageWidth());", &img_width));
2341 // In order to check that the image was loaded, we check its width. 2331 // 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 2332 // The actual image (Google logo) is 114 pixels wide, so we assume a good
2343 // image is greater than 100. 2333 // image is greater than 100.
2344 EXPECT_GT(img_width, 100); 2334 EXPECT_GT(img_width, 100);
2345 } 2335 }
2346 2336
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 2337 // Test that when the browser blocks displaying insecure content (iframes), the
2367 // indicator shows a secure page, because the blocking made the otherwise 2338 // 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) 2339 // unsafe page safe (the notification of this state is handled by other means)
2369 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureIframe) { 2340 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBlockDisplayingInsecureIframe) {
felt 2016/07/19 21:46:59 A note for posterity: TestBlockDisplayingInsecureI
2370 ASSERT_TRUE(embedded_test_server()->Start()); 2341 ASSERT_TRUE(embedded_test_server()->Start());
2371 ASSERT_TRUE(https_server_.Start()); 2342 ASSERT_TRUE(https_server_.Start());
2372 2343
2373 std::string replacement_path; 2344 std::string replacement_path;
2374 GetFilePathWithHostAndPortReplacement( 2345 GetFilePathWithHostAndPortReplacement(
2375 "/ssl/page_displays_insecure_iframe.html", 2346 "/ssl/page_displays_insecure_iframe.html",
2376 embedded_test_server()->host_port_pair(), &replacement_path); 2347 embedded_test_server()->host_port_pair(), &replacement_path);
2377 2348
2378 ui_test_utils::NavigateToURL(browser(), 2349 ui_test_utils::NavigateToURL(browser(),
2379 https_server_.GetURL(replacement_path)); 2350 https_server_.GetURL(replacement_path));
2380 2351
2381 CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(), 2352 CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(),
2382 AuthState::NONE); 2353 AuthState::NONE);
2383 } 2354 }
2384 2355
2385 // Test that when the browser blocks running insecure content, the 2356 // Test that when the browser blocks running insecure content, the
2386 // indicator shows a secure page, because the blocking made the otherwise 2357 // indicator shows a secure page, because the blocking made the otherwise
2387 // unsafe page safe (the notification of this state is handled by other means). 2358 // unsafe page safe (the notification of this state is handled by other means).
2388 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockRunningInsecureContent) { 2359 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBlockRunningInsecureContent) {
2389 ASSERT_TRUE(embedded_test_server()->Start()); 2360 ASSERT_TRUE(embedded_test_server()->Start());
2390 ASSERT_TRUE(https_server_.Start()); 2361 ASSERT_TRUE(https_server_.Start());
2391 2362
2392 std::string replacement_path; 2363 std::string replacement_path;
2393 GetFilePathWithHostAndPortReplacement( 2364 GetFilePathWithHostAndPortReplacement(
2394 "/ssl/page_runs_insecure_content.html", 2365 "/ssl/page_runs_insecure_content.html",
2395 embedded_test_server()->host_port_pair(), &replacement_path); 2366 embedded_test_server()->host_port_pair(), &replacement_path);
2396 2367
2397 ui_test_utils::NavigateToURL(browser(), 2368 ui_test_utils::NavigateToURL(browser(),
2398 https_server_.GetURL(replacement_path)); 2369 https_server_.GetURL(replacement_path));
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
3016 2987
3017 // Visit a page over https that contains a frame with a redirect. 2988 // Visit a page over https that contains a frame with a redirect.
3018 2989
3019 // XMLHttpRequest insecure content in synchronous mode. 2990 // XMLHttpRequest insecure content in synchronous mode.
3020 2991
3021 // XMLHttpRequest insecure content in asynchronous mode. 2992 // XMLHttpRequest insecure content in asynchronous mode.
3022 2993
3023 // XMLHttpRequest over bad ssl in synchronous mode. 2994 // XMLHttpRequest over bad ssl in synchronous mode.
3024 2995
3025 // XMLHttpRequest over OK ssl in synchronous mode. 2996 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698