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

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

Issue 2590363003: [HBD] Intercept Flash navigations in popup windows. (Closed)
Patch Set: Ad dtest Created 4 years 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
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 c1db46dd3fb8ae8cbf9d1f755597e931bf16e81f..3dc98c115dd6c01455574fd6a72f2d252a0eaf69 100644
--- a/chrome/browser/plugins/flash_permission_browsertest.cc
+++ b/chrome/browser/plugins/flash_permission_browsertest.cc
@@ -107,6 +107,31 @@ 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());
+ MockPermissionPromptFactory popup_prompt_factory(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());
+}
+
IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, TriggerPromptViaNewWindow) {
EXPECT_EQ(0, prompt_factory()->total_request_count());
prompt_factory()->set_response_type(PermissionRequestManager::ACCEPT_ALL);

Powered by Google App Engine
This is Rietveld 408576698