OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 canonicalized_blob_data2->AppendFile( | 114 canonicalized_blob_data2->AppendFile( |
115 base::FilePath(FILE_PATH_LITERAL("File1.txt")), | 115 base::FilePath(FILE_PATH_LITERAL("File1.txt")), |
116 10, 98, time1); | 116 10, 98, time1); |
117 canonicalized_blob_data2->AppendFile( | 117 canonicalized_blob_data2->AppendFile( |
118 base::FilePath(FILE_PATH_LITERAL("File2.txt")), 0, 20, time2); | 118 base::FilePath(FILE_PATH_LITERAL("File2.txt")), 0, 20, time2); |
119 | 119 |
120 BlobStorageContext context; | 120 BlobStorageContext context; |
121 scoped_ptr<BlobDataHandle> blob_data_handle; | 121 scoped_ptr<BlobDataHandle> blob_data_handle; |
122 | 122 |
123 // Test a blob referring to only data and a file. | 123 // Test a blob referring to only data and a file. |
124 blob_data_handle = context.AddFinishedBlob(blob_data1); | 124 blob_data_handle = context.AddFinishedBlob(blob_data1.get()); |
125 ASSERT_TRUE(blob_data_handle.get()); | 125 ASSERT_TRUE(blob_data_handle.get()); |
126 EXPECT_TRUE(*(blob_data_handle->data()) == *blob_data1); | 126 EXPECT_TRUE(*(blob_data_handle->data()) == *blob_data1.get()); |
127 | 127 |
128 // Test a blob composed in part with another blob. | 128 // Test a blob composed in part with another blob. |
129 blob_data_handle = context.AddFinishedBlob(blob_data2); | 129 blob_data_handle = context.AddFinishedBlob(blob_data2.get()); |
130 ASSERT_TRUE(blob_data_handle.get()); | 130 ASSERT_TRUE(blob_data_handle.get()); |
131 EXPECT_TRUE(*(blob_data_handle->data()) == *canonicalized_blob_data2); | 131 EXPECT_TRUE(*(blob_data_handle->data()) == *canonicalized_blob_data2.get()); |
132 } | 132 } |
133 | 133 |
134 TEST(BlobStorageContextTest, PublicBlobUrls) { | 134 TEST(BlobStorageContextTest, PublicBlobUrls) { |
135 BlobStorageContext context; | 135 BlobStorageContext context; |
136 BlobStorageHost host(&context); | 136 BlobStorageHost host(&context); |
137 base::MessageLoop fake_io_message_loop; | 137 base::MessageLoop fake_io_message_loop; |
138 | 138 |
139 // Build up a basic blob. | 139 // Build up a basic blob. |
140 const std::string kId("id"); | 140 const std::string kId("id"); |
141 SetupBasicBlob(&host, kId); | 141 SetupBasicBlob(&host, kId); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 item.SetToBytes("1", 1); | 197 item.SetToBytes("1", 1); |
198 EXPECT_FALSE(host.AppendBlobDataItem(kId, item)); | 198 EXPECT_FALSE(host.AppendBlobDataItem(kId, item)); |
199 EXPECT_FALSE(host.FinishBuildingBlob(kId, "text/plain")); | 199 EXPECT_FALSE(host.FinishBuildingBlob(kId, "text/plain")); |
200 EXPECT_FALSE(host.RegisterPublicBlobURL(kUrl, kId)); | 200 EXPECT_FALSE(host.RegisterPublicBlobURL(kUrl, kId)); |
201 EXPECT_FALSE(host.IncrementBlobRefCount(kId)); | 201 EXPECT_FALSE(host.IncrementBlobRefCount(kId)); |
202 EXPECT_FALSE(host.DecrementBlobRefCount(kId)); | 202 EXPECT_FALSE(host.DecrementBlobRefCount(kId)); |
203 EXPECT_FALSE(host.RevokePublicBlobURL(kUrl)); | 203 EXPECT_FALSE(host.RevokePublicBlobURL(kUrl)); |
204 } | 204 } |
205 | 205 |
206 } // namespace webkit_blob | 206 } // namespace webkit_blob |
OLD | NEW |