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/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" | 10 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 }; | 50 }; |
51 | 51 |
52 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { | 52 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, PrintCommands) { |
53 // We start off at about:blank page. | 53 // We start off at about:blank page. |
54 // Make sure there is 1 tab and print is enabled. | 54 // Make sure there is 1 tab and print is enabled. |
55 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 55 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
56 | 56 |
57 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); | 57 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); |
58 | 58 |
59 #if defined(OS_WIN) | 59 #if defined(DISABLE_BASIC_PRINTING) |
60 bool is_advanced_print_expected = false; | 60 bool is_basic_print_expected = false; |
61 #else | 61 #else |
62 bool is_advanced_print_expected = true; | 62 bool is_basic_print_expected = true; |
63 #endif // OS_WIN | 63 #endif // DISABLE_BASIC_PRINTING |
64 | 64 |
65 ASSERT_EQ(is_advanced_print_expected, | 65 ASSERT_EQ(is_basic_print_expected, |
66 chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT)); | 66 chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT)); |
67 | 67 |
68 // Create the print preview dialog. | 68 // Create the print preview dialog. |
69 Print(); | 69 Print(); |
70 | 70 |
71 ASSERT_FALSE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); | 71 ASSERT_FALSE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); |
72 | 72 |
73 ASSERT_EQ(is_advanced_print_expected, | 73 ASSERT_EQ(is_basic_print_expected, |
74 chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT)); | 74 chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT)); |
75 | 75 |
76 content::TestNavigationObserver reload_observer( | 76 content::TestNavigationObserver reload_observer( |
77 browser()->tab_strip_model()->GetActiveWebContents()); | 77 browser()->tab_strip_model()->GetActiveWebContents()); |
78 chrome::Reload(browser(), CURRENT_TAB); | 78 chrome::Reload(browser(), CURRENT_TAB); |
79 reload_observer.Wait(); | 79 reload_observer.Wait(); |
80 | 80 |
81 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); | 81 ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT)); |
82 | 82 |
83 ASSERT_EQ(is_advanced_print_expected, | 83 ASSERT_EQ(is_basic_print_expected, |
84 chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT)); | 84 chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT)); |
85 } | 85 } |
86 | 86 |
87 // Disable the test for mac, see http://crbug/367665. | 87 // Disable the test for mac, see http://crbug/367665. |
88 #if defined(OS_MACOSX) && !defined(OS_IOS) | 88 #if defined(OS_MACOSX) && !defined(OS_IOS) |
89 #define MAYBE_TaskManagerNewPrintPreview DISABLED_TaskManagerNewPrintPreview | 89 #define MAYBE_TaskManagerNewPrintPreview DISABLED_TaskManagerNewPrintPreview |
90 #else | 90 #else |
91 #define MAYBE_TaskManagerNewPrintPreview TaskManagerNewPrintPreview | 91 #define MAYBE_TaskManagerNewPrintPreview TaskManagerNewPrintPreview |
92 #endif | 92 #endif |
93 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, MAYBE_TaskManagerNewPrintPreview) { | 93 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, MAYBE_TaskManagerNewPrintPreview) { |
94 chrome::ShowTaskManager(browser()); // Show task manager BEFORE print dialog. | 94 chrome::ShowTaskManager(browser()); // Show task manager BEFORE print dialog. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 browser()->tab_strip_model()->ActivateTabAt(0, true); | 135 browser()->tab_strip_model()->ActivateTabAt(0, true); |
136 | 136 |
137 // Navigate main tab to hide print preview. | 137 // Navigate main tab to hide print preview. |
138 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 138 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
139 | 139 |
140 browser()->tab_strip_model()->ActivateTabAt(1, true); | 140 browser()->tab_strip_model()->ActivateTabAt(1, true); |
141 } | 141 } |
142 #endif // defined(OS_WIN) | 142 #endif // defined(OS_WIN) |
143 | 143 |
144 } // namespace | 144 } // namespace |
OLD | NEW |