| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
| 11 #include "chrome/test/automation/tab_proxy.h" | 11 #include "chrome/test/automation/tab_proxy.h" |
| 12 #include "chrome/test/ui/ui_test.h" | 12 #include "chrome/test/ui/ui_test.h" |
| 13 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class PrintPreviewUITest : public UITest { | 18 class PrintPreviewUITest : public UITest { |
| 19 public: | 19 public: |
| 20 PrintPreviewUITest() { | 20 PrintPreviewUITest() { |
| 21 dom_automation_enabled_ = true; | 21 dom_automation_enabled_ = true; |
| 22 #if !defined(GOOGLE_CHROME_BUILD) || defined(OS_CHROMEOS) || defined(OS_MACOSX) | |
| 23 launch_arguments_.AppendSwitch(switches::kEnablePrintPreview); | 22 launch_arguments_.AppendSwitch(switches::kEnablePrintPreview); |
| 24 #endif | |
| 25 } | 23 } |
| 26 | 24 |
| 27 void AssertIsPrintPage(TabProxy* tab) { | 25 void AssertIsPrintPage(TabProxy* tab) { |
| 28 std::wstring title; | 26 std::wstring title; |
| 29 ASSERT_TRUE(tab->GetTabTitle(&title)); | 27 ASSERT_TRUE(tab->GetTabTitle(&title)); |
| 30 string16 expected_title = | 28 string16 expected_title = |
| 31 l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_TITLE); | 29 l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_TITLE); |
| 32 ASSERT_EQ(expected_title, WideToUTF16Hack(title)); | 30 ASSERT_EQ(expected_title, WideToUTF16Hack(title)); |
| 33 } | 31 } |
| 34 }; | 32 }; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 ASSERT_TRUE(browser->GetTabCount(&tab_count)); | 65 ASSERT_TRUE(browser->GetTabCount(&tab_count)); |
| 68 ASSERT_EQ(2, tab_count); | 66 ASSERT_EQ(2, tab_count); |
| 69 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); | 67 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); |
| 70 ASSERT_TRUE(tab.get()); | 68 ASSERT_TRUE(tab.get()); |
| 71 AssertIsPrintPage(tab); | 69 AssertIsPrintPage(tab); |
| 72 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); | 70 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); |
| 73 ASSERT_FALSE(enabled); | 71 ASSERT_FALSE(enabled); |
| 74 } | 72 } |
| 75 | 73 |
| 76 } // namespace | 74 } // namespace |
| OLD | NEW |