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

Unified Diff: webkit/dom_storage/dom_storage_context_unittest.cc

Issue 10546167: Create and store persistent unique ids for sessionStorage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: code review Created 8 years, 6 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 | « webkit/dom_storage/dom_storage_context.cc ('k') | webkit/dom_storage/dom_storage_namespace.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_context_unittest.cc
diff --git a/webkit/dom_storage/dom_storage_context_unittest.cc b/webkit/dom_storage/dom_storage_context_unittest.cc
index 401cc87db1e39eab3fe73c8f09714a8428277fb4..f9432df39633d2403813f297b2f6110cd3b46806 100644
--- a/webkit/dom_storage/dom_storage_context_unittest.cc
+++ b/webkit/dom_storage/dom_storage_context_unittest.cc
@@ -159,4 +159,33 @@ TEST_F(DomStorageContextTest, SetForceKeepSessionState) {
VerifySingleOriginRemains(kSessionOnlyOrigin);
}
+TEST_F(DomStorageContextTest, PersistentIds) {
+ const int kFirstSessionStorageNamespaceId = 1;
+ const std::string kPersistentId = "persistent";
+ context_->CreateSessionNamespace(kFirstSessionStorageNamespaceId,
+ kPersistentId);
+ DomStorageNamespace* dom_namespace =
+ context_->GetStorageNamespace(kFirstSessionStorageNamespaceId);
+ ASSERT_TRUE(dom_namespace);
+ EXPECT_EQ(kPersistentId, dom_namespace->persistent_namespace_id());
+ // Verify that the areas inherit the persistent ID.
+ DomStorageArea* area = dom_namespace->OpenStorageArea(kOrigin);
+ EXPECT_EQ(kPersistentId, area->persistent_namespace_id_);
+
+ // Verify that the persistent IDs are handled correctly when cloning.
+ const int kClonedSessionStorageNamespaceId = 2;
+ const std::string kClonedPersistentId = "cloned";
+ context_->CloneSessionNamespace(kFirstSessionStorageNamespaceId,
+ kClonedSessionStorageNamespaceId,
+ kClonedPersistentId);
+ DomStorageNamespace* cloned_dom_namespace =
+ context_->GetStorageNamespace(kClonedSessionStorageNamespaceId);
+ ASSERT_TRUE(dom_namespace);
+ EXPECT_EQ(kClonedPersistentId,
+ cloned_dom_namespace->persistent_namespace_id());
+ // Verify that the areas inherit the persistent ID.
+ DomStorageArea* cloned_area = cloned_dom_namespace->OpenStorageArea(kOrigin);
+ EXPECT_EQ(kClonedPersistentId, cloned_area->persistent_namespace_id_);
+}
+
} // namespace dom_storage
« no previous file with comments | « webkit/dom_storage/dom_storage_context.cc ('k') | webkit/dom_storage/dom_storage_namespace.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698