| OLD | NEW |
| 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" |
| 11 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
| 12 #include "chrome/test/base/ui_test_utils.h" | |
| 13 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/browser/notification_types.h" | 13 #include "content/public/browser/notification_types.h" |
| 15 #include "content/public/test/test_navigation_observer.h" | 14 #include "content/public/test/test_navigation_observer.h" |
| 15 #include "content/public/test/test_utils.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class PrintPreviewTest : public InProcessBrowserTest { | 19 class PrintPreviewTest : public InProcessBrowserTest { |
| 20 public: | 20 public: |
| 21 PrintPreviewTest() {} | 21 PrintPreviewTest() {} |
| 22 | 22 |
| 23 #if !defined(GOOGLE_CHROME_BUILD) | 23 #if !defined(GOOGLE_CHROME_BUILD) |
| 24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 25 command_line->AppendSwitch(switches::kEnablePrintPreview); | 25 command_line->AppendSwitch(switches::kEnablePrintPreview); |
| 26 } | 26 } |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 void Print() { | 29 void Print() { |
| 30 ui_test_utils::WindowedNotificationObserver observer( | 30 content::WindowedNotificationObserver observer( |
| 31 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, | 31 content::NOTIFICATION_WEB_CONTENTS_TITLE_UPDATED, |
| 32 content::NotificationService::AllSources()); | 32 content::NotificationService::AllSources()); |
| 33 chrome::ExecuteCommand(browser(), IDC_PRINT); | 33 chrome::ExecuteCommand(browser(), IDC_PRINT); |
| 34 observer.Wait(); | 34 observer.Wait(); |
| 35 } | 35 } |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { | 38 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { |
| 39 // We start off at about:blank page. | 39 // We start off at about:blank page. |
| 40 // Make sure there is 1 tab and print is enabled. | 40 // Make sure there is 1 tab and print is enabled. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 59 chrome::Reload(browser(), CURRENT_TAB); | 59 chrome::Reload(browser(), CURRENT_TAB); |
| 60 reload_observer.Wait(); | 60 reload_observer.Wait(); |
| 61 | 61 |
| 62 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); | 62 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); |
| 63 | 63 |
| 64 // Make sure advanced print command (Ctrl+Shift+p) is enabled. | 64 // Make sure advanced print command (Ctrl+Shift+p) is enabled. |
| 65 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT)); | 65 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace | 68 } // namespace |
| OLD | NEW |