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

Unified Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 2913733002: Add a browser test for access control for file: scheme (Closed)
Patch Set: Rework the patch per feedback Created 3 years, 6 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
Index: chrome/browser/net/chrome_network_delegate.cc
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index b11644ada43c790b34cb4af8c7a96256a6d5a193..172c17048047be4c43962302fdb15144ea9c346c 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -82,6 +82,8 @@ using content::ResourceRequestInfo;
namespace {
+bool g_access_to_all_files_enabled = false;
+
const char kDNTHeader[] = "DNT";
// Gets called when the extensions finish work on the URL. If the extensions
@@ -451,12 +453,8 @@ bool ChromeNetworkDelegate::OnCanAccessFile(
const net::URLRequest& request,
const base::FilePath& original_path,
const base::FilePath& absolute_path) const {
-#if defined(OS_CHROMEOS)
- // browser_tests and interactive_ui_tests rely on the ability to open any
- // files via file: scheme.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kTestType))
+ if (g_access_to_all_files_enabled)
return true;
-#endif
#if defined(OS_ANDROID)
// Android's whitelist relies on symbolic links (ex. /sdcard is whitelisted
@@ -533,6 +531,11 @@ bool ChromeNetworkDelegate::IsAccessAllowed(
#endif // !defined(OS_CHROMEOS) && !defined(OS_ANDROID)
}
+// static
+void ChromeNetworkDelegate::EnableAccessToAllFilesForTesting(bool enabled) {
+ g_access_to_all_files_enabled = enabled;
+}
+
bool ChromeNetworkDelegate::OnCanEnablePrivacyMode(
const GURL& url,
const GURL& first_party_for_cookies) const {

Powered by Google App Engine
This is Rietveld 408576698