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

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

Issue 7056070: PrintPreview: Preview generation should not block print button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 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
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | chrome/browser/resources/print_preview.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/printing/print_preview_tab_controller_unittest.cc
diff --git a/chrome/browser/printing/print_preview_tab_controller_unittest.cc b/chrome/browser/printing/print_preview_tab_controller_unittest.cc
index 76f6a08e35677870d1eab28e68f7b6a195181bc5..98d316ab80624a7735746117dc576eb4537ff374 100644
--- a/chrome/browser/printing/print_preview_tab_controller_unittest.cc
+++ b/chrome/browser/printing/print_preview_tab_controller_unittest.cc
@@ -111,3 +111,45 @@ TEST_F(PrintPreviewTabControllerTest, MultiplePreviewTabs) {
tab_controller->GetOrCreatePreviewTab(tab_contents_1);
EXPECT_EQ(preview_tab_1_index, browser()->active_index());
}
+
+// Clear the initiator tab details associated with preview tab.
+TEST_F(PrintPreviewTabControllerTest, ClearInitiatorTabDetails) {
+ ASSERT_TRUE(browser());
+ BrowserList::SetLastActive(browser());
+ ASSERT_TRUE(BrowserList::GetLastActive());
+
+ // Lets start with one window with one tab.
+ EXPECT_EQ(1u, BrowserList::size());
+ EXPECT_EQ(0, browser()->tab_count());
+ browser()->NewTab();
+ EXPECT_EQ(1, browser()->tab_count());
+
+ // Create a reference to initiator tab contents.
+ TabContents* initiator_tab = browser()->GetSelectedTabContents();
+
+ scoped_refptr<printing::PrintPreviewTabController>
+ tab_controller(new printing::PrintPreviewTabController());
+ ASSERT_TRUE(tab_controller);
+
+ // Get the preview tab for initiator tab.
+ TabContents* preview_tab =
+ tab_controller->GetOrCreatePreviewTab(initiator_tab);
+
+ // New print preview tab is created. Current focus is on preview tab.
+ EXPECT_EQ(2, browser()->tab_count());
+ EXPECT_NE(initiator_tab, preview_tab);
+
+ // Clear the initiator tab details associated with the preview tab.
+ tab_controller->EraseInitiatorTabInfo(preview_tab);
+
+ // Activate initiator_tab.
+ initiator_tab->Activate();
+
+ // Get the print preview tab for initiator tab.
+ TabContents* new_preview_tab =
+ tab_controller->GetOrCreatePreviewTab(initiator_tab);
+
+ // New preview tab is created.
+ EXPECT_EQ(3, browser()->tab_count());
+ EXPECT_NE(new_preview_tab, preview_tab);
+}
« no previous file with comments | « chrome/browser/printing/print_preview_tab_controller.cc ('k') | chrome/browser/resources/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698