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

Unified Diff: chrome/browser/ui/webui/print_preview_ui_uitest.cc

Issue 8564044: Revert 110056 - Print Preview: Make print preview tab modal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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/ui/webui/print_preview_ui.cc ('k') | chrome/browser/ui/webui/print_preview_ui_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview_ui_uitest.cc
===================================================================
--- chrome/browser/ui/webui/print_preview_ui_uitest.cc (revision 110058)
+++ chrome/browser/ui/webui/print_preview_ui_uitest.cc (working copy)
@@ -22,48 +22,88 @@
dom_automation_enabled_ = true;
launch_arguments_.AppendSwitch(switches::kEnablePrintPreview);
}
+
+ void AssertIsPrintPage(TabProxy* tab) {
+ std::wstring title;
+ ASSERT_TRUE(tab->GetTabTitle(&title));
+ string16 expected_title =
+ l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_TITLE);
+ ASSERT_EQ(expected_title, WideToUTF16Hack(title));
+ }
};
-TEST_F(PrintPreviewUITest, PrintCommands) {
+// TODO(thestig) Remove this test in the future if loading
+// chrome::kChromeUIPrintURL directly does not make sense.
+TEST_F(PrintPreviewUITest, LoadPrintPreviewByURL) {
scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
ASSERT_TRUE(browser.get());
+ scoped_refptr<TabProxy> tab = browser->GetActiveTab();
+ ASSERT_TRUE(tab.get());
+
+ // Go to the print preview tab via URL.
+ NavigateToURL(GURL(chrome::kChromeUIPrintURL));
+ AssertIsPrintPage(tab);
+}
+
+TEST_F(PrintPreviewUITest, PrintCommandDisabled) {
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+
// Go to the about:blank page.
NavigateToURL(GURL(chrome::kAboutBlankURL));
- // Make sure there is 1 tab and print is enabled.
+ // Make sure there is 1 tab and print is enabled. Create print preview tab.
int tab_count;
ASSERT_TRUE(browser->GetTabCount(&tab_count));
ASSERT_EQ(1, tab_count);
-
- bool enabled = false;
+ bool enabled;
ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled));
ASSERT_TRUE(enabled);
-
- // Make sure advanced print command (Ctrl+Shift+p) is enabled.
- enabled = false;
- ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_ADVANCED_PRINT, &enabled));
- ASSERT_TRUE(enabled);
-
- // Create print preview tab.
ASSERT_TRUE(browser->RunCommand(IDC_PRINT));
- // Make sure print is disabled.
+ // Make sure there are 2 tabs and print is disabled.
+ ASSERT_TRUE(browser->GetTabCount(&tab_count));
+ ASSERT_EQ(2, tab_count);
+ scoped_refptr<TabProxy> tab = browser->GetActiveTab();
+ ASSERT_TRUE(tab.get());
+ AssertIsPrintPage(tab);
ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled));
ASSERT_FALSE(enabled);
+}
+TEST_F(PrintPreviewUITest, AdvancedPrintCommandEnabled) {
+ scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
+ ASSERT_TRUE(browser.get());
+
+ // Go to the about:blank page.
+ NavigateToURL(GURL(chrome::kAboutBlankURL));
+
+ // Make sure there is 1 tab and print is enabled. Create print preview tab.
+ int tab_count;
+ ASSERT_TRUE(browser->GetTabCount(&tab_count));
+ ASSERT_EQ(1, tab_count);
+ bool enabled;
+ ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled));
+ ASSERT_TRUE(enabled);
+
// Make sure advanced print command (Ctrl+Shift+p) is enabled.
enabled = false;
ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_ADVANCED_PRINT, &enabled));
ASSERT_TRUE(enabled);
- ASSERT_TRUE(browser->RunCommand(IDC_RELOAD));
+ ASSERT_TRUE(browser->RunCommand(IDC_PRINT));
- enabled = false;
+ // Make sure there are 2 tabs and print is disabled.
+ ASSERT_TRUE(browser->GetTabCount(&tab_count));
+ ASSERT_EQ(2, tab_count);
+ scoped_refptr<TabProxy> tab = browser->GetActiveTab();
+ ASSERT_TRUE(tab.get());
+ AssertIsPrintPage(tab);
ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled));
- ASSERT_TRUE(enabled);
+ ASSERT_FALSE(enabled);
- // Make sure advanced print command (Ctrl+Shift+p) is enabled.
+ // Make sure advanced print command (Ctrl+Shift+p) is enabled on preview tab.
enabled = false;
ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_ADVANCED_PRINT, &enabled));
ASSERT_TRUE(enabled);
« no previous file with comments | « chrome/browser/ui/webui/print_preview_ui.cc ('k') | chrome/browser/ui/webui/print_preview_ui_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698