| 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 9 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| 11 #include "chrome/browser/ui/browser_commands.h" | 11 #include "chrome/browser/ui/browser_commands.h" |
| 12 #include "chrome/browser/ui/browser_dialogs.h" | 12 #include "chrome/browser/ui/browser_dialogs.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/test/base/in_process_browser_test.h" | 15 #include "chrome/test/base/in_process_browser_test.h" |
| 16 #include "chrome/test/base/ui_test_utils.h" | 16 #include "chrome/test/base/ui_test_utils.h" |
| 17 #include "components/content_settings/core/browser/host_content_settings_map.h" | 17 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 18 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/browser/web_contents_observer.h" | 20 #include "content/public/browser/web_contents_observer.h" |
| 21 #include "content/public/test/browser_test_utils.h" | 21 #include "content/public/test/browser_test_utils.h" |
| 22 #include "content/public/test/test_navigation_observer.h" | 22 #include "content/public/test/test_navigation_observer.h" |
| 23 #include "content/public/test/test_utils.h" | 23 #include "content/public/test/test_utils.h" |
| 24 #include "printing/features/features.h" |
| 24 #include "url/url_constants.h" | 25 #include "url/url_constants.h" |
| 25 | 26 |
| 26 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 27 #include "ui/aura/window.h" | 28 #include "ui/aura/window.h" |
| 28 #include "ui/aura/window_tree_host.h" | 29 #include "ui/aura/window_tree_host.h" |
| 29 #endif | 30 #endif |
| 30 | 31 |
| 31 using task_manager::browsertest_util::MatchAboutBlankTab; | 32 using task_manager::browsertest_util::MatchAboutBlankTab; |
| 32 using task_manager::browsertest_util::MatchAnyPrint; | 33 using task_manager::browsertest_util::MatchAnyPrint; |
| 33 using task_manager::browsertest_util::MatchAnyTab; | 34 using task_manager::browsertest_util::MatchAnyTab; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 49 } | 50 } |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { | 53 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { |
| 53 // We start off at about:blank page. | 54 // We start off at about:blank page. |
| 54 // Make sure there is 1 tab and print is enabled. | 55 // Make sure there is 1 tab and print is enabled. |
| 55 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 56 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
| 56 | 57 |
| 57 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); | 58 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); |
| 58 | 59 |
| 59 #if defined(ENABLE_BASIC_PRINTING) && !defined(OS_CHROMEOS) | 60 #if BUILDFLAG(ENABLE_BASIC_PRINTING) && !defined(OS_CHROMEOS) |
| 60 // This is analagous to ENABLE_BASIC_PRINT_DIALOG but helps to verify | 61 // This is analagous to ENABLE_BASIC_PRINT_DIALOG but helps to verify |
| 61 // that it is defined as expected. | 62 // that it is defined as expected. |
| 62 bool is_basic_print_expected = true; | 63 bool is_basic_print_expected = true; |
| 63 #else | 64 #else |
| 64 bool is_basic_print_expected = false; | 65 bool is_basic_print_expected = false; |
| 65 #endif | 66 #endif |
| 66 | 67 |
| 67 ASSERT_EQ(is_basic_print_expected, | 68 ASSERT_EQ(is_basic_print_expected, |
| 68 chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT)); | 69 chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT)); |
| 69 | 70 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 browser()->tab_strip_model()->ActivateTabAt(0, true); | 138 browser()->tab_strip_model()->ActivateTabAt(0, true); |
| 138 | 139 |
| 139 // Navigate main tab to hide print preview. | 140 // Navigate main tab to hide print preview. |
| 140 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 141 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 141 | 142 |
| 142 browser()->tab_strip_model()->ActivateTabAt(1, true); | 143 browser()->tab_strip_model()->ActivateTabAt(1, true); |
| 143 } | 144 } |
| 144 #endif // defined(OS_WIN) | 145 #endif // defined(OS_WIN) |
| 145 | 146 |
| 146 } // namespace | 147 } // namespace |
| OLD | NEW |