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

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: 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 | no next file » | 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 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCancelsGuestViewDialogs) {
590 // The data URI is created from
591 // http://datauriconverter.appspot.com/#dataurlmaker using the file
592 // formsubmit.pdf from https://crbug.com/482380.
593 // TODO(wjmaclean): create a simpler PDF test file, one that just issues a
594 // simple alert without expecting input.
595 GURL pdf_with_dialog(
Charlie Reis 2015/05/22 21:56:56 Since we're in chrome/ anyway, it's probably worth
wjmaclean 2015/05/25 17:45:43 Done.
596 "data:application/pdf;base64,"
597 "JVBERi0xLjcNCiWhs8XXDQoxIDAgb2JqDQo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFIg"
598 "L0Fjcm9Gb3JtPDwvRmllbGRzWyA3IDAgUiBdL0RSPDwvRm9udDw8L0hlbHYgOCAwIFIgPj4+"
599 "Pi9EQSgvSGVsdiAwIFRmIDAgZyk+Pi9OYW1lczw8L0phdmFTY3JpcHQgMTMgMCBSID4+Pj4N"
600 "CmVuZG9iag0KNCAwIG9iag0KPDwvVHlwZS9QYWdlL1BhcmVudCAyIDAgUiAvTWVkaWFCb3hb"
601 "IDAgMCA2MTIgNzkyXS9Dcm9wQm94WyAwIDAgNjEyIDc5Ml0vUmVzb3VyY2VzPDw+Pi9Bbm5v"
602 "dHNbIDcgMCBSIF0+Pg0KZW5kb2JqDQo5IDAgb2JqDQo8PC9UeXBlL1hPYmplY3QvU3VidHlw"
603 "ZS9Gb3JtL0Zvcm1UeXBlIDEvTGVuZ3RoIDEyL01hdHJpeFsgMSAwIDAgMSAwIDBdL0JCb3hb"
604 "IDAgMCA1My42MDkzIDE2LjYwODddL0ZpbHRlci9GbGF0ZURlY29kZT4+c3RyZWFtDQp4nCvk"
605 "CuQCAAKSANcNCmVuZHN0cmVhbQ0KZW5kb2JqDQoxNCAwIG9iag0KPDwvTGVuZ3RoIDE1NS9G"
606 "aWx0ZXIvRmxhdGVEZWNvZGU+PnN0cmVhbQ0KeJxNjcsKwjAQRfeC/xCySrAkqSCCpbjSlSBI"
607 "/YCIU1swzZBMCv17Iz4od3UvM+e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iAvSURbPDgxNENGN0UxQzQ3MURENDlFMDJGRDJBOTc5QTU1NTc3PjxDQzQwQzQy"
622 "Mzc5MUVFMTIxRDQ3N0YxRjNBRkVCNUE1Nz5dPj5zdHJlYW0NCnicY2IAgf//mRiBlCAjI5j+"
623 "x8DABBZnYGT6DyTnMPwH06FwcQYmEIMfQsHUMYox/AXR/29jqGNBUbeP4TeIz/gEoo7pGgMD"
624 "AGbYEK8NCmVuZHN0cmVhbQ0KZW5kb2JqDQoNCnN0YXJ0eHJlZg0KMTE1OQ0KJSVFT0YNCg=="
625 );
626 ui_test_utils::NavigateToURL(browser(), pdf_with_dialog);
Charlie Reis 2015/05/22 21:56:56 Does loading a PDF in the main frame have the same
wjmaclean 2015/05/25 17:45:43 Yes, all PDFs use a webview.
627
628 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
629 EXPECT_TRUE(alert->IsValid());
630 AppModalDialogQueue* dialog_queue = AppModalDialogQueue::GetInstance();
631 EXPECT_TRUE(dialog_queue->HasActiveDialog());
632
633 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
634
635 TestInterstitialPage* interstitial =
636 new TestInterstitialPage(contents, false, GURL());
637 content::WaitForInterstitialAttach(contents);
638
639 // The interstitial should have closed the dialog.
640 EXPECT_TRUE(contents->ShowingInterstitialPage());
641 EXPECT_FALSE(dialog_queue->HasActiveDialog());
642
643 interstitial->DontProceed();
644 }
645
589 // Test for crbug.com/22004. Reloading a page with a before unload handler and 646 // 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. 647 // then canceling the dialog should not leave the throbber spinning.
591 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) { 648 IN_PROC_BROWSER_TEST_F(BrowserTest, ReloadThenCancelBeforeUnload) {
592 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML); 649 GURL url(std::string("data:text/html,") + kBeforeUnloadHTML);
593 ui_test_utils::NavigateToURL(browser(), url); 650 ui_test_utils::NavigateToURL(browser(), url);
594 651
595 // Navigate to another page, but click cancel in the dialog. Make sure that 652 // Navigate to another page, but click cancel in the dialog. Make sure that
596 // the throbber stops spinning. 653 // the throbber stops spinning.
597 chrome::Reload(browser(), CURRENT_TAB); 654 chrome::Reload(browser(), CURRENT_TAB);
598 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog(); 655 AppModalDialog* alert = ui_test_utils::WaitForAppModalDialog();
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 #endif 2763 #endif
2707 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2764 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2708 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2765 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2709 gfx::Size exp_final_size(initial_wcv_size); 2766 gfx::Size exp_final_size(initial_wcv_size);
2710 exp_final_size.Enlarge(wcv_resize_insets.width(), 2767 exp_final_size.Enlarge(wcv_resize_insets.width(),
2711 wcv_resize_insets.height() + height_inset); 2768 wcv_resize_insets.height() + height_inset);
2712 EXPECT_EQ(exp_final_size, 2769 EXPECT_EQ(exp_final_size,
2713 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2770 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2714 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); 2771 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size());
2715 } 2772 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698