diff options
author | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 00:24:46 +0000 |
---|---|---|
committer | dumi@chromium.org <dumi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-20 00:24:46 +0000 |
commit | eff5e88804ca872d3603a5123cd90164bb68a5dd (patch) | |
tree | ca61b4adb481419d81b641fbbbabb859ca6e98f8 | |
parent | b4d13c652373433d8f6b755bc68f670f187d2157 (diff) | |
download | chromium_src-eff5e88804ca872d3603a5123cd90164bb68a5dd.zip chromium_src-eff5e88804ca872d3603a5123cd90164bb68a5dd.tar.gz chromium_src-eff5e88804ca872d3603a5123cd90164bb68a5dd.tar.bz2 |
Add a switch to grant unlimited file storage when running Pepper tests.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3853001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63152 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/file_system/file_system_host_context.cc | 15 | ||||
-rw-r--r-- | chrome/browser/file_system/file_system_host_context.h | 5 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 6 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 1 | ||||
-rw-r--r-- | chrome/test/ui/ppapi_uitest.cc | 5 |
5 files changed, 25 insertions, 7 deletions
diff --git a/chrome/browser/file_system/file_system_host_context.cc b/chrome/browser/file_system/file_system_host_context.cc index e94c326..54f8056 100644 --- a/chrome/browser/file_system/file_system_host_context.cc +++ b/chrome/browser/file_system/file_system_host_context.cc @@ -15,19 +15,24 @@ FileSystemHostContext::FileSystemHostContext( const FilePath& data_path, bool is_incognito) - : allow_file_access_from_files_(CommandLine::ForCurrentProcess()->HasSwitch( - switches::kAllowFileAccessFromFiles)), - quota_manager_(new fileapi::FileSystemQuota()), + : quota_manager_(new fileapi::FileSystemQuota()), path_manager_(new fileapi::FileSystemPathManager( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), data_path, is_incognito, allow_file_access_from_files_)) { + CommandLine* command_line = CommandLine::ForCurrentProcess(); + allow_file_access_from_files_ = + command_line->HasSwitch(switches::kAllowFileAccessFromFiles); + unlimited_quota_ = + command_line->HasSwitch(switches::kUnlimitedQuotaForFiles); } bool FileSystemHostContext::CheckOriginQuota(const GURL& url, int64 growth) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); // If allow-file-access-from-files flag is explicitly given and the scheme - // is file, always return true. - if (url.SchemeIsFile() && allow_file_access_from_files_) + // is file, or if unlimited quota for this process was explicitly requested, + // return true. + if (unlimited_quota_ || + (url.SchemeIsFile() && allow_file_access_from_files_)) return true; return quota_manager_->CheckOriginQuota(url, growth); } diff --git a/chrome/browser/file_system/file_system_host_context.h b/chrome/browser/file_system/file_system_host_context.h index 1575c97..ddb0bf2 100644 --- a/chrome/browser/file_system/file_system_host_context.h +++ b/chrome/browser/file_system/file_system_host_context.h @@ -32,11 +32,12 @@ class FileSystemHostContext fileapi::FileSystemPathManager* path_manager() { return path_manager_.get(); } private: - bool allow_file_access_from_files_; - scoped_ptr<fileapi::FileSystemQuota> quota_manager_; scoped_ptr<fileapi::FileSystemPathManager> path_manager_; + bool allow_file_access_from_files_; + bool unlimited_quota_; + DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemHostContext); }; diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 5541573..ef593e9 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1054,6 +1054,12 @@ const char kIgnoreCertificateErrors[] = "ignore-certificate-errors"; // Set the maximum SPDY sessions per domain. const char kMaxSpdySessionsPerDomain[] = "max-spdy-sessions-per-domain"; +// Grant unlimited quota to store files to this process. +// Used for testing Pepper's FileRef/FileIO/FileSystem implementations. +// DO NOT USE FOR OTHER PURPOSES. +// TODO(dumi): remove the switch when we have a real quota implementation. +const char kUnlimitedQuotaForFiles[] = "unlimited-quota-for-files"; + // Use the low fragmentation heap for the CRT. const char kUseLowFragHeapCrt[] = "use-lf-heap"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index adb6bd5..1dcdc37 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -297,6 +297,7 @@ extern const char kUninstall[]; extern const char kUseSpdy[]; extern const char kIgnoreCertificateErrors[]; extern const char kMaxSpdySessionsPerDomain[]; +extern const char kUnlimitedQuotaForFiles[]; extern const char kUseLowFragHeapCrt[]; extern const char kUserAgent[]; extern const char kUserDataDir[]; diff --git a/chrome/test/ui/ppapi_uitest.cc b/chrome/test/ui/ppapi_uitest.cc index 0409573..195c5e0 100644 --- a/chrome/test/ui/ppapi_uitest.cc +++ b/chrome/test/ui/ppapi_uitest.cc @@ -47,6 +47,11 @@ class PPAPITest : public UITest { // Some stuff is hung off of the testing interface which is not enabled // by default. launch_arguments_.AppendSwitch(switches::kEnablePepperTesting); + + // Give unlimited quota for files to Pepper tests. + // TODO(dumi): remove this switch once we have a quota management + // system in place. + launch_arguments_.AppendSwitch(switches::kUnlimitedQuotaForFiles); } void RunTest(const std::string& test_case) { |