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

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

Issue 7826036: Don't crash if DontProceed is chosen on the SSL interstitial page after Proceed is chosen. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a browser test Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/tabs/tab_strip_model.h" 8 #include "chrome/browser/tabs/tab_strip_model.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_navigator.h" 10 #include "chrome/browser/ui/browser_navigator.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
12 #include "chrome/common/chrome_notification_types.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/browser/renderer_host/render_view_host.h" 16 #include "content/browser/renderer_host/render_view_host.h"
16 #include "content/browser/tab_contents/interstitial_page.h" 17 #include "content/browser/tab_contents/interstitial_page.h"
17 #include "content/browser/tab_contents/navigation_entry.h" 18 #include "content/browser/tab_contents/navigation_entry.h"
18 #include "content/browser/tab_contents/tab_contents.h" 19 #include "content/browser/tab_contents/tab_contents.h"
19 #include "content/common/notification_service.h" 20 #include "content/common/notification_service.h"
20 #include "net/base/cert_status_flags.h" 21 #include "net/base/cert_status_flags.h"
21 #include "net/test/test_server.h" 22 #include "net/test/test_server.h"
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED); 469 browser()->AddSelectedTabWithURL(url, PageTransition::TYPED);
469 ui_test_utils::WaitForLoadStop(tab2->tab_contents()); 470 ui_test_utils::WaitForLoadStop(tab2->tab_contents());
470 471
471 // Verify our assumption that there was no prior navigation. 472 // Verify our assumption that there was no prior navigation.
472 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK)); 473 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_BACK));
473 474
474 // We should have an interstitial page showing. 475 // We should have an interstitial page showing.
475 ASSERT_TRUE(tab2->tab_contents()->interstitial_page()); 476 ASSERT_TRUE(tab2->tab_contents()->interstitial_page());
476 } 477 }
477 478
479 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) {
480 ASSERT_TRUE(test_server()->Start());
481 ASSERT_TRUE(https_server_expired_.Start());
482 GURL url_non_dangerous = test_server()->GetURL("");
483 GURL url_dangerous = https_server_expired_.GetURL(
484 "files/downloads/dangerous/dangerous.exe");
485
486 // Visit a non-dangerous page.
487 ui_test_utils::NavigateToURL(browser(), url_non_dangerous);
488
489 // Now, start a transition to dangerous download.
490 {
491 ui_test_utils::WindowedNotificationObserver observer(
492 content::NOTIFICATION_LOAD_STOP, NotificationService::AllSources());
493 browser::NavigateParams navigate_params(browser(), url_dangerous,
494 PageTransition::TYPED);
495 browser::Navigate(&navigate_params);
496 observer.Wait();
497 }
498
499 // Proceed through the SSL interstitial. This doesn't use
500 // |ProceedThroughInterstitial| since no page load will commit.
501 TabContents* tab = browser()->GetSelectedTabContents();
502 ASSERT_TRUE(tab != NULL);
503 ASSERT_TRUE(tab->interstitial_page() != NULL);
504 {
505 ui_test_utils::WindowedNotificationObserver observer(
506 chrome::NOTIFICATION_DOWNLOAD_INITIATED,
507 NotificationService::AllSources());
508 tab->interstitial_page()->Proceed();
509 observer.Wait();
510 }
511
512 // There should still be an interstitial at this point. Press the
513 // back button on the browser. Note that this doesn't wait for a
514 // NAV_ENTRY_COMMITTED notification because going back with an
515 // active interstitial simply hides the interstitial.
516 ASSERT_TRUE(tab->interstitial_page() != NULL);
517 EXPECT_TRUE(browser()->CanGoBack());
518 browser()->GoBack(CURRENT_TAB);
519 }
520
478 // 521 //
479 // Insecure content 522 // Insecure content
480 // 523 //
481 524
482 // Visits a page that displays insecure content. 525 // Visits a page that displays insecure content.
483 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) { 526 IN_PROC_BROWSER_TEST_F(SSLUITest, TestDisplaysInsecureContent) {
484 ASSERT_TRUE(test_server()->Start()); 527 ASSERT_TRUE(test_server()->Start());
485 ASSERT_TRUE(https_server_.Start()); 528 ASSERT_TRUE(https_server_.Start());
486 529
487 std::string replacement_path; 530 std::string replacement_path;
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 1283
1241 // Visit a page over https that contains a frame with a redirect. 1284 // Visit a page over https that contains a frame with a redirect.
1242 1285
1243 // XMLHttpRequest insecure content in synchronous mode. 1286 // XMLHttpRequest insecure content in synchronous mode.
1244 1287
1245 // XMLHttpRequest insecure content in asynchronous mode. 1288 // XMLHttpRequest insecure content in asynchronous mode.
1246 1289
1247 // XMLHttpRequest over bad ssl in synchronous mode. 1290 // XMLHttpRequest over bad ssl in synchronous mode.
1248 1291
1249 // XMLHttpRequest over OK ssl in synchronous mode. 1292 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« chrome/browser/ssl/ssl_blocking_page.cc ('K') | « chrome/browser/ssl/ssl_blocking_page.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698