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

Side by Side Diff: content/browser/quota/quota_reservation_manager_unittest.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "storage/browser/fileapi/quota/quota_reservation_manager.h" 5 #include "storage/browser/fileapi/quota/quota_reservation_manager.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/location.h" 12 #include "base/message_loop/message_loop.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"
16 #include "storage/browser/fileapi/quota/open_file_handle.h" 14 #include "storage/browser/fileapi/quota/open_file_handle.h"
17 #include "storage/browser/fileapi/quota/quota_reservation.h" 15 #include "storage/browser/fileapi/quota/quota_reservation.h"
18 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
19 17
20 using storage::kFileSystemTypeTemporary; 18 using storage::kFileSystemTypeTemporary;
21 using storage::OpenFileHandle; 19 using storage::OpenFileHandle;
22 using storage::QuotaReservation; 20 using storage::QuotaReservation;
23 using storage::QuotaReservationManager; 21 using storage::QuotaReservationManager;
24 22
25 namespace content { 23 namespace content {
(...skipping 25 matching lines...) Expand all
51 on_disk_usage_(kInitialFileSize) {} 49 on_disk_usage_(kInitialFileSize) {}
52 ~FakeBackend() override {} 50 ~FakeBackend() override {}
53 51
54 void ReserveQuota(const GURL& origin, 52 void ReserveQuota(const GURL& origin,
55 storage::FileSystemType type, 53 storage::FileSystemType type,
56 int64 delta, 54 int64 delta,
57 const ReserveQuotaCallback& callback) override { 55 const ReserveQuotaCallback& callback) override {
58 EXPECT_EQ(GURL(kOrigin), origin); 56 EXPECT_EQ(GURL(kOrigin), origin);
59 EXPECT_EQ(kType, type); 57 EXPECT_EQ(kType, type);
60 on_memory_usage_ += delta; 58 on_memory_usage_ += delta;
61 base::ThreadTaskRunnerHandle::Get()->PostTask( 59 base::MessageLoopProxy::current()->PostTask(
62 FROM_HERE, 60 FROM_HERE,
63 base::Bind(base::IgnoreResult(callback), base::File::FILE_OK, delta)); 61 base::Bind(base::IgnoreResult(callback), base::File::FILE_OK, delta));
64 } 62 }
65 63
66 void ReleaseReservedQuota(const GURL& origin, 64 void ReleaseReservedQuota(const GURL& origin,
67 storage::FileSystemType type, 65 storage::FileSystemType type,
68 int64 size) override { 66 int64 size) override {
69 EXPECT_LE(0, size); 67 EXPECT_LE(0, size);
70 EXPECT_EQ(GURL(kOrigin), origin); 68 EXPECT_EQ(GURL(kOrigin), origin);
71 EXPECT_EQ(kType, type); 69 EXPECT_EQ(kType, type);
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 356
359 EXPECT_EQ(kInitialFileSize + 10, GetFileSize(file_path())); 357 EXPECT_EQ(kInitialFileSize + 10, GetFileSize(file_path()));
360 EXPECT_EQ(kInitialFileSize + 15 + 20, fake_backend()->on_memory_usage()); 358 EXPECT_EQ(kInitialFileSize + 15 + 20, fake_backend()->on_memory_usage());
361 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_disk_usage()); 359 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_disk_usage());
362 360
363 reservation2 = NULL; 361 reservation2 = NULL;
364 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_memory_usage()); 362 EXPECT_EQ(kInitialFileSize + 10, fake_backend()->on_memory_usage());
365 } 363 }
366 364
367 } // namespace content 365 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/quota/quota_manager_unittest.cc ('k') | content/browser/quota/quota_temporary_storage_evictor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698