diff options
author | jgreenwald@chromium.org <jgreenwald@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-02 21:43:56 +0000 |
---|---|---|
committer | jgreenwald@chromium.org <jgreenwald@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-02 21:43:56 +0000 |
commit | ec3884679ed46fe11a4d2a1b3e7e056a5c94200f (patch) | |
tree | faa9735b773ba1ee3845dfeff307e568969fed3a | |
parent | d5e0855885214a92671a6496581617cc627c63b6 (diff) | |
download | chromium_src-ec3884679ed46fe11a4d2a1b3e7e056a5c94200f.zip chromium_src-ec3884679ed46fe11a4d2a1b3e7e056a5c94200f.tar.gz chromium_src-ec3884679ed46fe11a4d2a1b3e7e056a5c94200f.tar.bz2 |
Remove ENABLE_PERSISTENT_SESSION_COOKIES
This isn't needed anymore now that CookieMonster::SetPersistSessionCookies
exists.
BUG=115372
Review URL: https://chromiumcodereview.appspot.com/10831117
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149708 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | net/cookies/canonical_cookie.cc | 18 | ||||
-rw-r--r-- | net/cookies/canonical_cookie.h | 3 | ||||
-rw-r--r-- | net/cookies/cookie_monster_unittest.cc | 45 | ||||
-rw-r--r-- | net/cookies/cookie_store_unittest.h | 12 | ||||
-rw-r--r-- | net/net.gyp | 9 |
5 files changed, 0 insertions, 87 deletions
diff --git a/net/cookies/canonical_cookie.cc b/net/cookies/canonical_cookie.cc index ea59aca..306b8fc 100644 --- a/net/cookies/canonical_cookie.cc +++ b/net/cookies/canonical_cookie.cc @@ -60,10 +60,6 @@ namespace net { namespace { -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) -const int kPersistentSessionCookieExpiryInDays = 14; -#endif - // Determine the cookie domain to use for setting the specified cookie. bool GetCookieDomain(const GURL& url, const ParsedCookie& pc, @@ -109,7 +105,6 @@ std::string CanonPathWithString(const GURL& url, CanonicalCookie::CanonicalCookie() : secure_(false), httponly_(false) { - SetSessionCookieExpiryTime(); } CanonicalCookie::CanonicalCookie( @@ -130,8 +125,6 @@ CanonicalCookie::CanonicalCookie( last_access_date_(last_access), secure_(secure), httponly_(httponly) { - if (expiration.is_null()) - SetSessionCookieExpiryTime(); } CanonicalCookie::CanonicalCookie(const GURL& url, const ParsedCookie& pc) @@ -147,8 +140,6 @@ CanonicalCookie::CanonicalCookie(const GURL& url, const ParsedCookie& pc) httponly_(pc.IsHttpOnly()) { if (pc.HasExpires()) expiry_date_ = CanonExpiration(pc, creation_date_, creation_date_); - else - SetSessionCookieExpiryTime(); // Do the best we can with the domain. std::string cookie_domain; @@ -214,15 +205,6 @@ Time CanonicalCookie::CanonExpiration(const ParsedCookie& pc, return Time(); } -void CanonicalCookie::SetSessionCookieExpiryTime() { -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - // Mobile apps can sometimes be shut down without any warning, so the session - // cookie has to be persistent and given a default expiration time. - expiry_date_ = base::Time::Now() + - base::TimeDelta::FromDays(kPersistentSessionCookieExpiryInDays); -#endif -} - CanonicalCookie* CanonicalCookie::Create(const GURL& url, const ParsedCookie& pc) { if (!pc.IsValid()) { diff --git a/net/cookies/canonical_cookie.h b/net/cookies/canonical_cookie.h index ff07ec6..ba50dfc 100644 --- a/net/cookies/canonical_cookie.h +++ b/net/cookies/canonical_cookie.h @@ -121,9 +121,6 @@ class NET_EXPORT CanonicalCookie { const base::Time& server_time); private: - // Gives the session cookie an expiration time if needed - void SetSessionCookieExpiryTime(); - // The source member of a canonical cookie is the origin of the URL that tried // to set this cookie, minus the port number if any. This field is not // persistent though; its only used in the in-tab cookies dialog to show the diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc index 24636da..69197e4 100644 --- a/net/cookies/cookie_monster_unittest.cc +++ b/net/cookies/cookie_monster_unittest.cc @@ -894,34 +894,18 @@ TEST_F(CookieMonsterTest, TestCookieDeleteAll) { EXPECT_EQ(2, DeleteAll(cm)); EXPECT_EQ("", GetCookiesWithOptions(cm, url_google_, options)); -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - // If a cookie is persistent then its commands will be recorded. - // Each above cookie has 2 commands: 1 for add and 1 for delete. - EXPECT_EQ(4u, store->commands().size()); -#else EXPECT_EQ(0u, store->commands().size()); -#endif // Create a persistent cookie. EXPECT_TRUE(SetCookie(cm, url_google_, std::string(kValidCookieLine) + "; expires=Mon, 18-Apr-22 22:50:13 GMT")); -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - ASSERT_EQ(5u, store->commands().size()); - EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); -#else ASSERT_EQ(1u, store->commands().size()); EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[0].type); -#endif EXPECT_EQ(1, DeleteAll(cm)); // sync_to_store = true. -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - ASSERT_EQ(6u, store->commands().size()); - EXPECT_EQ(CookieStoreCommand::REMOVE, store->commands()[5].type); -#else ASSERT_EQ(2u, store->commands().size()); EXPECT_EQ(CookieStoreCommand::REMOVE, store->commands()[1].type); -#endif EXPECT_EQ("", GetCookiesWithOptions(cm, url_google_, options)); } @@ -1356,13 +1340,8 @@ TEST_F(CookieMonsterTest, Delegate) { EXPECT_TRUE( SetCookie(cm, url_google_, "a=val1; path=/path1; " "expires=Mon, 18-Apr-22 22:50:13 GMT")); -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - ASSERT_EQ(5u, store->commands().size()); - EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[4].type); -#else ASSERT_EQ(1u, store->commands().size()); EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[0].type); -#endif ASSERT_EQ(1u, delegate->changes().size()); EXPECT_FALSE(delegate->changes()[0].second); EXPECT_EQ(url_google_.host(), delegate->changes()[0].first.Domain()); @@ -1379,15 +1358,9 @@ TEST_F(CookieMonsterTest, Delegate) { "a=val2; path=/path1; httponly; " "expires=Mon, 18-Apr-22 22:50:14 GMT", allow_httponly)); -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - ASSERT_EQ(7u, store->commands().size()); - EXPECT_EQ(CookieStoreCommand::REMOVE, store->commands()[5].type); - EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[6].type); -#else ASSERT_EQ(3u, store->commands().size()); EXPECT_EQ(CookieStoreCommand::REMOVE, store->commands()[1].type); EXPECT_EQ(CookieStoreCommand::ADD, store->commands()[2].type); -#endif ASSERT_EQ(2u, delegate->changes().size()); EXPECT_EQ(url_google_.host(), delegate->changes()[0].first.Domain()); EXPECT_TRUE(delegate->changes()[0].second); @@ -1438,11 +1411,7 @@ TEST_F(CookieMonsterTest, SetCookieWithDetails) { EXPECT_EQ("B", it->Value()); EXPECT_EQ("www.google.izzle", it->Domain()); EXPECT_EQ("/foo", it->Path()); -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - EXPECT_TRUE(it->IsPersistent()); -#else EXPECT_FALSE(it->IsPersistent()); -#endif EXPECT_FALSE(it->IsSecure()); EXPECT_FALSE(it->IsHttpOnly()); @@ -1974,13 +1943,8 @@ TEST_F(CookieMonsterTest, HistogramCheck) { // kValidCookieLine creates a session cookie. ASSERT_TRUE(SetCookie(cm, url_google_, kValidCookieLine)); expired_histogram->SnapshotSample(&histogram_set_1); -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - EXPECT_EQ(histogram_set_2.TotalCount() + 1, - histogram_set_1.TotalCount()); -#else EXPECT_EQ(histogram_set_2.TotalCount(), histogram_set_1.TotalCount()); -#endif } namespace { @@ -2217,12 +2181,7 @@ TEST_F(MultiThreadedCookieMonsterTest, ThreadCheckDeleteCanonicalCookie) { TEST_F(CookieMonsterTest, InvalidExpiryTime) { ParsedCookie pc(std::string(kValidCookieLine) + "; expires=Blarg arg arg"); scoped_ptr<CanonicalCookie> cookie(CanonicalCookie::Create(url_google_, pc)); - -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - ASSERT_TRUE(cookie->IsPersistent()); -#else ASSERT_FALSE(cookie->IsPersistent()); -#endif } // Test that CookieMonster writes session cookies into the underlying @@ -2299,11 +2258,7 @@ TEST_F(CookieMonsterTest, PersisentCookieStorageTest) { // persistent storage. EXPECT_TRUE(SetCookie(cm, url_google_, "B=Bar")); this->MatchCookieLines("A=Foo; B=Bar", GetCookies(cm, url_google_)); -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - EXPECT_EQ(6u, store->commands().size()); -#else EXPECT_EQ(5u, store->commands().size()); -#endif } } // namespace net diff --git a/net/cookies/cookie_store_unittest.h b/net/cookies/cookie_store_unittest.h index 5f9dd33..51c389d 100644 --- a/net/cookies/cookie_store_unittest.h +++ b/net/cookies/cookie_store_unittest.h @@ -1095,15 +1095,8 @@ TYPED_TEST_P(MultiThreadedCookieStoreTest, ThreadCheckDeleteSessionCookies) { "A=B", options)); EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, "B=C; expires=Mon, 18-Apr-22 22:50:13 GMT", options)); - -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - EXPECT_EQ(0, this->DeleteSessionCookies(cs)); -#else EXPECT_EQ(1, this->DeleteSessionCookies(cs)); -#endif - EXPECT_EQ(0, this->DeleteSessionCookies(cs)); - EXPECT_TRUE(this->SetCookieWithOptions(cs, this->url_google_, "A=B", options)); DeleteCallback callback(&this->other_thread_); @@ -1113,12 +1106,7 @@ TYPED_TEST_P(MultiThreadedCookieStoreTest, ThreadCheckDeleteSessionCookies) { cs, &callback); this->RunOnOtherThread(task); EXPECT_TRUE(callback.did_run()); - -#if defined(ENABLE_PERSISTENT_SESSION_COOKIES) - EXPECT_EQ(0, callback.num_deleted()); -#else EXPECT_EQ(1, callback.num_deleted()); -#endif } REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, diff --git a/net/net.gyp b/net/net.gyp index ac4a8a5..fc277b8 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -1067,11 +1067,6 @@ }, ], [ 'OS == "android"', { - 'defines': [ - # Android can shut down the app at any time, so the cookies must - # be saved to permanent storage. - 'ENABLE_PERSISTENT_SESSION_COOKIES' - ], 'dependencies': [ '../third_party/openssl/openssl.gyp:openssl', 'net_jni_headers', @@ -1479,10 +1474,6 @@ }, ], [ 'OS == "android"', { - 'defines': [ - # Android can shut down our app at any time, so we persist session cookies. - 'ENABLE_PERSISTENT_SESSION_COOKIES' - ], 'dependencies': [ '../third_party/openssl/openssl.gyp:openssl', ], |