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

Side by Side Diff: content/browser/blob_storage/blob_memory_controller_unittest.cc

Issue 2448353002: [BlobAsync] Moving async handling into BlobStorageContext & quota out. (Closed)
Patch Set: comments Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/blob/blob_memory_controller.h" 5 #include "storage/browser/blob/blob_memory_controller.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 RunFileThreadTasks(); 50 RunFileThreadTasks();
51 base::RunLoop().RunUntilIdle(); 51 base::RunLoop().RunUntilIdle();
52 base::ThreadRestrictions::SetIOAllowed(true); 52 base::ThreadRestrictions::SetIOAllowed(true);
53 ASSERT_TRUE(temp_dir_.Delete()); 53 ASSERT_TRUE(temp_dir_.Delete());
54 } 54 }
55 55
56 std::vector<scoped_refptr<ShareableBlobDataItem>> CreateSharedDataItems( 56 std::vector<scoped_refptr<ShareableBlobDataItem>> CreateSharedDataItems(
57 const BlobDataBuilder& builder) { 57 const BlobDataBuilder& builder) {
58 std::vector<scoped_refptr<ShareableBlobDataItem>> result; 58 std::vector<scoped_refptr<ShareableBlobDataItem>> result;
59 for (size_t i = 0; i < builder.items_.size(); ++i) { 59 for (size_t i = 0; i < builder.items_.size(); ++i) {
60 result.push_back(make_scoped_refptr( 60 result.push_back(make_scoped_refptr(new ShareableBlobDataItem(
61 new ShareableBlobDataItem(builder.uuid(), builder.items_[i], 61 builder.items_[i], ShareableBlobDataItem::QUOTA_NEEDED)));
62 ShareableBlobDataItem::QUOTA_NEEDED)));
63 } 62 }
64 return result; 63 return result;
65 } 64 }
66 65
67 void SetTestMemoryLimits(BlobMemoryController* controller) { 66 void SetTestMemoryLimits(BlobMemoryController* controller) {
68 BlobStorageLimits limits; 67 BlobStorageLimits limits;
69 limits.max_ipc_memory_size = kTestBlobStorageIPCThresholdBytes; 68 limits.max_ipc_memory_size = kTestBlobStorageIPCThresholdBytes;
70 limits.max_shared_memory_size = kTestBlobStorageMaxSharedMemoryBytes; 69 limits.max_shared_memory_size = kTestBlobStorageMaxSharedMemoryBytes;
71 limits.max_blob_in_memory_space = kTestBlobStorageMaxBlobMemorySize; 70 limits.max_blob_in_memory_space = kTestBlobStorageMaxBlobMemorySize;
72 limits.max_blob_disk_space = kTestBlobStorageMaxDiskSpace; 71 limits.max_blob_disk_space = kTestBlobStorageMaxDiskSpace;
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 file_items.clear(); 671 file_items.clear();
673 items.clear(); 672 items.clear();
674 673
675 RunFileThreadTasks(); 674 RunFileThreadTasks();
676 base::RunLoop().RunUntilIdle(); 675 base::RunLoop().RunUntilIdle();
677 676
678 EXPECT_EQ(0ull, controller.disk_usage()); 677 EXPECT_EQ(0ull, controller.disk_usage());
679 EXPECT_EQ(0ull, controller.memory_usage()); 678 EXPECT_EQ(0ull, controller.memory_usage());
680 } 679 }
681 } // namespace storage 680 } // namespace storage
OLDNEW
« no previous file with comments | « content/browser/blob_storage/blob_flattener_unittest.cc ('k') | content/browser/blob_storage/blob_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698