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

Unified Diff: content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc

Issue 867903005: [ServiceWorkerCache] Serialize ServiceWorkerCacheStorage operations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments from PS3 Created 5 years, 10 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
« no previous file with comments | « content/browser/service_worker/service_worker_cache_storage.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc
diff --git a/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc b/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc
index cb205835f32ae1d4b2477eaf863d65e52e115e85..cc8ec07a74138fa21a2fb8a129182e413826629d 100644
--- a/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc
+++ b/content/browser/service_worker/service_worker_cache_storage_manager_unittest.cc
@@ -22,7 +22,7 @@
namespace content {
class ServiceWorkerCacheStorageManagerTest : public testing::Test {
- protected:
+ public:
ServiceWorkerCacheStorageManagerTest()
: browser_thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP),
callback_bool_(false),
@@ -424,13 +424,13 @@ TEST_P(ServiceWorkerCacheStorageManagerTestP, StorageMatchInOneOfMany) {
}
TEST_P(ServiceWorkerCacheStorageManagerTestP, Chinese) {
- EXPECT_TRUE(Open(origin1_, "������"));
+ EXPECT_TRUE(Open(origin1_, "你好"));
scoped_refptr<ServiceWorkerCache> cache = callback_cache_;
- EXPECT_TRUE(Open(origin1_, "������"));
+ EXPECT_TRUE(Open(origin1_, "你好"));
EXPECT_EQ(callback_cache_.get(), cache.get());
EXPECT_TRUE(Keys(origin1_));
EXPECT_EQ(1u, callback_strings_.size());
- EXPECT_STREQ("������", callback_strings_[0].c_str());
+ EXPECT_STREQ("你好", callback_strings_[0].c_str());
}
TEST_F(ServiceWorkerCacheStorageManagerTest, EmptyKey) {
@@ -522,6 +522,25 @@ TEST_P(ServiceWorkerCacheStorageManagerTestP, DeleteBeforeRelease) {
EXPECT_TRUE(callback_cache_->AsWeakPtr());
}
+TEST_P(ServiceWorkerCacheStorageManagerTestP, OpenRunsSerially) {
+ EXPECT_FALSE(Delete(origin1_, "tmp")); // Init storage.
+ ServiceWorkerCacheStorage* cache_storage = CacheStorageForOrigin(origin1_);
+ cache_storage->StartAsyncOperationForTesting();
+
+ scoped_ptr<base::RunLoop> open_loop(new base::RunLoop());
+ cache_manager_->OpenCache(
+ origin1_, "foo",
+ base::Bind(&ServiceWorkerCacheStorageManagerTest::CacheAndErrorCallback,
+ base::Unretained(this), base::Unretained(open_loop.get())));
+
+ base::RunLoop().RunUntilIdle();
+ EXPECT_FALSE(callback_cache_);
+
+ cache_storage->CompleteAsyncOperationForTesting();
+ open_loop->Run();
+ EXPECT_TRUE(callback_cache_);
+}
+
TEST_F(ServiceWorkerCacheStorageManagerMemoryOnlyTest, MemoryBackedSize) {
ServiceWorkerCacheStorage* cache_storage = CacheStorageForOrigin(origin1_);
EXPECT_EQ(0, cache_storage->MemoryBackedSize());
« no previous file with comments | « content/browser/service_worker/service_worker_cache_storage.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698