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

Unified Diff: content/browser/fileapi/blob_storage_context_unittest.cc

Issue 259773006: Allow BlobDataHandles to be copied, and have their UUIDs read, on any thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make comments more uniform Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/fileapi/blob_storage_context_unittest.cc
diff --git a/content/browser/fileapi/blob_storage_context_unittest.cc b/content/browser/fileapi/blob_storage_context_unittest.cc
index fd588801532f10b9062662e7197ddf2a0b8a3485..823679e585caf0f97f7fb0efbbff872e8e438e10 100644
--- a/content/browser/fileapi/blob_storage_context_unittest.cc
+++ b/content/browser/fileapi/blob_storage_context_unittest.cc
@@ -6,6 +6,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
#include "base/time/time.h"
#include "content/browser/fileapi/blob_storage_host.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -41,6 +42,10 @@ TEST(BlobStorageContextTest, IncrementDecrementRef) {
blob_data_handle = context.GetBlobDataFromUUID(kId);
EXPECT_TRUE(blob_data_handle);
blob_data_handle.reset();
+ { // Clean up for ASAN
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ }
// Make sure its still there after inc/dec.
EXPECT_TRUE(host.IncrementBlobRefCount(kId));
@@ -48,6 +53,10 @@ TEST(BlobStorageContextTest, IncrementDecrementRef) {
blob_data_handle = context.GetBlobDataFromUUID(kId);
EXPECT_TRUE(blob_data_handle);
blob_data_handle.reset();
+ { // Clean up for ASAN
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ }
// Make sure it goes away in the end.
EXPECT_TRUE(host.DecrementBlobRefCount(kId));
@@ -82,6 +91,10 @@ TEST(BlobStorageContextTest, BlobDataHandle) {
// Should disappear after dropping both handles.
blob_data_handle.reset();
another_handle.reset();
+ { // Clean up for ASAN
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ }
blob_data_handle = context.GetBlobDataFromUUID(kId);
EXPECT_FALSE(blob_data_handle);
}
@@ -131,6 +144,12 @@ TEST(BlobStorageContextTest, CompoundBlobs) {
blob_data_handle = context.AddFinishedBlob(blob_data2.get());
ASSERT_TRUE(blob_data_handle.get());
EXPECT_TRUE(*(blob_data_handle->data()) == *canonicalized_blob_data2.get());
+
+ blob_data_handle.reset();
+ { // Clean up for ASAN
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ }
}
TEST(BlobStorageContextTest, PublicBlobUrls) {
@@ -150,6 +169,10 @@ TEST(BlobStorageContextTest, PublicBlobUrls) {
ASSERT_TRUE(blob_data_handle.get());
EXPECT_EQ(kId, blob_data_handle->data()->uuid());
blob_data_handle.reset();
+ { // Clean up for ASAN
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ }
// The url registration should keep the blob alive even after
// explicit references are dropped.
@@ -157,6 +180,10 @@ TEST(BlobStorageContextTest, PublicBlobUrls) {
blob_data_handle = context.GetBlobDataFromPublicURL(kUrl);
EXPECT_TRUE(blob_data_handle);
blob_data_handle.reset();
+ { // Clean up for ASAN
+ base::RunLoop run_loop;
+ run_loop.RunUntilIdle();
+ }
// Finally get rid of the url registration and the blob.
EXPECT_TRUE(host.RevokePublicBlobURL(kUrl));

Powered by Google App Engine
This is Rietveld 408576698