| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 } | 51 } |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { | 54 class FileSystemBrowserTestWithLowQuota : public FileSystemBrowserTest { |
| 55 public: | 55 public: |
| 56 virtual void SetUpOnMainThread() { | 56 virtual void SetUpOnMainThread() { |
| 57 const int kInitialQuotaKilobytes = 5000; | 57 const int kInitialQuotaKilobytes = 5000; |
| 58 const int kTemporaryStorageQuotaMaxSize = | 58 const int kTemporaryStorageQuotaMaxSize = |
| 59 kInitialQuotaKilobytes * 1024 * QuotaManager::kPerHostTemporaryPortion; | 59 kInitialQuotaKilobytes * 1024 * QuotaManager::kPerHostTemporaryPortion; |
| 60 SetTempQuota( | 60 SetTempQuota( |
| 61 kTemporaryStorageQuotaMaxSize, browser()->profile()->GetQuotaManager()); | 61 kTemporaryStorageQuotaMaxSize, |
| 62 content::BrowserContext::GetQuotaManager(browser()->profile())); |
| 62 } | 63 } |
| 63 | 64 |
| 64 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { | 65 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { |
| 65 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 66 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 66 BrowserThread::PostTask( | 67 BrowserThread::PostTask( |
| 67 BrowserThread::IO, FROM_HERE, | 68 BrowserThread::IO, FROM_HERE, |
| 68 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes, | 69 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes, |
| 69 qm)); | 70 qm)); |
| 70 return; | 71 return; |
| 71 } | 72 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 83 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html")))); | 84 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html")))); |
| 84 } | 85 } |
| 85 | 86 |
| 86 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { | 87 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { |
| 87 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html")))); | 88 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html")))); |
| 88 } | 89 } |
| 89 | 90 |
| 90 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { | 91 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { |
| 91 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); | 92 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); |
| 92 } | 93 } |
| OLD | NEW |