Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1257)

Unified Diff: chrome/browser/plugins/flash_permission_browsertest.cc

Issue 2623593002: [HBD] Intercept Flash navigations in popup windows. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/plugins/flash_download_interception.cc ('k') | chrome/test/data/permissions/flash.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/flash_permission_browsertest.cc
diff --git a/chrome/browser/plugins/flash_permission_browsertest.cc b/chrome/browser/plugins/flash_permission_browsertest.cc
index 5a934dd64c6ab4a3f07d9e6365ab9f3f4a3c1ec0..0f8e7eaf111b11139a93e2b53c88cf41107f20c5 100644
--- a/chrome/browser/plugins/flash_permission_browsertest.cc
+++ b/chrome/browser/plugins/flash_permission_browsertest.cc
@@ -4,6 +4,7 @@
#include "base/base_switches.h"
#include "base/command_line.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "chrome/browser/permissions/permissions_browsertest.h"
#include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h"
@@ -83,6 +84,37 @@ IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, CommonSucceedsIfAllowed) {
CommonSucceedsIfAllowed();
}
+IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, SucceedsInPopupWindow) {
+ // Spawn the same page in a popup window and wait for it to finish loading.
+ content::WebContents* original_contents = GetWebContents();
+ ASSERT_TRUE(RunScriptReturnBool("spawnPopupAndAwaitLoad();"));
+
+ // Assert that the popup's WebContents is now the active one.
+ ASSERT_NE(original_contents, GetWebContents());
+
+ PermissionRequestManager* manager = PermissionRequestManager::FromWebContents(
+ GetWebContents());
+ auto popup_prompt_factory =
+ base::MakeUnique<MockPermissionPromptFactory>(manager);
+ manager->DisplayPendingRequests();
+
+ EXPECT_EQ(0, popup_prompt_factory->total_request_count());
+ popup_prompt_factory->set_response_type(PermissionRequestManager::ACCEPT_ALL);
+ // FlashPermissionContext::UpdateTabContext will reload the page, we'll have
+ // to wait until it is ready.
+ PageReloadWaiter reload_waiter(GetWebContents());
+ EXPECT_TRUE(RunScriptReturnBool("triggerPrompt();"));
+ EXPECT_TRUE(reload_waiter.Wait());
+
+ EXPECT_TRUE(FeatureUsageSucceeds());
+ EXPECT_EQ(1, popup_prompt_factory->total_request_count());
+
+ // Shut down the popup window tab, as the normal test teardown assumes there
+ // is only one test tab.
+ popup_prompt_factory.reset();
+ GetWebContents()->Close();
+}
+
IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, TriggerPromptViaNewWindow) {
EXPECT_EQ(0, prompt_factory()->total_request_count());
prompt_factory()->set_response_type(PermissionRequestManager::ACCEPT_ALL);
« no previous file with comments | « chrome/browser/plugins/flash_download_interception.cc ('k') | chrome/test/data/permissions/flash.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698