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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 1156663004: Test for cancelling PDF modal dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use separate PDF test file, add comments. Created 5 years, 7 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 | « no previous file | chrome/test/data/pdf/alert_dialog.pdf » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT); 579 content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
580 child_process->Shutdown(0, false); 580 child_process->Shutdown(0, false);
581 crash_observer.Wait(); 581 crash_observer.Wait();
582 EXPECT_FALSE(dialog_queue->HasActiveDialog()); 582 EXPECT_FALSE(dialog_queue->HasActiveDialog());
583 583
584 // Make sure subsequent navigations work. 584 // Make sure subsequent navigations work.
585 GURL url2("data:text/html,foo"); 585 GURL url2("data:text/html,foo");
586 ui_test_utils::NavigateToURL(browser(), url2); 586 ui_test_utils::NavigateToURL(browser(), url2);
587 } 587 }
588 588
589 // Make sure modal dialogs within a guestview are closed when an interstitial
590 // page is showing. crbug.com/482380
591 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCancelsGuestViewDialogs) {
592 ASSERT_TRUE(test_server()->Start());
593 GURL pdf_with_dialog(test_server()->GetURL("files/pdf/alert_dialog.pdf"));
594 ui_test_utils::NavigateToURL(browser(), pdf_with_dialog);
595
596 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
597 EXPECT_TRUE(alert->IsValid());
598 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
599 EXPECT_TRUE(dialog_queue->HasActiveDialog());
600
601 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
602
603 TestInterstitialPage* interstitial =
604 new TestInterstitialPage(contents, false, GURL());
605 content::WaitForInterstitialAttach(contents);
606
607 // The interstitial should have closed the dialog.
608 EXPECT_TRUE(contents->ShowingInterstitialPage());
609 EXPECT_FALSE(dialog_queue->HasActiveDialog());
610
611 interstitial->DontProceed();
612 }
613
589 // Test for crbug.com/22004. Reloading a page with a before unload handler and 614 // Test for crbug.com/22004. Reloading a page with a before unload handler and
590 // then canceling the dialog should not leave the throbber spinning. 615 // then canceling the dialog should not leave the throbber spinning.
591 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { 616 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
592 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); 617 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML);
593 ui_test_utils::NavigateToURL(browser(), url); 618 ui_test_utils::NavigateToURL(browser(), url);
594 619
595 // Navigate to another page, but click cancel in the dialog. Make sure that 620 // Navigate to another page, but click cancel in the dialog. Make sure that
596 // the throbber stops spinning. 621 // the throbber stops spinning.
597 chrome::Reload(browser(), CURRENT_TAB); 622 chrome::Reload(browser(), CURRENT_TAB);
598 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 623 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 #endif 2731 #endif
2707 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2732 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2708 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2733 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2709 gfx::Size exp_final_size(initial_wcv_size); 2734 gfx::Size exp_final_size(initial_wcv_size);
2710 exp_final_size.Enlarge(wcv_resize_insets.width(), 2735 exp_final_size.Enlarge(wcv_resize_insets.width(),
2711 wcv_resize_insets.height() + height_inset); 2736 wcv_resize_insets.height() + height_inset);
2712 EXPECT_EQ(exp_final_size, 2737 EXPECT_EQ(exp_final_size,
2713 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2738 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2714 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2739 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2715 } 2740 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/pdf/alert_dialog.pdf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698