#include "base/bind.h"
#include "base/callback.h"
#include "base/command_line.h"
-#include "base/file_util.h"
+#include "base/files/file_util.h"
#include "base/memory/ref_counted.h"
#include "base/path_service.h"
#include "base/prefs/pref_service.h"
}
}
#endif
-
-#if defined(OS_WIN)
-
-namespace {
-
-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;
-}
-
-} // namespace
-
-// Test that if a background tab loads an NPAPI plugin, they are displayed after
-// switching to that page. http://crbug.com/335900
-IN_PROC_BROWSER_TEST_F(ChromePluginTest, WindowedNPAPIPluginHidden) {
- browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize,
- true);
-
- // First load the page in the background and wait for the NPAPI plugin's
- // window to be created.
- GURL url = ui_test_utils::GetTestUrl(
- base::FilePath(),
- base::FilePath().AppendASCII("windowed_npapi_plugin.html"));
-
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), url, NEW_BACKGROUND_TAB,
- ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
-
- // We create a third window just to trigger the second one to update its
- // constrained window list. Normally this would be triggered by the status bar
- // animation closing after the user middle clicked a link.
- ui_test_utils::NavigateToURLWithDisposition(
- browser(), GURL("about:blank"), NEW_BACKGROUND_TAB,
- ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB);
-
- base::string16 expected_title(base::ASCIIToUTF16("created"));
- content::WebContents* tab =
- browser()->tab_strip_model()->GetWebContentsAt(1);
- if (tab->GetTitle() != expected_title) {
- content::TitleWatcher title_watcher(tab, expected_title);
- EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
- }
-
- // Now activate the tab and verify that the plugin painted.
- browser()->tab_strip_model()->ActivateTabAt(1, true);
-
- base::string16 expected_title2(base::ASCIIToUTF16("shown"));
- content::TitleWatcher title_watcher2(tab, expected_title2);
- EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle());
-
- HWND child = NULL;
- HWND hwnd = tab->GetNativeView()->GetHost()->GetAcceleratedWidget();
- EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child));
-
- RECT region;
- int result = GetWindowRgnBox(child, ®ion);
- ASSERT_NE(result, NULLREGION);
-}
-
-#endif