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

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

Issue 8536037: base::Bind: Low-hanging fruit conversions of NewRunnableFunction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix 4. Created 9 years, 1 month 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
« no previous file with comments | « content/browser/browser_thread_unittest.cc ('k') | content/browser/plugin_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, browser()->profile()->GetQuotaManager());
62 } 62 }
63 63
64 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) { 64 static void SetTempQuota(int64 bytes, scoped_refptr<QuotaManager> qm) {
65 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { 65 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
66 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, 66 BrowserThread::PostTask(
67 NewRunnableFunction(&FileSystemBrowserTestWithLowQuota::SetTempQuota, 67 BrowserThread::IO, FROM_HERE,
68 bytes, qm)); 68 base::Bind(&FileSystemBrowserTestWithLowQuota::SetTempQuota, bytes,
69 qm));
69 return; 70 return;
70 } 71 }
71 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 72 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
72 qm->SetTemporaryGlobalOverrideQuota(bytes, quota::QuotaCallback()); 73 qm->SetTemporaryGlobalOverrideQuota(bytes, quota::QuotaCallback());
73 // Don't return until the quota has been set. 74 // Don't return until the quota has been set.
74 scoped_refptr<base::ThreadTestHelper> helper( 75 scoped_refptr<base::ThreadTestHelper> helper(
75 new base::ThreadTestHelper( 76 new base::ThreadTestHelper(
76 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB))); 77 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB)));
77 ASSERT_TRUE(helper->Run()); 78 ASSERT_TRUE(helper->Run());
78 } 79 }
79 }; 80 };
80 81
81 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, RequestTest) { 82 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, RequestTest) {
82 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html")))); 83 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("request_test.html"))));
83 } 84 }
84 85
85 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) { 86 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTest, CreateTest) {
86 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html")))); 87 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("create_test.html"))));
87 } 88 }
88 89
89 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) { 90 IN_PROC_BROWSER_TEST_F(FileSystemBrowserTestWithLowQuota, QuotaTest) {
90 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html")))); 91 SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("quota_test.html"))));
91 } 92 }
OLDNEW
« no previous file with comments | « content/browser/browser_thread_unittest.cc ('k') | content/browser/plugin_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698