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

Side by Side Diff: content/browser/fileapi/file_system_browsertest.cc

Issue 2592793002: Revert of Change how the quota system computes the total poolsize for temporary storage (Closed)
Patch Set: Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 the_browser, "window.domAutomationController.send(getLog())", 48 the_browser, "window.domAutomationController.send(getLog())",
49 &js_result)); 49 &js_result));
50 FAIL() << "Failed: " << js_result; 50 FAIL() << "Failed: " << js_result;
51 } 51 }
52 } 52 }
53 }; 53 };
54 54
55 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { 55 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest {
56 public: 56 public:
57 void SetUpOnMainThread() override { 57 void SetUpOnMainThread() override {
58 SetLowQuota(BrowserContext::GetDefaultStoragePartition( 58 const int kInitialQuotaKilobytes = 5000;
59 shell()->web_contents()->GetBrowserContext()) 59 const int kTemporaryStorageQuotaMaxSize =
60 ->GetQuotaManager()); 60 kInitialQuotaKilobytes * 1024 * QuotaManager::kPerHostTemporaryPortion;
61 SetTempQuota(
62 kTemporaryStorageQuotaMaxSize,
63 BrowserContext::GetDefaultStoragePartition(
64 shell()->web_contents()->GetBrowserContext())->GetQuotaManager());
61 } 65 }
62 66
63 static void SetLowQuota(scoped_refptr<QuotaManager> qm) { 67 static void SetTempQuota(int64_t bytes, scoped_refptr<QuotaManager> qm) {
64 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 68 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
65 BrowserThread::PostTask( 69 BrowserThread::PostTask(
66 BrowserThread::IO, FROM_HERE, 70 BrowserThread::IO, FROM_HERE,
67 base::Bind(&FileSystemBrowserTestWithLowQuota::SetLowQuota, qm)); 71 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes,
72 qm));
68 return; 73 return;
69 } 74 }
70 DCHECK_CURRENTLY_ON(BrowserThread::IO); 75 DCHECK_CURRENTLY_ON(BrowserThread::IO);
71 // These sizes must correspond with expectations in html and js. 76 qm->SetTemporaryGlobalOverrideQuota(bytes, storage::QuotaCallback());
72 const int kMeg = 1000 * 1024; 77 // Don't return until the quota has been set.
73 storage::QuotaSettings settings; 78 scoped_refptr<base::ThreadTestHelper> helper(new base::ThreadTestHelper(
74 settings.pool_size = 25 * kMeg; 79 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB).get()));
75 settings.per_host_quota = 5 * kMeg; 80 ASSERT_TRUE(helper->Run());
76 settings.must_remain_available = 100 * kMeg;
77 settings.refresh_interval = base::TimeDelta::Max();
78 qm->SetQuotaSettings(settings);
79 } 81 }
80 }; 82 };
81 83
82 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, RequestTest) { 84 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, RequestTest) {
83 SimpleTest(GetTestUrl("fileapi", "request_test.html")); 85 SimpleTest(GetTestUrl("fileapi", "request_test.html"));
84 } 86 }
85 87
86 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { 88 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) {
87 SimpleTest(GetTestUrl("fileapi", "create_test.html")); 89 SimpleTest(GetTestUrl("fileapi", "create_test.html"));
88 } 90 }
89 91
90 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { 92 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) {
91 SimpleTest(GetTestUrl("fileapi", "quota_test.html")); 93 SimpleTest(GetTestUrl("fileapi", "quota_test.html"));
92 } 94 }
93 95
94 } // namespace content 96 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/database_tracker_unittest.cc ('k') | content/browser/fileapi/obfuscated_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698