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

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

Issue 2913733002: Add a browser test for access control for file: scheme (Closed)
Patch Set: just rebase 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 caa09c08abbc36ee70f15424530950daf18ab8e9..11dd8dc97e23b3df20bbbdd5aac07e7282c0b984 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
@@ -534,6 +532,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 {
« no previous file with comments | « chrome/browser/net/chrome_network_delegate.h ('k') | chrome/browser/net/chrome_network_delegate_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698