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

Unified Diff: chrome/browser/extensions/process_manager_browsertest.cc

Issue 2875493002: Block navigations to hosted apps non-icon resources with PlzNavigate. (Closed)
Patch Set: Remove incorrect TODO. Created 3 years, 7 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 | « no previous file | chrome/test/data/extensions/hosted_app/icon.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/process_manager_browsertest.cc
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc
index 88c5b9681d8e1fc5e5fd0aba7284a6b569ff1684..38332dde16db2aa6ac2117962fd2dad67725fc91 100644
--- a/chrome/browser/extensions/process_manager_browsertest.cc
+++ b/chrome/browser/extensions/process_manager_browsertest.cc
@@ -26,6 +26,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "components/guest_view/browser/test_guest_view_manager.h"
#include "content/public/browser/child_process_security_policy.h"
+#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
@@ -1233,4 +1234,35 @@ IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest,
}
}
+// Test to verify that loading a resource other than an icon file is
+// disallowed for hosted apps, while icons are allowed.
+// See https://crbug.com/717626.
+IN_PROC_BROWSER_TEST_F(ProcessManagerBrowserTest, HostedAppFilesAccess) {
+ // Load an extension with a background page.
+ scoped_refptr<const Extension> extension =
+ LoadExtension(test_data_dir_.AppendASCII("hosted_app"));
+ ASSERT_TRUE(extension);
+
+ content::WebContents* tab =
+ browser()->tab_strip_model()->GetActiveWebContents();
+
+ // Navigating to the manifest should be blocked with an error page.
+ {
+ content::TestNavigationObserver observer(tab);
+ NavigateToURL(extension->GetResourceURL("/manifest.json"));
+ EXPECT_FALSE(observer.last_navigation_succeeded());
+ EXPECT_EQ(tab->GetController().GetLastCommittedEntry()->GetPageType(),
+ content::PAGE_TYPE_ERROR);
+ }
+
+ // Navigation to the icon file should succeed.
+ {
+ content::TestNavigationObserver observer(tab);
+ NavigateToURL(extension->GetResourceURL("/icon.png"));
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+ EXPECT_EQ(tab->GetController().GetLastCommittedEntry()->GetPageType(),
+ content::PAGE_TYPE_NORMAL);
+ }
+}
+
} // namespace extensions
« no previous file with comments | « no previous file | chrome/test/data/extensions/hosted_app/icon.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698