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

Unified Diff: chrome/browser/printing/print_preview_dialog_controller_browsertest.cc

Issue 17500003: Close web contents modal dialogs on content load start (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bonus patchset: initiator tab -> initiator Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
diff --git a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
index ee17e94951fd49bceaef03650cdf9235e8cb4052..7c791737aca9500c45f53675b0875dcd217ce80e 100644
--- a/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
+++ b/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc
@@ -50,71 +50,69 @@ class PrintPreviewDialogDestroyedObserver
bool dialog_destroyed_;
};
-// Test to verify that when a initiator tab navigates, we can create a new
-// preview dialog for the new tab contents.
+// Test to verify that when a initiator navigates, we can create a new preview
+// dialog for the new tab contents.
IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest,
- NavigateFromInitiatorTab) {
- // Create a reference to initiator tab contents.
- WebContents* initiator_tab =
- browser()->tab_strip_model()->GetActiveWebContents();
- ASSERT_TRUE(initiator_tab);
+ NavigateFromInitiator) {
+ // Create a reference to initiator contents.
+ WebContents* initiator = browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(initiator);
printing::PrintPreviewDialogController* dialog_controller =
printing::PrintPreviewDialogController::GetInstance();
ASSERT_TRUE(dialog_controller);
- // Get the preview dialog for the initiator tab.
+ // Get the preview dialog for the initiator.
printing::PrintViewManager* print_view_manager =
- printing::PrintViewManager::FromWebContents(initiator_tab);
+ printing::PrintViewManager::FromWebContents(initiator);
print_view_manager->PrintPreviewNow(false);
WebContents* preview_dialog =
- dialog_controller->GetOrCreatePreviewDialog(initiator_tab);
+ dialog_controller->GetOrCreatePreviewDialog(initiator);
// Check a new print preview dialog got created.
ASSERT_TRUE(preview_dialog);
- ASSERT_NE(initiator_tab, preview_dialog);
+ ASSERT_NE(initiator, preview_dialog);
- // Navigate in the initiator tab. Make sure navigating destroys the print
- // preview dialog.
+ // Navigate in the initiator. Make sure navigating destroys the print preview
+ // dialog.
PrintPreviewDialogDestroyedObserver observer(preview_dialog);
GURL url(chrome::kChromeUINewTabURL);
ui_test_utils::NavigateToURL(browser(), url);
ASSERT_TRUE(observer.dialog_destroyed());
- // Get the print preview dialog for the initiator tab.
+ // Get the print preview dialog for the initiator.
print_view_manager->PrintPreviewNow(false);
WebContents* new_preview_dialog =
- dialog_controller->GetOrCreatePreviewDialog(initiator_tab);
+ dialog_controller->GetOrCreatePreviewDialog(initiator);
// Check a new preview dialog got created.
EXPECT_TRUE(new_preview_dialog);
}
-// Test to verify that after reloading the initiator tab, it creates a new
-// print preview dialog.
+// Test to verify that after reloading the initiator, it creates a new print
+// preview dialog.
IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest,
- ReloadInitiatorTab) {
- // Create a reference to initiator tab contents.
- WebContents* initiator_tab =
- browser()->tab_strip_model()->GetActiveWebContents();
- ASSERT_TRUE(initiator_tab);
+ ReloadInitiator) {
+ // Create a reference to initiator contents.
+ WebContents* initiator = browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(initiator);
printing::PrintPreviewDialogController* dialog_controller =
printing::PrintPreviewDialogController::GetInstance();
ASSERT_TRUE(dialog_controller);
- // Create a preview dialog for the initiator tab.
+ // Create a preview dialog for the initiator.
printing::PrintViewManager* print_view_manager =
- printing::PrintViewManager::FromWebContents(initiator_tab);
+ printing::PrintViewManager::FromWebContents(initiator);
print_view_manager->PrintPreviewNow(false);
WebContents* preview_dialog =
- dialog_controller->GetOrCreatePreviewDialog(initiator_tab);
+ dialog_controller->GetOrCreatePreviewDialog(initiator);
// Check a new print preview dialog got created.
ASSERT_TRUE(preview_dialog);
- ASSERT_NE(initiator_tab, preview_dialog);
+ ASSERT_NE(initiator, preview_dialog);
- // Reload the initiator tab. Make sure reloading destroys the print preview
+ // Reload the initiator. Make sure reloading destroys the print preview
// dialog.
PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog);
content::WindowedNotificationObserver notification_observer(
@@ -124,10 +122,10 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest,
notification_observer.Wait();
ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed());
- // Create a preview dialog for the initiator tab.
+ // Create a preview dialog for the initiator.
print_view_manager->PrintPreviewNow(false);
WebContents* new_preview_dialog =
- dialog_controller->GetOrCreatePreviewDialog(initiator_tab);
+ dialog_controller->GetOrCreatePreviewDialog(initiator);
EXPECT_TRUE(new_preview_dialog);
}

Powered by Google App Engine
This is Rietveld 408576698