Chromium Code Reviews| Index: chrome/browser/dom_ui/print_preview_ui_uitest.cc |
| =================================================================== |
| --- chrome/browser/dom_ui/print_preview_ui_uitest.cc (revision 67834) |
| +++ chrome/browser/dom_ui/print_preview_ui_uitest.cc (working copy) |
| @@ -5,6 +5,7 @@ |
| #include "app/l10n_util.h" |
| #include "base/string16.h" |
| #include "base/utf_string_conversions.h" |
| +#include "chrome/app/chrome_command_ids.h" |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/url_constants.h" |
| #include "chrome/test/automation/browser_proxy.h" |
| @@ -46,4 +47,31 @@ |
| 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. 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); |
| + ASSERT_TRUE(browser->RunCommandAsync(IDC_PRINT)); |
| + |
| + // Make sure there are 2 tabs and print is disabled. |
| + WaitUntilTabCount(2); |
| + // Sometimes the title comes up blank without this sleep. |
| + PlatformThread::Sleep(1000); |
|
Paweł Hajdan Jr.
2010/12/02 09:36:36
This is a no-go. Do you need to wait for some even
Lei Zhang
2010/12/02 18:06:12
I'm already waiting with WaitUntilTabCount() - I s
Paweł Hajdan Jr.
2010/12/02 18:43:32
I think the main problem is that the test doesn't
|
| + scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| + ASSERT_TRUE(tab.get()); |
| + AssertIsPrintPage(tab); |
| + ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); |
| + ASSERT_FALSE(enabled); |
| +} |
| + |
| } // namespace |