| 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 ce051cdf285bc0be8f97cf26ee570925a301ac32..565fb099b572c24c4371ea6bbeea6c92614d5f06 100644
|
| --- a/chrome/browser/plugins/flash_permission_browsertest.cc
|
| +++ b/chrome/browser/plugins/flash_permission_browsertest.cc
|
| @@ -4,8 +4,10 @@
|
|
|
| #include "base/base_switches.h"
|
| #include "base/command_line.h"
|
| +#include "base/path_service.h"
|
| #include "chrome/browser/permissions/permissions_browsertest.h"
|
| #include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h"
|
| +#include "chrome/common/chrome_paths.h"
|
| #include "chrome/common/chrome_switches.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "content/public/browser/web_contents.h"
|
| @@ -42,7 +44,8 @@ class FlashPermissionBrowserTest : public PermissionsBrowserTest {
|
| if (prompt_factory()->response_type() ==
|
| PermissionRequestManager::ACCEPT_ALL) {
|
| // If the prompt will be allowed, we need to wait for the page to refresh.
|
| - content::TestNavigationManager observer(GetWebContents(), GetTestUrl());
|
| + content::TestNavigationManager observer(
|
| + GetWebContents(), GetWebContents()->GetLastCommittedURL());
|
| EXPECT_TRUE(RunScriptReturnBool("triggerPrompt();"));
|
| observer.WaitForNavigationFinished();
|
| } else {
|
| @@ -95,7 +98,8 @@ IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest,
|
| EXPECT_FALSE(FeatureUsageSucceeds());
|
| prompt_factory()->set_response_type(PermissionRequestManager::ACCEPT_ALL);
|
| // We need to simulate a mouse click to trigger the placeholder to prompt.
|
| - content::TestNavigationManager observer(GetWebContents(), GetTestUrl());
|
| + content::TestNavigationManager observer(
|
| + GetWebContents(), GetWebContents()->GetLastCommittedURL());
|
| content::SimulateMouseClickAt(GetWebContents(), 0 /* modifiers */,
|
| blink::WebMouseEvent::Button::Left,
|
| gfx::Point(50, 50));
|
| @@ -104,3 +108,33 @@ IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest,
|
| EXPECT_TRUE(FeatureUsageSucceeds());
|
| EXPECT_EQ(1, prompt_factory()->total_request_count());
|
| }
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, AllowFileURL) {
|
| + base::FilePath test_path;
|
| + PathService::Get(chrome::DIR_TEST_DATA, &test_path);
|
| + ui_test_utils::NavigateToURL(
|
| + browser(), GURL("file://" + test_path.AsUTF8Unsafe() + test_url()));
|
| + CommonSucceedsIfAllowed();
|
| + EXPECT_EQ(1, prompt_factory()->total_request_count());
|
| +
|
| + // Navigate to a second URL to verify it's allowed on all file: URLs.
|
| + ui_test_utils::NavigateToURL(
|
| + browser(),
|
| + GURL("file://" + test_path.AsUTF8Unsafe() + "/permissions/flash2.html"));
|
| + EXPECT_TRUE(FeatureUsageSucceeds());
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(FlashPermissionBrowserTest, BlockFileURL) {
|
| + base::FilePath test_path;
|
| + PathService::Get(chrome::DIR_TEST_DATA, &test_path);
|
| + ui_test_utils::NavigateToURL(
|
| + browser(), GURL("file://" + test_path.AsUTF8Unsafe() + test_url()));
|
| + CommonFailsIfBlocked();
|
| + EXPECT_EQ(1, prompt_factory()->total_request_count());
|
| +
|
| + // Navigate to a second URL to verify it's blocked on all file: URLs.
|
| + ui_test_utils::NavigateToURL(
|
| + browser(),
|
| + GURL("file://" + test_path.AsUTF8Unsafe() + "/permissions/flash2.html"));
|
| + EXPECT_FALSE(FeatureUsageSucceeds());
|
| +}
|
|
|