| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "app/l10n_util.h" |
| 6 #include "base/string16.h" |
| 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/url_constants.h" |
| 10 #include "chrome/test/automation/browser_proxy.h" |
| 11 #include "chrome/test/automation/tab_proxy.h" |
| 12 #include "chrome/test/ui/ui_test.h" |
| 13 |
| 14 #include "grit/generated_resources.h" |
| 15 |
| 16 namespace { |
| 17 |
| 18 class PrintPreviewUITest : public UITest { |
| 19 public: |
| 20 PrintPreviewUITest() { |
| 21 dom_automation_enabled_ = true; |
| 22 // TODO(thestig): Remove when print preview is enabled by default. |
| 23 launch_arguments_.AppendSwitch(switches::kEnablePrintPreview); |
| 24 } |
| 25 |
| 26 void AssertIsPrintPage(TabProxy* tab) { |
| 27 std::wstring title; |
| 28 ASSERT_TRUE(tab->GetTabTitle(&title)); |
| 29 string16 expected_title = l10n_util::GetStringUTF16(IDS_PRINTPREVIEW_TITLE); |
| 30 ASSERT_EQ(expected_title, WideToUTF16Hack(title)); |
| 31 } |
| 32 }; |
| 33 |
| 34 // TODO(thestig) Remove this test in the future if loading |
| 35 // chrome::kChromeUIPrintURL directly does not make sense. |
| 36 TEST_F(PrintPreviewUITest, LoadPrintPreviewByURL) { |
| 37 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); |
| 38 ASSERT_TRUE(browser.get()); |
| 39 |
| 40 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 41 ASSERT_TRUE(tab.get()); |
| 42 |
| 43 // Go to the print preview tab via URL. |
| 44 NavigateToURL(GURL(chrome::kChromeUIPrintURL)); |
| 45 AssertIsPrintPage(tab); |
| 46 } |
| 47 |
| 48 } // namespace |
| OLD | NEW |