OLD | NEW |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 EXPECT_FALSE(registry.DeleteEntry(kBlob1)); | 22 EXPECT_FALSE(registry.DeleteEntry(kBlob1)); |
23 EXPECT_EQ(0u, registry.blob_count()); | 23 EXPECT_EQ(0u, registry.blob_count()); |
24 | 24 |
25 Entry* entry = registry.CreateEntry(kBlob1, kType, kDisposition); | 25 Entry* entry = registry.CreateEntry(kBlob1, kType, kDisposition); |
26 ASSERT_NE(nullptr, entry); | 26 ASSERT_NE(nullptr, entry); |
27 EXPECT_EQ(BlobState::PENDING, entry->state); | 27 EXPECT_EQ(BlobState::PENDING, entry->state); |
28 EXPECT_EQ(kType, entry->content_type); | 28 EXPECT_EQ(kType, entry->content_type); |
29 EXPECT_EQ(kDisposition, entry->content_disposition); | 29 EXPECT_EQ(kDisposition, entry->content_disposition); |
30 EXPECT_EQ(1u, entry->refcount); | 30 EXPECT_EQ(1u, entry->refcount); |
31 EXPECT_FALSE(entry->data.get() || entry->data_builder.get()); | |
32 EXPECT_EQ(0u, entry->build_completion_callbacks.size()); | 31 EXPECT_EQ(0u, entry->build_completion_callbacks.size()); |
33 | 32 |
34 EXPECT_EQ(entry, registry.GetEntry(kBlob1)); | 33 EXPECT_EQ(entry, registry.GetEntry(kBlob1)); |
35 EXPECT_TRUE(registry.DeleteEntry(kBlob1)); | 34 EXPECT_TRUE(registry.DeleteEntry(kBlob1)); |
36 entry = registry.CreateEntry(kBlob1, kType, kDisposition); | 35 entry = registry.CreateEntry(kBlob1, kType, kDisposition); |
37 | 36 |
38 EXPECT_EQ(1u, registry.blob_count()); | 37 EXPECT_EQ(1u, registry.blob_count()); |
39 } | 38 } |
40 | 39 |
41 TEST(BlobStorageRegistry, URLRegistration) { | 40 TEST(BlobStorageRegistry, URLRegistration) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // Both urls point to the same blob. | 74 // Both urls point to the same blob. |
76 EXPECT_TRUE(registry.CreateUrlMapping(kURL2, kBlob)); | 75 EXPECT_TRUE(registry.CreateUrlMapping(kURL2, kBlob)); |
77 std::string uuid2; | 76 std::string uuid2; |
78 EXPECT_EQ(registry.GetEntryFromURL(kURL, &uuid), | 77 EXPECT_EQ(registry.GetEntryFromURL(kURL, &uuid), |
79 registry.GetEntryFromURL(kURL2, &uuid2)); | 78 registry.GetEntryFromURL(kURL2, &uuid2)); |
80 EXPECT_EQ(uuid, uuid2); | 79 EXPECT_EQ(uuid, uuid2); |
81 } | 80 } |
82 | 81 |
83 } // namespace | 82 } // namespace |
84 } // namespace storage | 83 } // namespace storage |
OLD | NEW |