| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // enumerating after the first callback. | 47 // enumerating after the first callback. |
| 48 return FALSE; | 48 return FALSE; |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 typedef InProcessBrowserTest ChromePluginTest; | 53 typedef InProcessBrowserTest ChromePluginTest; |
| 54 | 54 |
| 55 // Test that if a background tab loads an NPAPI plugin, they are displayed after | 55 // Test that if a background tab loads an NPAPI plugin, they are displayed after |
| 56 // switching to that page. http://crbug.com/335900 | 56 // switching to that page. http://crbug.com/335900 |
| 57 IN_PROC_BROWSER_TEST_F(ChromePluginTest, WindowedNPAPIPluginHidden) { | 57 // flaky: http://crbug.com/406631 |
| 58 IN_PROC_BROWSER_TEST_F(ChromePluginTest, DISABLED_WindowedNPAPIPluginHidden) { |
| 58 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, | 59 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, |
| 59 true); | 60 true); |
| 60 | 61 |
| 61 // First load the page in the background and wait for the NPAPI plugin's | 62 // First load the page in the background and wait for the NPAPI plugin's |
| 62 // window to be created. | 63 // window to be created. |
| 63 GURL url = ui_test_utils::GetTestUrl( | 64 GURL url = ui_test_utils::GetTestUrl( |
| 64 base::FilePath(), | 65 base::FilePath(), |
| 65 base::FilePath().AppendASCII("windowed_npapi_plugin.html")); | 66 base::FilePath().AppendASCII("windowed_npapi_plugin.html")); |
| 66 | 67 |
| 67 ui_test_utils::NavigateToURLWithDisposition( | 68 ui_test_utils::NavigateToURLWithDisposition( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 96 | 97 |
| 97 RECT region; | 98 RECT region; |
| 98 int result = GetWindowRgnBox(child, ®ion); | 99 int result = GetWindowRgnBox(child, ®ion); |
| 99 ASSERT_NE(result, NULLREGION); | 100 ASSERT_NE(result, NULLREGION); |
| 100 } | 101 } |
| 101 | 102 |
| 102 typedef InProcessBrowserTest PrintPreviewTest; | 103 typedef InProcessBrowserTest PrintPreviewTest; |
| 103 | 104 |
| 104 // This test verifies that constrained windows aren't covered by windowed NPAPI | 105 // This test verifies that constrained windows aren't covered by windowed NPAPI |
| 105 // plugins. The code which fixes this is in WebContentsViewAura::WindowObserver. | 106 // plugins. The code which fixes this is in WebContentsViewAura::WindowObserver. |
| 106 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, WindowedNPAPIPluginHidden) { | 107 // flaky: http://crbug.com/406631 |
| 108 IN_PROC_BROWSER_TEST_F(PrintPreviewTest, DISABLED_WindowedNPAPIPluginHidden) { |
| 107 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, | 109 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, |
| 108 true); | 110 true); |
| 109 | 111 |
| 110 // First load the page and wait for the NPAPI plugin's window to display. | 112 // First load the page and wait for the NPAPI plugin's window to display. |
| 111 base::string16 expected_title(base::ASCIIToUTF16("ready")); | 113 base::string16 expected_title(base::ASCIIToUTF16("ready")); |
| 112 content::WebContents* tab = | 114 content::WebContents* tab = |
| 113 browser()->tab_strip_model()->GetActiveWebContents(); | 115 browser()->tab_strip_model()->GetActiveWebContents(); |
| 114 content::TitleWatcher title_watcher(tab, expected_title); | 116 content::TitleWatcher title_watcher(tab, expected_title); |
| 115 | 117 |
| 116 GURL url = ui_test_utils::GetTestUrl( | 118 GURL url = ui_test_utils::GetTestUrl( |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 chrome::ShowFindBar(browser); | 165 chrome::ShowFindBar(browser); |
| 164 gfx::Point position; | 166 gfx::Point position; |
| 165 bool fully_visible = false; | 167 bool fully_visible = false; |
| 166 FindBarTesting* find_bar = | 168 FindBarTesting* find_bar = |
| 167 browser->GetFindBarController()->find_bar()->GetFindBarTesting(); | 169 browser->GetFindBarController()->find_bar()->GetFindBarTesting(); |
| 168 EXPECT_TRUE(find_bar->GetFindBarWindowInfo(&position, &fully_visible)); | 170 EXPECT_TRUE(find_bar->GetFindBarWindowInfo(&position, &fully_visible)); |
| 169 EXPECT_TRUE(fully_visible); | 171 EXPECT_TRUE(fully_visible); |
| 170 } | 172 } |
| 171 | 173 |
| 172 // Ensure that the find bar is always over a windowed NPAPI plugin. | 174 // Ensure that the find bar is always over a windowed NPAPI plugin. |
| 173 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, WindowedNPAPIPluginHidden) { | 175 // flaky: http://crbug.com/406631 |
| 176 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, |
| 177 DISABLED_WindowedNPAPIPluginHidden) { |
| 174 chrome::DisableFindBarAnimationsDuringTesting(true); | 178 chrome::DisableFindBarAnimationsDuringTesting(true); |
| 175 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, | 179 browser()->profile()->GetPrefs()->SetBoolean(prefs::kPluginsAlwaysAuthorize, |
| 176 true); | 180 true); |
| 177 | 181 |
| 178 // First load the page and wait for the NPAPI plugin's window to display. | 182 // First load the page and wait for the NPAPI plugin's window to display. |
| 179 base::string16 expected_title(base::ASCIIToUTF16("ready")); | 183 base::string16 expected_title(base::ASCIIToUTF16("ready")); |
| 180 content::WebContents* tab = | 184 content::WebContents* tab = |
| 181 browser()->tab_strip_model()->GetActiveWebContents(); | 185 browser()->tab_strip_model()->GetActiveWebContents(); |
| 182 content::TitleWatcher title_watcher(tab, expected_title); | 186 content::TitleWatcher title_watcher(tab, expected_title); |
| 183 | 187 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 ASSERT_EQ(result, SIMPLEREGION); | 226 ASSERT_EQ(result, SIMPLEREGION); |
| 223 bool rects_equal = | 227 bool rects_equal = |
| 224 region_before.left == region_after.left && | 228 region_before.left == region_after.left && |
| 225 region_before.top == region_after.top && | 229 region_before.top == region_after.top && |
| 226 region_before.right == region_after.right && | 230 region_before.right == region_after.right && |
| 227 region_before.bottom == region_after.bottom; | 231 region_before.bottom == region_after.bottom; |
| 228 ASSERT_FALSE(rects_equal); | 232 ASSERT_FALSE(rects_equal); |
| 229 } | 233 } |
| 230 | 234 |
| 231 #endif | 235 #endif |
| OLD | NEW |