| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ | 10 #ifndef NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Deferred result to use when Load() is called. | 108 // Deferred result to use when Load() is called. |
| 109 bool load_return_value_; | 109 bool load_return_value_; |
| 110 std::vector<CanonicalCookie*> load_result_; | 110 std::vector<CanonicalCookie*> load_result_; |
| 111 // Indicates if the store has been fully loaded to avoid returning duplicate | 111 // Indicates if the store has been fully loaded to avoid returning duplicate |
| 112 // cookies. | 112 // cookies. |
| 113 bool loaded_; | 113 bool loaded_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(MockPersistentCookieStore); | 115 DISALLOW_COPY_AND_ASSIGN(MockPersistentCookieStore); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 // Mock for CookieMonster::Delegate | 118 // Mock for CookieMonsterDelegate |
| 119 class MockCookieMonsterDelegate : public CookieMonster::Delegate { | 119 class MockCookieMonsterDelegate : public CookieMonsterDelegate { |
| 120 public: | 120 public: |
| 121 typedef std::pair<CanonicalCookie, bool> | 121 typedef std::pair<CanonicalCookie, bool> |
| 122 CookieNotification; | 122 CookieNotification; |
| 123 | 123 |
| 124 MockCookieMonsterDelegate(); | 124 MockCookieMonsterDelegate(); |
| 125 | 125 |
| 126 const std::vector<CookieNotification>& changes() const { return changes_; } | 126 const std::vector<CookieNotification>& changes() const { return changes_; } |
| 127 | 127 |
| 128 void reset() { changes_.clear(); } | 128 void reset() { changes_.clear(); } |
| 129 | 129 |
| 130 virtual void OnCookieChanged( | 130 virtual void OnCookieChanged( |
| 131 const CanonicalCookie& cookie, | 131 const CanonicalCookie& cookie, |
| 132 bool removed, | 132 bool removed, |
| 133 CookieMonster::Delegate::ChangeCause cause) OVERRIDE; | 133 CookieMonsterDelegate::ChangeCause cause) OVERRIDE; |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 virtual ~MockCookieMonsterDelegate(); | 136 virtual ~MockCookieMonsterDelegate(); |
| 137 | 137 |
| 138 std::vector<CookieNotification> changes_; | 138 std::vector<CookieNotification> changes_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(MockCookieMonsterDelegate); | 140 DISALLOW_COPY_AND_ASSIGN(MockCookieMonsterDelegate); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 // Helper to build a single CanonicalCookie. | 143 // Helper to build a single CanonicalCookie. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 // longer than |gc_perf_micros| to complete, and how many cookie were | 196 // longer than |gc_perf_micros| to complete, and how many cookie were |
| 197 // left in the store afterwards. | 197 // left in the store afterwards. |
| 198 CookieMonster* CreateMonsterFromStoreForGC( | 198 CookieMonster* CreateMonsterFromStoreForGC( |
| 199 int num_cookies, | 199 int num_cookies, |
| 200 int num_old_cookies, | 200 int num_old_cookies, |
| 201 int days_old); | 201 int days_old); |
| 202 | 202 |
| 203 } // namespace net | 203 } // namespace net |
| 204 | 204 |
| 205 #endif // NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ | 205 #endif // NET_COOKIES_COOKIE_MONSTER_STORE_TEST_H_ |
| OLD | NEW |