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

Unified Diff: chrome/browser/net/clear_on_exit_policy_unittest.cc

Issue 10407124: Don't force non-session only cookies to be session only cookies, instead delete on shutdown (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 8 years, 7 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 | « chrome/browser/net/clear_on_exit_policy.cc ('k') | chrome/browser/net/sqlite_persistent_cookie_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/clear_on_exit_policy_unittest.cc
diff --git a/chrome/browser/net/clear_on_exit_policy_unittest.cc b/chrome/browser/net/clear_on_exit_policy_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d097febca2e45bc7f8cb0c6b2010912a8176df01
--- /dev/null
+++ b/chrome/browser/net/clear_on_exit_policy_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+#include "chrome/browser/net/clear_on_exit_policy.h"
+#include "googleurl/src/gurl.h"
+#include "webkit/quota/mock_special_storage_policy.h"
+
+
+TEST(ClearOnExitPolicyTest, HasClearOnExitOrigins) {
+ scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy =
+ new quota::MockSpecialStoragePolicy;
+ scoped_refptr<ClearOnExitPolicy> policy =
+ new ClearOnExitPolicy(storage_policy.get());
+
+ EXPECT_FALSE(policy->HasClearOnExitOrigins());
+
+ storage_policy->AddSessionOnly(GURL("http://test.com/"));
+ EXPECT_TRUE(policy->HasClearOnExitOrigins());
+}
+
+TEST(ClearOnExitPolicyTest, ShouldClearOriginOnExit) {
+ scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy =
+ new quota::MockSpecialStoragePolicy;
+ storage_policy->AddSessionOnly(GURL("http://session.com/"));
+ storage_policy->AddSessionOnly(GURL("https://secure.com/"));
+ storage_policy->AddSessionOnly(GURL("http://protected.com/"));
+ storage_policy->AddProtected(GURL("http://protected.com/"));
+
+ scoped_refptr<ClearOnExitPolicy> policy =
+ new ClearOnExitPolicy(storage_policy.get());
+
+ EXPECT_TRUE(policy->ShouldClearOriginOnExit("session.com", false));
+ EXPECT_FALSE(policy->ShouldClearOriginOnExit("session.com", true));
+
+ EXPECT_FALSE(policy->ShouldClearOriginOnExit("secure.com", false));
+ EXPECT_TRUE(policy->ShouldClearOriginOnExit("secure.com", true));
+
+ EXPECT_FALSE(policy->ShouldClearOriginOnExit("protected.com", false));
+ EXPECT_FALSE(policy->ShouldClearOriginOnExit("protected.com", true));
+
+ EXPECT_FALSE(policy->ShouldClearOriginOnExit("other.com", false));
+ EXPECT_FALSE(policy->ShouldClearOriginOnExit("other.com", true));
+}
« no previous file with comments | « chrome/browser/net/clear_on_exit_policy.cc ('k') | chrome/browser/net/sqlite_persistent_cookie_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698