| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/string16.h" | 5 #include "base/string16.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 ASSERT_TRUE(browser.get()); | 39 ASSERT_TRUE(browser.get()); |
| 40 | 40 |
| 41 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 41 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 42 ASSERT_TRUE(tab.get()); | 42 ASSERT_TRUE(tab.get()); |
| 43 | 43 |
| 44 // Go to the print preview tab via URL. | 44 // Go to the print preview tab via URL. |
| 45 NavigateToURL(GURL(chrome::kChromeUIPrintURL)); | 45 NavigateToURL(GURL(chrome::kChromeUIPrintURL)); |
| 46 AssertIsPrintPage(tab); | 46 AssertIsPrintPage(tab); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Flaky on interactive tests builder. See http://crbug.com/69389 | 49 TEST_F(PrintPreviewUITest, PrintCommandDisabled) { |
| 50 TEST_F(PrintPreviewUITest, FLAKY_PrintCommandDisabled) { | |
| 51 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | 50 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 52 ASSERT_TRUE(browser.get()); | 51 ASSERT_TRUE(browser.get()); |
| 53 | 52 |
| 54 // Go to the about:blank page. | 53 // Go to the about:blank page. |
| 55 NavigateToURL(GURL(chrome::kAboutBlankURL)); | 54 NavigateToURL(GURL(chrome::kAboutBlankURL)); |
| 56 | 55 |
| 57 // Make sure there is 1 tab and print is enabled. Create print preview tab. | 56 // Make sure there is 1 tab and print is enabled. Create print preview tab. |
| 58 int tab_count; | 57 int tab_count; |
| 59 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 58 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 60 ASSERT_EQ(1, tab_count); | 59 ASSERT_EQ(1, tab_count); |
| 61 bool enabled; | 60 bool enabled; |
| 62 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); | 61 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); |
| 63 ASSERT_TRUE(enabled); | 62 ASSERT_TRUE(enabled); |
| 64 ASSERT_TRUE(browser->RunCommand(IDC_PRINT)); | 63 ASSERT_TRUE(browser->RunCommand(IDC_PRINT)); |
| 65 | 64 |
| 66 // Make sure there are 2 tabs and print is disabled. | 65 // Make sure there are 2 tabs and print is disabled. |
| 67 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 66 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 68 ASSERT_EQ(2, tab_count); | 67 ASSERT_EQ(2, tab_count); |
| 69 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 68 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 70 ASSERT_TRUE(tab.get()); | 69 ASSERT_TRUE(tab.get()); |
| 71 AssertIsPrintPage(tab); | 70 AssertIsPrintPage(tab); |
| 72 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); | 71 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); |
| 73 ASSERT_FALSE(enabled); | 72 ASSERT_FALSE(enabled); |
| 74 } | 73 } |
| 75 | 74 |
| 76 } // namespace | 75 } // namespace |
| OLD | NEW |