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

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

Issue 2055053003: [BlobAsync] Disk support for blob storage (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_storage_registry.h" 5 #include "storage/browser/blob/blob_storage_registry.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
11 namespace storage { 11 namespace storage {
12 namespace { 12 namespace {
13 using Entry = BlobStorageRegistry::Entry; 13 using Entry = BlobStorageRegistry::Entry;
14 using BlobState = BlobStorageRegistry::BlobState;
15 14
16 TEST(BlobStorageRegistry, UUIDRegistration) { 15 TEST(BlobStorageRegistry, UUIDRegistration) {
17 const std::string kBlob1 = "Blob1"; 16 const std::string kBlob1 = "Blob1";
18 const std::string kType = "type1"; 17 const std::string kType = "type1";
19 const std::string kDisposition = "disp1"; 18 const std::string kDisposition = "disp1";
20 BlobStorageRegistry registry; 19 BlobStorageRegistry registry;
21 20
22 EXPECT_FALSE(registry.DeleteEntry(kBlob1)); 21 EXPECT_FALSE(registry.DeleteEntry(kBlob1));
23 EXPECT_EQ(0u, registry.blob_count()); 22 EXPECT_EQ(0u, registry.blob_count());
24 23
25 Entry* entry = registry.CreateEntry(kBlob1, kType, kDisposition); 24 Entry* entry = registry.CreateEntry(kBlob1, kType, kDisposition);
26 ASSERT_NE(nullptr, entry); 25 ASSERT_NE(nullptr, entry);
27 EXPECT_EQ(BlobState::PENDING, entry->state); 26 EXPECT_EQ(BlobStatus::PENDING, entry->status);
28 EXPECT_EQ(kType, entry->content_type); 27 EXPECT_EQ(kType, entry->content_type);
29 EXPECT_EQ(kDisposition, entry->content_disposition); 28 EXPECT_EQ(kDisposition, entry->content_disposition);
30 EXPECT_EQ(1u, entry->refcount); 29 EXPECT_EQ(0u, entry->refcount);
31 EXPECT_FALSE(entry->data.get() || entry->data_builder.get());
32 EXPECT_EQ(0u, entry->build_completion_callbacks.size()); 30 EXPECT_EQ(0u, entry->build_completion_callbacks.size());
33 31
34 EXPECT_EQ(entry, registry.GetEntry(kBlob1)); 32 EXPECT_EQ(entry, registry.GetEntry(kBlob1));
35 EXPECT_TRUE(registry.DeleteEntry(kBlob1)); 33 EXPECT_TRUE(registry.DeleteEntry(kBlob1));
36 entry = registry.CreateEntry(kBlob1, kType, kDisposition); 34 entry = registry.CreateEntry(kBlob1, kType, kDisposition);
37 35
38 EXPECT_EQ(1u, registry.blob_count()); 36 EXPECT_EQ(1u, registry.blob_count());
39 } 37 }
40 38
41 TEST(BlobStorageRegistry, URLRegistration) { 39 TEST(BlobStorageRegistry, URLRegistration) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // Both urls point to the same blob. 73 // Both urls point to the same blob.
76 EXPECT_TRUE(registry.CreateUrlMapping(kURL2, kBlob)); 74 EXPECT_TRUE(registry.CreateUrlMapping(kURL2, kBlob));
77 std::string uuid2; 75 std::string uuid2;
78 EXPECT_EQ(registry.GetEntryFromURL(kURL, &uuid), 76 EXPECT_EQ(registry.GetEntryFromURL(kURL, &uuid),
79 registry.GetEntryFromURL(kURL2, &uuid2)); 77 registry.GetEntryFromURL(kURL2, &uuid2));
80 EXPECT_EQ(uuid, uuid2); 78 EXPECT_EQ(uuid, uuid2);
81 } 79 }
82 80
83 } // namespace 81 } // namespace
84 } // namespace storage 82 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698