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

Side by Side 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, 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "testing/gtest/include/gtest/gtest.h"
6
7 #include "chrome/browser/net/clear_on_exit_policy.h"
8 #include "googleurl/src/gurl.h"
9 #include "webkit/quota/mock_special_storage_policy.h"
10
11
12 TEST(ClearOnExitPolicyTest, HasClearOnExitOrigins) {
13 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy =
14 new quota::MockSpecialStoragePolicy;
15 scoped_refptr<ClearOnExitPolicy> policy =
16 new ClearOnExitPolicy(storage_policy.get());
17
18 EXPECT_FALSE(policy->HasClearOnExitOrigins());
19
20 storage_policy->AddSessionOnly(GURL("http://test.com/"));
21 EXPECT_TRUE(policy->HasClearOnExitOrigins());
22 }
23
24 TEST(ClearOnExitPolicyTest, ShouldClearOriginOnExit) {
25 scoped_refptr<quota::MockSpecialStoragePolicy> storage_policy =
26 new quota::MockSpecialStoragePolicy;
27 storage_policy->AddSessionOnly(GURL("http://session.com/"));
28 storage_policy->AddSessionOnly(GURL("https://secure.com/"));
29 storage_policy->AddSessionOnly(GURL("http://protected.com/"));
30 storage_policy->AddProtected(GURL("http://protected.com/"));
31
32 scoped_refptr<ClearOnExitPolicy> policy =
33 new ClearOnExitPolicy(storage_policy.get());
34
35 EXPECT_TRUE(policy->ShouldClearOriginOnExit("session.com", false));
36 EXPECT_FALSE(policy->ShouldClearOriginOnExit("session.com", true));
37
38 EXPECT_FALSE(policy->ShouldClearOriginOnExit("secure.com", false));
39 EXPECT_TRUE(policy->ShouldClearOriginOnExit("secure.com", true));
40
41 EXPECT_FALSE(policy->ShouldClearOriginOnExit("protected.com", false));
42 EXPECT_FALSE(policy->ShouldClearOriginOnExit("protected.com", true));
43
44 EXPECT_FALSE(policy->ShouldClearOriginOnExit("other.com", false));
45 EXPECT_FALSE(policy->ShouldClearOriginOnExit("other.com", true));
46 }
OLDNEW
« 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