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

Side by Side Diff: content/browser/renderer_host/pepper/quota_reservation_unittest.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/renderer_host/pepper/quota_reservation.h" 5 #include "content/browser/renderer_host/pepper/quota_reservation.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/file.h" 9 #include "base/files/file.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/location.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/single_thread_task_runner.h"
15 #include "base/thread_task_runner_handle.h"
14 #include "storage/browser/fileapi/quota/quota_reservation.h" 16 #include "storage/browser/fileapi/quota/quota_reservation.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 18
17 using storage::QuotaReservationManager; 19 using storage::QuotaReservationManager;
18 20
19 namespace content { 21 namespace content {
20 22
21 namespace { 23 namespace {
22 24
23 const char kOrigin[] = "http://example.com"; 25 const char kOrigin[] = "http://example.com";
24 const storage::FileSystemType kType = storage::kFileSystemTypeTemporary; 26 const storage::FileSystemType kType = storage::kFileSystemTypeTemporary;
25 27
26 const base::FilePath::StringType file1_name = FILE_PATH_LITERAL("file1"); 28 const base::FilePath::StringType file1_name = FILE_PATH_LITERAL("file1");
27 const base::FilePath::StringType file2_name = FILE_PATH_LITERAL("file2"); 29 const base::FilePath::StringType file2_name = FILE_PATH_LITERAL("file2");
28 const base::FilePath::StringType file3_name = FILE_PATH_LITERAL("file3"); 30 const base::FilePath::StringType file3_name = FILE_PATH_LITERAL("file3");
29 const int kFile1ID = 1; 31 const int kFile1ID = 1;
30 const int kFile2ID = 2; 32 const int kFile2ID = 2;
31 const int kFile3ID = 3; 33 const int kFile3ID = 3;
32 34
33 class FakeBackend : public QuotaReservationManager::QuotaBackend { 35 class FakeBackend : public QuotaReservationManager::QuotaBackend {
34 public: 36 public:
35 FakeBackend() {} 37 FakeBackend() {}
36 ~FakeBackend() override {} 38 ~FakeBackend() override {}
37 39
38 void ReserveQuota( 40 void ReserveQuota(
39 const GURL& origin, 41 const GURL& origin,
40 storage::FileSystemType type, 42 storage::FileSystemType type,
41 int64 delta, 43 int64 delta,
42 const QuotaReservationManager::ReserveQuotaCallback& callback) override { 44 const QuotaReservationManager::ReserveQuotaCallback& callback) override {
43 base::MessageLoopProxy::current()->PostTask( 45 base::ThreadTaskRunnerHandle::Get()->PostTask(
44 FROM_HERE, 46 FROM_HERE,
45 base::Bind(base::IgnoreResult(callback), base::File::FILE_OK, delta)); 47 base::Bind(base::IgnoreResult(callback), base::File::FILE_OK, delta));
46 } 48 }
47 49
48 void ReleaseReservedQuota(const GURL& origin, 50 void ReleaseReservedQuota(const GURL& origin,
49 storage::FileSystemType type, 51 storage::FileSystemType type,
50 int64 size) override {} 52 int64 size) override {}
51 53
52 void CommitQuotaUsage(const GURL& origin, 54 void CommitQuotaUsage(const GURL& origin,
53 storage::FileSystemType type, 55 storage::FileSystemType type,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 EXPECT_EQ(amount, reserved_quota); 237 EXPECT_EQ(amount, reserved_quota);
236 EXPECT_EQ(2U, file_growths.size()); 238 EXPECT_EQ(2U, file_growths.size());
237 EXPECT_EQ(file1_size, file_growths[kFile1ID].max_written_offset); 239 EXPECT_EQ(file1_size, file_growths[kFile1ID].max_written_offset);
238 EXPECT_EQ(file3_size, file_growths[kFile3ID].max_written_offset); 240 EXPECT_EQ(file3_size, file_growths[kFile3ID].max_written_offset);
239 241
240 test->CloseFile(kFile1ID, ppapi::FileGrowth(file1_size, 0)); 242 test->CloseFile(kFile1ID, ppapi::FileGrowth(file1_size, 0));
241 test->CloseFile(kFile3ID, ppapi::FileGrowth(file3_size, 0)); 243 test->CloseFile(kFile3ID, ppapi::FileGrowth(file3_size, 0));
242 } 244 }
243 245
244 } // namespace content 246 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698