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/command_line.h" | 6 #include "base/command_line.h" |
6 #include "base/file_path.h" | 7 #include "base/file_path.h" |
7 #include "base/file_util.h" | 8 #include "base/file_util.h" |
8 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
9 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
10 #include "base/test/thread_test_helper.h" | 11 #include "base/test/thread_test_helper.h" |
11 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/test/base/in_process_browser_test.h" | 14 #include "chrome/test/base/in_process_browser_test.h" |
14 #include "chrome/test/base/testing_profile.h" | 15 #include "chrome/test/base/testing_profile.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 227 } |
227 | 228 |
228 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { | 229 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { |
229 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 230 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
230 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 231 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
231 NewRunnableFunction(&IndexedDBBrowserTestWithLowQuota::SetTempQuota, | 232 NewRunnableFunction(&IndexedDBBrowserTestWithLowQuota::SetTempQuota, |
232 bytes, qm)); | 233 bytes, qm)); |
233 return; | 234 return; |
234 } | 235 } |
235 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 236 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
236 qm->SetTemporaryGlobalOverrideQuota(bytes, NULL); | 237 qm->SetTemporaryGlobalOverrideQuota(bytes, quota::QuotaCallback()); |
237 // Don't return until the quota has been set. | 238 // Don't return until the quota has been set. |
238 scoped_refptr<base::ThreadTestHelper> helper( | 239 scoped_refptr<base::ThreadTestHelper> helper( |
239 new base::ThreadTestHelper( | 240 new base::ThreadTestHelper( |
240 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); | 241 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); |
241 ASSERT_TRUE(helper->Run()); | 242 ASSERT_TRUE(helper->Run()); |
242 } | 243 } |
243 | 244 |
244 }; | 245 }; |
245 | 246 |
246 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) { | 247 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithLowQuota, QuotaTest) { |
247 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); | 248 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); |
248 } | 249 } |
249 | 250 |
250 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { | 251 class IndexedDBBrowserTestWithGCExposed : public IndexedDBBrowserTest { |
251 public: | 252 public: |
252 virtual void SetUpCommandLine(CommandLine* command_line) { | 253 virtual void SetUpCommandLine(CommandLine* command_line) { |
253 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); | 254 command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose-gc"); |
254 } | 255 } |
255 }; | 256 }; |
256 | 257 |
257 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, | 258 IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTestWithGCExposed, |
258 DatabaseCallbacksTest) { | 259 DatabaseCallbacksTest) { |
259 SimpleTest( | 260 SimpleTest( |
260 testUrl(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); | 261 testUrl(FilePath(FILE_PATH_LITERAL("database_callbacks_first.html")))); |
261 } | 262 } |
OLD | NEW |