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

Side by Side Diff: net/base/cookie_monster_store_test.h

Issue 7598001: Remove the old synchronous CookieMonster API. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 4 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
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 // This file contains test infrastructure for multiple files 5 // This file contains test infrastructure for multiple files
6 // (current cookie_monster_unittest.cc and cookie_monster_perftest.cc) 6 // (current cookie_monster_unittest.cc and cookie_monster_perftest.cc)
7 // that need to test out CookieMonster interactions with the backing store. 7 // that need to test out CookieMonster interactions with the backing store.
8 // It should only be included by test code. 8 // It should only be included by test code.
9 9
10 #include "net/base/cookie_monster.h" 10 #include "net/base/cookie_monster.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 virtual ~MockPersistentCookieStore(); 44 virtual ~MockPersistentCookieStore();
45 45
46 void SetLoadExpectation( 46 void SetLoadExpectation(
47 bool return_value, 47 bool return_value,
48 const std::vector<CookieMonster::CanonicalCookie*>& result); 48 const std::vector<CookieMonster::CanonicalCookie*>& result);
49 49
50 const CommandList& commands() const { 50 const CommandList& commands() const {
51 return commands_; 51 return commands_;
52 } 52 }
53 53
54 virtual bool Load( 54 virtual bool Load(const LoadedCallback& loaded_callback) OVERRIDE;
55 std::vector<CookieMonster::CanonicalCookie*>* out_cookies);
56 55
57 virtual void AddCookie(const CookieMonster::CanonicalCookie& cookie); 56 virtual void AddCookie(const CookieMonster::CanonicalCookie& cookie) OVERRIDE;
58 57
59 virtual void UpdateCookieAccessTime( 58 virtual void UpdateCookieAccessTime(
60 const CookieMonster::CanonicalCookie& cookie); 59 const CookieMonster::CanonicalCookie& cookie) OVERRIDE;
61 60
62 virtual void DeleteCookie( 61 virtual void DeleteCookie(
63 const CookieMonster::CanonicalCookie& cookie); 62 const CookieMonster::CanonicalCookie& cookie) OVERRIDE;
64 63
65 virtual void Flush(Task* completion_task); 64 virtual void Flush(Task* completion_task) OVERRIDE;
66 65
67 // No files are created so nothing to clear either 66 // No files are created so nothing to clear either
68 virtual void SetClearLocalStateOnExit(bool clear_local_state); 67 virtual void SetClearLocalStateOnExit(bool clear_local_state) OVERRIDE;
69 68
70 private: 69 private:
71 CommandList commands_; 70 CommandList commands_;
72 71
73 // Deferred result to use when Load() is called. 72 // Deferred result to use when Load() is called.
74 bool load_return_value_; 73 bool load_return_value_;
75 std::vector<CookieMonster::CanonicalCookie*> load_result_; 74 std::vector<CookieMonster::CanonicalCookie*> load_result_;
76 75
77 DISALLOW_COPY_AND_ASSIGN(MockPersistentCookieStore); 76 DISALLOW_COPY_AND_ASSIGN(MockPersistentCookieStore);
78 }; 77 };
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 std::vector<CookieMonster::CanonicalCookie*>* out_list); 109 std::vector<CookieMonster::CanonicalCookie*>* out_list);
111 110
112 // Just act like a backing database. Keep cookie information from 111 // Just act like a backing database. Keep cookie information from
113 // Add/Update/Delete and regurgitate it when Load is called. 112 // Add/Update/Delete and regurgitate it when Load is called.
114 class MockSimplePersistentCookieStore 113 class MockSimplePersistentCookieStore
115 : public CookieMonster::PersistentCookieStore { 114 : public CookieMonster::PersistentCookieStore {
116 public: 115 public:
117 MockSimplePersistentCookieStore(); 116 MockSimplePersistentCookieStore();
118 virtual ~MockSimplePersistentCookieStore(); 117 virtual ~MockSimplePersistentCookieStore();
119 118
120 virtual bool Load( 119 virtual bool Load(const LoadedCallback& loaded_callback);
121 std::vector<CookieMonster::CanonicalCookie*>* out_cookies);
122 120
123 virtual void AddCookie( 121 virtual void AddCookie(
124 const CookieMonster::CanonicalCookie& cookie); 122 const CookieMonster::CanonicalCookie& cookie);
125 123
126 virtual void UpdateCookieAccessTime( 124 virtual void UpdateCookieAccessTime(
127 const CookieMonster::CanonicalCookie& cookie); 125 const CookieMonster::CanonicalCookie& cookie);
128 126
129 virtual void DeleteCookie( 127 virtual void DeleteCookie(
130 const CookieMonster::CanonicalCookie& cookie); 128 const CookieMonster::CanonicalCookie& cookie);
131 129
(...skipping 15 matching lines...) Expand all
147 // with access time Now()-days_old, the rest with access time Now(). 145 // with access time Now()-days_old, the rest with access time Now().
148 // Do two SetCookies(). Return whether each of the two SetCookies() took 146 // Do two SetCookies(). Return whether each of the two SetCookies() took
149 // longer than |gc_perf_micros| to complete, and how many cookie were 147 // longer than |gc_perf_micros| to complete, and how many cookie were
150 // left in the store afterwards. 148 // left in the store afterwards.
151 CookieMonster* CreateMonsterFromStoreForGC( 149 CookieMonster* CreateMonsterFromStoreForGC(
152 int num_cookies, 150 int num_cookies,
153 int num_old_cookies, 151 int num_old_cookies,
154 int days_old); 152 int days_old);
155 153
156 } // namespace net 154 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698