ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
- // Make sure advanced print command (Ctrl+Shift+p) is enabled.
- ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT));
+#if defined(DISABLE_BASIC_PRINTING)
+ bool is_basic_print_expected = false;
+#else
+ bool is_basic_print_expected = true;
+#endif // DISABLE_BASIC_PRINTING
+
+ ASSERT_EQ(is_basic_print_expected,
+ chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT));
// Create the print preview dialog.
Print();
- // Make sure print is disabled.
ASSERT_FALSE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
- // Make sure advanced print command (Ctrl+Shift+p) is enabled.
- ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT));
+ ASSERT_EQ(is_basic_print_expected,
+ chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT));
content::TestNavigationObserver reload_observer(
browser()->tab_strip_model()->GetActiveWebContents());
ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_PRINT));
- // Make sure advanced print command (Ctrl+Shift+p) is enabled.
- ASSERT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ADVANCED_PRINT));
+ ASSERT_EQ(is_basic_print_expected,
+ chrome::IsCommandEnabled(browser(), IDC_BASIC_PRINT));
}
// Disable the test for mac, see http://crbug/367665.
}
#if defined(OS_WIN)
-BOOL CALLBACK EnumerateChildren(HWND hwnd, LPARAM l_param) {
- HWND* child = reinterpret_cast<HWND*>(l_param);
- *child = hwnd;
- // The first child window is the plugin, then its children. So stop
- // enumerating after the first callback.
- return FALSE;
-}
-
-// This test verifies that constrained windows aren't covered by windowed NPAPI
-// plugins. The code which fixes this is in WebContentsViewAura::WindowObserver.
-IN_PROC_BROWSER_TEST_F(PrintPreviewTest, WindowedNPAPIPluginHidden) {
- browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize,
- true);
-
- // First load the page and wait for the NPAPI plugin's window to display.
- base::string16 expected_title(base::ASCIIToUTF16("ready"));
- content::WebContents* tab =
- browser()->tab_strip_model()->GetActiveWebContents();
- content::TitleWatcher title_watcher(tab, expected_title);
-
- GURL url = ui_test_utils::GetTestUrl(
- base::FilePath().AppendASCII("printing"),
- base::FilePath().AppendASCII("npapi_plugin.html"));
- ui_test_utils::NavigateToURL(browser(), url);
-
- EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
-
- // Now get the region of the plugin before and after the print preview is
- // shown. They should be different.
- HWND hwnd = tab->GetNativeView()->GetHost()->GetAcceleratedWidget();
- HWND child = NULL;
- EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child));
-
- RECT region_before, region_after;
- int result = GetWindowRgnBox(child, ®ion_before);
- ASSERT_EQ(result, SIMPLEREGION);
-
- // Now print preview.
- Print();
-
- result = GetWindowRgnBox(child, ®ion_after);
- if (result == NULLREGION) {
- // Depending on the browser window size, the plugin could be full covered.
- return;
- }
-
- if (result == COMPLEXREGION) {
- // Complex region, by definition not equal to the initial region.
- return;
- }
-
- ASSERT_EQ(result, SIMPLEREGION);
- bool rects_equal =
- region_before.left == region_after.left &&
- region_before.top == region_after.top &&
- region_before.right == region_after.right &&
- region_before.bottom == region_after.bottom;
- ASSERT_FALSE(rects_equal);
-}
-
// http://crbug.com/396360
IN_PROC_BROWSER_TEST_F(PrintPreviewTest, DISABLED_NoCrashOnCloseWithOtherTabs) {
// Now print preview.