OLD | NEW |
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/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/test/thread_test_helper.h" | 9 #include "base/test/thread_test_helper.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/storage_partition.h" |
13 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
14 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
15 #include "content/shell/shell.h" | 16 #include "content/shell/shell.h" |
16 #include "content/test/content_browser_test.h" | 17 #include "content/test/content_browser_test.h" |
17 #include "content/test/content_browser_test_utils.h" | 18 #include "content/test/content_browser_test_utils.h" |
18 #include "net/test/test_server.h" | 19 #include "net/test/test_server.h" |
19 #include "webkit/quota/quota_manager.h" | 20 #include "webkit/quota/quota_manager.h" |
20 | 21 |
21 using quota::QuotaManager; | 22 using quota::QuotaManager; |
22 | 23 |
(...skipping 25 matching lines...) Expand all Loading... |
48 }; | 49 }; |
49 | 50 |
50 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { | 51 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { |
51 public: | 52 public: |
52 virtual void SetUpOnMainThread() { | 53 virtual void SetUpOnMainThread() { |
53 const int kInitialQuotaKilobytes = 5000; | 54 const int kInitialQuotaKilobytes = 5000; |
54 const int kTemporaryStorageQuotaMaxSize = | 55 const int kTemporaryStorageQuotaMaxSize = |
55 kInitialQuotaKilobytes * 1024 * QuotaManager::kPerHostTemporaryPortion; | 56 kInitialQuotaKilobytes * 1024 * QuotaManager::kPerHostTemporaryPortion; |
56 SetTempQuota( | 57 SetTempQuota( |
57 kTemporaryStorageQuotaMaxSize, | 58 kTemporaryStorageQuotaMaxSize, |
58 BrowserContext::GetQuotaManager( | 59 BrowserContext::GetDefaultStoragePartition( |
59 shell()->web_contents()->GetBrowserContext())); | 60 shell()->web_contents()->GetBrowserContext())->GetQuotaManager()); |
60 } | 61 } |
61 | 62 |
62 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { | 63 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { |
63 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 64 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
64 BrowserThread::PostTask( | 65 BrowserThread::PostTask( |
65 BrowserThread::IO, FROM_HERE, | 66 BrowserThread::IO, FROM_HERE, |
66 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes, | 67 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes, |
67 qm)); | 68 qm)); |
68 return; | 69 return; |
69 } | 70 } |
(...skipping 13 matching lines...) Expand all Loading... |
83 | 84 |
84 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { | 85 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { |
85 SimpleTest(GetTestUrl("fileapi", "create_test.html")); | 86 SimpleTest(GetTestUrl("fileapi", "create_test.html")); |
86 } | 87 } |
87 | 88 |
88 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { | 89 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { |
89 SimpleTest(GetTestUrl("fileapi", "quota_test.html")); | 90 SimpleTest(GetTestUrl("fileapi", "quota_test.html")); |
90 } | 91 } |
91 | 92 |
92 } // namespace content | 93 } // namespace content |
OLD | NEW |