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

Side by Side Diff: chrome/browser/dom_ui/print_preview_ui_uitest.cc

Issue 6312154: Remove wstring from RVH's run Javascript command.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
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 // TODO(thestig): Remove when print preview is enabled by default. 22 // TODO(thestig): Remove when print preview is enabled by default.
23 launch_arguments_.AppendSwitch(switches::kEnablePrintPreview); 23 launch_arguments_.AppendSwitch(switches::kEnablePrintPreview);
24 } 24 }
25 25
26 void AssertIsPrintPage(TabProxy* tab) { 26 void AssertIsPrintPage(TabProxy* tab) {
27 std::wstring title; 27 string16 title;
28 ASSERT_TRUE(tab->GetTabTitle(&title)); 28 ASSERT_TRUE(tab->GetTabTitle(&title));
29 string16 expected_title = 29 string16 expected_title =
30 l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_TITLE); 30 l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_TITLE);
31 ASSERT_EQ(expected_title, WideToUTF16Hack(title)); 31 ASSERT_EQ(expected_title, title);
32 } 32 }
33 }; 33 };
34 34
35 // TODO(thestig) Remove this test in the future if loading 35 // TODO(thestig) Remove this test in the future if loading
36 // chrome::kChromeUIPrintURL directly does not make sense. 36 // chrome::kChromeUIPrintURL directly does not make sense.
37 TEST_F(PrintPreviewUITest, LoadPrintPreviewByURL) { 37 TEST_F(PrintPreviewUITest, LoadPrintPreviewByURL) {
38 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 38 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
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();
(...skipping 25 matching lines...) Expand all
67 ASSERT_TRUE(browser->GetTabCount(&tab_count)); 67 ASSERT_TRUE(browser->GetTabCount(&tab_count));
68 ASSERT_EQ(2, tab_count); 68 ASSERT_EQ(2, tab_count);
69 scoped_refptr<TabProxy> tab = browser->GetActiveTab(); 69 scoped_refptr<TabProxy> tab = browser->GetActiveTab();
70 ASSERT_TRUE(tab.get()); 70 ASSERT_TRUE(tab.get());
71 AssertIsPrintPage(tab); 71 AssertIsPrintPage(tab);
72 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled)); 72 ASSERT_TRUE(browser->IsMenuCommandEnabled(IDC_PRINT, &enabled));
73 ASSERT_FALSE(enabled); 73 ASSERT_FALSE(enabled);
74 } 74 }
75 75
76 } // namespace 76 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698