summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorjsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-01 04:01:53 +0000
committerjsbell@chromium.org <jsbell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-01 04:01:53 +0000
commit931c5f253c823366acd69626d5405bf994d4527f (patch)
tree58ddaf1e82dfca9d990c5ec74d85379dbe692802 /content
parent3adac5ee52fe8de0e92657e94a5ffe07237de494 (diff)
downloadchromium_src-931c5f253c823366acd69626d5405bf994d4527f.zip
chromium_src-931c5f253c823366acd69626d5405bf994d4527f.tar.gz
chromium_src-931c5f253c823366acd69626d5405bf994d4527f.tar.bz2
IndexedDB: Re-implement refcounting checks in IndexedDBFactory unit tests.
Since exact reference counts are private these checks were left as TODOs in the initial migration. Implement the tests indirectly using HasOneRef() BUG=234278 R=alecflett@chromium.org Review URL: https://chromiumcodereview.appspot.com/16266013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/indexed_db/indexed_db_backing_store_unittest.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
index 0e60d7b..fbef981 100644
--- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
+++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc
@@ -359,14 +359,15 @@ TEST(IndexedDBFactoryTest, BackingStoreLifetime) {
scoped_refptr<IndexedDBBackingStore> disk_store2 =
factory->TestOpenBackingStore(origin1, temp_directory.path());
EXPECT_EQ(disk_store1.get(), disk_store2.get());
- // TODO(alecflett): Verify refcount indirectly.
- // EXPECT_EQ(2, disk_store2->RefCount());
+ EXPECT_FALSE(disk_store2->HasOneRef());
scoped_refptr<IndexedDBBackingStore> disk_store3 =
factory->TestOpenBackingStore(origin2, temp_directory.path());
EXPECT_TRUE(disk_store3->HasOneRef());
- // TODO(alecflett): Verify refcount indirectly.
- // EXPECT_EQ(2, disk_store1->RefCount());
+ EXPECT_FALSE(disk_store1->HasOneRef());
+
+ disk_store2 = NULL;
+ EXPECT_TRUE(disk_store1->HasOneRef());
}
TEST(IndexedDBFactoryTest, MemoryBackingStoreLifetime) {
@@ -378,24 +379,26 @@ TEST(IndexedDBFactoryTest, MemoryBackingStoreLifetime) {
scoped_refptr<MockIDBFactory> factory = MockIDBFactory::Create();
scoped_refptr<IndexedDBBackingStore> mem_store1 =
factory->TestOpenBackingStore(origin1, base::FilePath());
- // TODO(alecflett): Verify refcount indirectly.
- // EXPECT_EQ(2, mem_store1->RefCount());
+ EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1 and factory
+
scoped_refptr<IndexedDBBackingStore> mem_store2 =
factory->TestOpenBackingStore(origin1, base::FilePath());
EXPECT_EQ(mem_store1.get(), mem_store2.get());
- // TODO(alecflett): Verify refcount indirectly.
- // EXPECT_EQ(3, mem_store2->RefCount());
+ EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1, 2 and factory
+ EXPECT_FALSE(mem_store2->HasOneRef()); // mem_store1, 2 and factory
scoped_refptr<IndexedDBBackingStore> mem_store3 =
factory->TestOpenBackingStore(origin2, base::FilePath());
- // TODO(alecflett): Verify refcount indirectly.
- // EXPECT_EQ(2, mem_store3->RefCount());
- // EXPECT_EQ(3, mem_store1->RefCount());
+ EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1, 2 and factory
+ EXPECT_FALSE(mem_store3->HasOneRef()); // mem_store3 and factory
factory = NULL;
- // TODO(alecflett): Verify refcount indirectly.
- // EXPECT_EQ(2, mem_store1->RefCount());
- // EXPECT_EQ(1, mem_store3->RefCount());
+ EXPECT_FALSE(mem_store1->HasOneRef()); // mem_store1 and 2
+ EXPECT_FALSE(mem_store2->HasOneRef()); // mem_store1 and 2
+ EXPECT_TRUE(mem_store3->HasOneRef());
+
+ mem_store2 = NULL;
+ EXPECT_TRUE(mem_store1->HasOneRef());
}
} // namespace