| 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 #ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 12 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 13 #include "net/cookies/canonical_cookie.h" | 13 #include "net/cookies/canonical_cookie.h" |
| 14 #include "net/cookies/cookie_store.h" |
| 14 | 15 |
| 15 // Mock for BrowsingDataCookieHelper. | 16 // Mock for BrowsingDataCookieHelper. |
| 16 class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper { | 17 class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper { |
| 17 public: | 18 public: |
| 18 explicit MockBrowsingDataCookieHelper( | 19 explicit MockBrowsingDataCookieHelper( |
| 19 net::URLRequestContextGetter* request_context_getter); | 20 net::URLRequestContextGetter* request_context_getter); |
| 20 | 21 |
| 21 // BrowsingDataCookieHelper methods. | 22 // BrowsingDataCookieHelper methods. |
| 22 void StartFetching( | 23 void StartFetching( |
| 23 const net::CookieMonster::GetCookieListCallback& callback) override; | 24 const net::CookieStore::GetCookieListCallback& callback) override; |
| 24 void DeleteCookie(const net::CanonicalCookie& cookie) override; | 25 void DeleteCookie(const net::CanonicalCookie& cookie) override; |
| 25 | 26 |
| 26 // Adds some cookie samples. | 27 // Adds some cookie samples. |
| 27 void AddCookieSamples(const GURL& url, const std::string& cookie_line); | 28 void AddCookieSamples(const GURL& url, const std::string& cookie_line); |
| 28 | 29 |
| 29 // Notifies the callback. | 30 // Notifies the callback. |
| 30 void Notify(); | 31 void Notify(); |
| 31 | 32 |
| 32 // Marks all cookies as existing. | 33 // Marks all cookies as existing. |
| 33 void Reset(); | 34 void Reset(); |
| 34 | 35 |
| 35 // Returns true if all cookies since the last Reset() invocation were | 36 // Returns true if all cookies since the last Reset() invocation were |
| 36 // deleted. | 37 // deleted. |
| 37 bool AllDeleted(); | 38 bool AllDeleted(); |
| 38 | 39 |
| 39 private: | 40 private: |
| 40 ~MockBrowsingDataCookieHelper() override; | 41 ~MockBrowsingDataCookieHelper() override; |
| 41 | 42 |
| 42 net::CookieMonster::GetCookieListCallback callback_; | 43 net::CookieStore::GetCookieListCallback callback_; |
| 43 | 44 |
| 44 net::CookieList cookie_list_; | 45 net::CookieList cookie_list_; |
| 45 | 46 |
| 46 // Stores which cookies exist. | 47 // Stores which cookies exist. |
| 47 std::map<const std::string, bool> cookies_; | 48 std::map<const std::string, bool> cookies_; |
| 48 | 49 |
| 49 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataCookieHelper); | 50 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataCookieHelper); |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ | 53 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ |
| OLD | NEW |