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

Side by Side Diff: content/browser/in_process_webkit/indexed_db_browsertest.cc

Issue 10834264: Add BrowserContext::GetQuotaManagerForRenderProcess for the isolated app feature. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/process_util.h" 11 #include "base/process_util.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "base/test/thread_test_helper.h" 13 #include "base/test/thread_test_helper.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "content/browser/in_process_webkit/indexed_db_context_impl.h" 15 #include "content/browser/in_process_webkit/indexed_db_context_impl.h"
16 #include "content/browser/web_contents/web_contents_impl.h" 16 #include "content/browser/web_contents/web_contents_impl.h"
17 #include "content/public/browser/browser_context.h" 17 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/render_process_host.h" 19 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/storage_partition.h"
20 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
21 #include "content/public/common/content_paths.h" 22 #include "content/public/common/content_paths.h"
22 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
23 #include "content/public/common/url_constants.h" 24 #include "content/public/common/url_constants.h"
24 #include "content/public/test/browser_test_utils.h" 25 #include "content/public/test/browser_test_utils.h"
25 #include "content/shell/shell.h" 26 #include "content/shell/shell.h"
26 #include "content/test/content_browser_test.h" 27 #include "content/test/content_browser_test.h"
27 #include "content/test/content_browser_test_utils.h" 28 #include "content/test/content_browser_test_utils.h"
28 #include "net/base/net_util.h" 29 #include "net/base/net_util.h"
29 #include "webkit/database/database_util.h" 30 #include "webkit/database/database_util.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 150 }
150 151
151 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest { 152 class IndexedDBBrowserTestWithLowQuota : public IndexedDBBrowserTest {
152 public: 153 public:
153 virtual void SetUpOnMainThread() { 154 virtual void SetUpOnMainThread() {
154 const int kInitialQuotaKilobytes = 5000; 155 const int kInitialQuotaKilobytes = 5000;
155 const int kTemporaryStorageQuotaMaxSize = kInitialQuotaKilobytes 156 const int kTemporaryStorageQuotaMaxSize = kInitialQuotaKilobytes
156 * 1024 * QuotaManager::kPerHostTemporaryPortion; 157 * 1024 * QuotaManager::kPerHostTemporaryPortion;
157 SetTempQuota( 158 SetTempQuota(
158 kTemporaryStorageQuotaMaxSize, 159 kTemporaryStorageQuotaMaxSize,
159 BrowserContext::GetQuotaManager( 160 BrowserContext::GetDefaultStoragePartition(
160 shell()->web_contents()->GetBrowserContext())); 161 shell()->web_contents()->GetBrowserContext())->GetQuotaManager());
161 } 162 }
162 163
163 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { 164 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) {
164 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 165 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
165 BrowserThread::PostTask( 166 BrowserThread::PostTask(
166 BrowserThread::IO, FROM_HERE, 167 BrowserThread::IO, FROM_HERE,
167 base::Bind(&IndexedDBBrowserTestWithLowQuota::SetTempQuota, bytes, 168 base::Bind(&IndexedDBBrowserTestWithLowQuota::SetTempQuota, bytes,
168 qm)); 169 qm));
169 return; 170 return;
170 } 171 }
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16); 280 TitleWatcher title_watcher(new_shell->web_contents(), expected_title16);
280 281
281 base::KillProcess( 282 base::KillProcess(
282 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true); 283 shell()->web_contents()->GetRenderProcessHost()->GetHandle(), 0, true);
283 shell()->Close(); 284 shell()->Close();
284 285
285 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); 286 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
286 } 287 }
287 288
288 } // namespace content 289 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/file_system_browsertest.cc ('k') | content/browser/storage_partition_impl_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698