OLD | NEW |
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 #ifndef CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ |
6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ | 6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "chrome/browser/browsing_data_cookie_helper.h" | 12 #include "chrome/browser/browsing_data_cookie_helper.h" |
13 | 13 |
14 // Mock for BrowsingDataCookieHelper. | 14 // Mock for BrowsingDataCookieHelper. |
15 class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper { | 15 class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper { |
16 public: | 16 public: |
17 explicit MockBrowsingDataCookieHelper(Profile* profile); | 17 explicit MockBrowsingDataCookieHelper(Profile* profile); |
18 | 18 |
19 // BrowsingDataCookieHelper methods. | 19 // BrowsingDataCookieHelper methods. |
20 virtual void StartFetching( | 20 virtual void StartFetching( |
21 const net::CookieMonster::GetCookieListCallback &callback); | 21 const net::CookieMonster::GetCookieListCallback &callback) OVERRIDE; |
22 virtual void CancelNotification(); | 22 virtual void CancelNotification() OVERRIDE; |
23 virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie& cookie); | 23 virtual void DeleteCookie( |
| 24 const net::CookieMonster::CanonicalCookie& cookie) OVERRIDE; |
24 | 25 |
25 // Adds some cookie samples. | 26 // Adds some cookie samples. |
26 void AddCookieSamples(const GURL& url, const std::string& cookie_line); | 27 void AddCookieSamples(const GURL& url, const std::string& cookie_line); |
27 | 28 |
28 // Notifies the callback. | 29 // Notifies the callback. |
29 void Notify(); | 30 void Notify(); |
30 | 31 |
31 // Marks all cookies as existing. | 32 // Marks all cookies as existing. |
32 void Reset(); | 33 void Reset(); |
33 | 34 |
34 // Returns true if all cookies since the last Reset() invocation were | 35 // Returns true if all cookies since the last Reset() invocation were |
35 // deleted. | 36 // deleted. |
36 bool AllDeleted(); | 37 bool AllDeleted(); |
37 | 38 |
38 private: | 39 private: |
39 virtual ~MockBrowsingDataCookieHelper(); | 40 virtual ~MockBrowsingDataCookieHelper(); |
40 | 41 |
41 Profile* profile_; | 42 Profile* profile_; |
42 net::CookieMonster::GetCookieListCallback callback_; | 43 net::CookieMonster::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 | 50 |
50 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ | 51 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ |
OLD | NEW |