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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc

Issue 10677009: Move command handling and updating off Browser and onto a helper object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "chrome/app/chrome_command_ids.h" 6 #include "chrome/app/chrome_command_ids.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 14 matching lines...) Expand all
25 #if !defined(GOOGLE_CHROME_BUILD) 25 #if !defined(GOOGLE_CHROME_BUILD)
26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 26 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
27 command_line->AppendSwitch(switches::kEnablePrintPreview); 27 command_line->AppendSwitch(switches::kEnablePrintPreview);
28 } 28 }
29 #endif 29 #endif
30 30
31 void Print() { 31 void Print() {
32 ui_test_utils::WindowedNotificationObserver observer( 32 ui_test_utils::WindowedNotificationObserver observer(
33 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, 33 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED,
34 content::NotificationService::AllSources()); 34 content::NotificationService::AllSources());
35 browser()->ExecuteCommand(IDC_PRINT); 35 chrome::ExecuteCommand(browser(), IDC_PRINT);
36 observer.Wait(); 36 observer.Wait();
37 } 37 }
38 }; 38 };
39 39
40 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { 40 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) {
41 // We start off at about:blank page. 41 // We start off at about:blank page.
42 // Make sure there is 1 tab and print is enabled. 42 // Make sure there is 1 tab and print is enabled.
43 ASSERT_EQ(1, browser()->tab_count()); 43 ASSERT_EQ(1, browser()->tab_count());
44 ASSERT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_PRINT)); 44
45 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
45 46
46 // Make sure advanced print command (Ctrl+Shift+p) is enabled. 47 // Make sure advanced print command (Ctrl+Shift+p) is enabled.
47 ASSERT_TRUE( 48 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT));
48 browser()->command_updater()->IsCommandEnabled(IDC_ADVANCED_PRINT));
49 49
50 // Create print preview tab. 50 // Create print preview tab.
51 Print(); 51 Print();
52 52
53 // Make sure print is disabled. 53 // Make sure print is disabled.
54 ASSERT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_PRINT)); 54 ASSERT_FALSE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
55 55
56 // Make sure advanced print command (Ctrl+Shift+p) is enabled. 56 // Make sure advanced print command (Ctrl+Shift+p) is enabled.
57 ASSERT_TRUE( 57 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT));
58 browser()->command_updater()->IsCommandEnabled(IDC_ADVANCED_PRINT));
59 58
60 content::TestNavigationObserver reload_observer( 59 content::TestNavigationObserver reload_observer(
61 content::NotificationService::AllSources()); 60 content::NotificationService::AllSources());
62 chrome::Reload(browser(), CURRENT_TAB); 61 chrome::Reload(browser(), CURRENT_TAB);
63 reload_observer.Wait(); 62 reload_observer.Wait();
64 63
65 ASSERT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_PRINT)); 64 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
66 65
67 // Make sure advanced print command (Ctrl+Shift+p) is enabled. 66 // Make sure advanced print command (Ctrl+Shift+p) is enabled.
68 ASSERT_TRUE( 67 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT));
69 browser()->command_updater()->IsCommandEnabled(IDC_ADVANCED_PRINT));
70 } 68 }
71 69
72 } // namespace 70 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/options2/chromeos/cros_language_options_handler2.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698