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

Side by Side Diff: net/base/cookie_monster_unittest.cc

Issue 8533013: SessionRestore: Store session cookies and restore them if chrome crashes or auto-restarts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years 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
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <time.h> 5 #include <time.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 29 matching lines...) Expand all
40 public: 40 public:
41 MOCK_METHOD1(Load, void(const LoadedCallback& loaded_callback)); 41 MOCK_METHOD1(Load, void(const LoadedCallback& loaded_callback));
42 MOCK_METHOD2(LoadCookiesForKey, void(const std::string& key, 42 MOCK_METHOD2(LoadCookiesForKey, void(const std::string& key,
43 const LoadedCallback& loaded_callback)); 43 const LoadedCallback& loaded_callback));
44 MOCK_METHOD1(AddCookie, void(const CookieMonster::CanonicalCookie& cc)); 44 MOCK_METHOD1(AddCookie, void(const CookieMonster::CanonicalCookie& cc));
45 MOCK_METHOD1(UpdateCookieAccessTime, 45 MOCK_METHOD1(UpdateCookieAccessTime,
46 void(const CookieMonster::CanonicalCookie& cc)); 46 void(const CookieMonster::CanonicalCookie& cc));
47 MOCK_METHOD1(DeleteCookie, void(const CookieMonster::CanonicalCookie& cc)); 47 MOCK_METHOD1(DeleteCookie, void(const CookieMonster::CanonicalCookie& cc));
48 MOCK_METHOD1(SetClearLocalStateOnExit, void(bool clear_local_state)); 48 MOCK_METHOD1(SetClearLocalStateOnExit, void(bool clear_local_state));
49 MOCK_METHOD1(Flush, void(Task* completion_task)); 49 MOCK_METHOD1(Flush, void(Task* completion_task));
50 MOCK_METHOD0(DeleteSessionCookies, void());
50 }; 51 };
51 52
52 const int kTimeout = 1000; 53 const int kTimeout = 1000;
53 54
54 const char* kTopLevelDomainPlus1 = "http://www.harvard.edu"; 55 const char* kTopLevelDomainPlus1 = "http://www.harvard.edu";
55 const char* kTopLevelDomainPlus2 = "http://www.math.harvard.edu"; 56 const char* kTopLevelDomainPlus2 = "http://www.math.harvard.edu";
56 const char* kTopLevelDomainPlus2Secure = "https://www.math.harvard.edu"; 57 const char* kTopLevelDomainPlus2Secure = "https://www.math.harvard.edu";
57 const char* kTopLevelDomainPlus3 = 58 const char* kTopLevelDomainPlus3 =
58 "http://www.bourbaki.math.harvard.edu"; 59 "http://www.bourbaki.math.harvard.edu";
59 const char* kOtherDomain = "http://www.mit.edu"; 60 const char* kOtherDomain = "http://www.mit.edu";
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after
3021 void LoadCookiesForKey(const std::string& key, 3022 void LoadCookiesForKey(const std::string& key,
3022 const LoadedCallback& loaded_callback) { 3023 const LoadedCallback& loaded_callback) {
3023 Load(loaded_callback); 3024 Load(loaded_callback);
3024 } 3025 }
3025 3026
3026 void AddCookie(const CookieMonster::CanonicalCookie&) {} 3027 void AddCookie(const CookieMonster::CanonicalCookie&) {}
3027 void UpdateCookieAccessTime(const CookieMonster::CanonicalCookie&) {} 3028 void UpdateCookieAccessTime(const CookieMonster::CanonicalCookie&) {}
3028 void DeleteCookie(const CookieMonster::CanonicalCookie&) {} 3029 void DeleteCookie(const CookieMonster::CanonicalCookie&) {}
3029 void SetClearLocalStateOnExit(bool clear_local_state) {} 3030 void SetClearLocalStateOnExit(bool clear_local_state) {}
3030 3031
3032 void DeleteSessionCookies() {}
3033
3031 void Flush(Task* completion_callback) { 3034 void Flush(Task* completion_callback) {
3032 ++flush_count_; 3035 ++flush_count_;
3033 if (completion_callback) { 3036 if (completion_callback) {
3034 completion_callback->Run(); 3037 completion_callback->Run();
3035 delete completion_callback; 3038 delete completion_callback;
3036 } 3039 }
3037 } 3040 }
3038 3041
3039 int flush_count() { 3042 int flush_count() {
3040 return flush_count_; 3043 return flush_count_;
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 TEST_F(CookieMonsterTest, InvalidExpiryTime) { 3576 TEST_F(CookieMonsterTest, InvalidExpiryTime) {
3574 CookieMonster::ParsedCookie pc( 3577 CookieMonster::ParsedCookie pc(
3575 std::string(kValidCookieLine) + "; expires=Blarg arg arg"); 3578 std::string(kValidCookieLine) + "; expires=Blarg arg arg");
3576 scoped_ptr<CookieMonster::CanonicalCookie> cookie( 3579 scoped_ptr<CookieMonster::CanonicalCookie> cookie(
3577 CookieMonster::CanonicalCookie::Create(url_google_, pc)); 3580 CookieMonster::CanonicalCookie::Create(url_google_, pc));
3578 3581
3579 ASSERT_FALSE(cookie->DoesExpire()); 3582 ASSERT_FALSE(cookie->DoesExpire());
3580 } 3583 }
3581 3584
3582 } // namespace net 3585 } // namespace net
OLDNEW
« net/base/cookie_monster.cc ('K') | « net/base/cookie_monster_store_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698