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

Side by Side Diff: chrome/browser/browsing_data/mock_browsing_data_cookie_helper.h

Issue 2937963003: Shift cookie system callbacks to OnceCallback to impedance match mojo. (Closed)
Patch Set: Finish Merge Created 3 years, 6 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
OLDNEW
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 #include "net/cookies/cookie_store.h"
15 15
16 // Mock for BrowsingDataCookieHelper. 16 // Mock for BrowsingDataCookieHelper.
17 class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper { 17 class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper {
18 public: 18 public:
19 explicit MockBrowsingDataCookieHelper( 19 explicit MockBrowsingDataCookieHelper(
20 net::URLRequestContextGetter* request_context_getter); 20 net::URLRequestContextGetter* request_context_getter);
21 21
22 // BrowsingDataCookieHelper methods. 22 // BrowsingDataCookieHelper methods.
23 void StartFetching( 23 void StartFetching(const FetchCallback& callback) override;
24 const net::CookieStore::GetCookieListCallback& callback) override;
25 void DeleteCookie(const net::CanonicalCookie& cookie) override; 24 void DeleteCookie(const net::CanonicalCookie& cookie) override;
26 25
27 // Adds some cookie samples. 26 // Adds some cookie samples.
28 void AddCookieSamples(const GURL& url, const std::string& cookie_line); 27 void AddCookieSamples(const GURL& url, const std::string& cookie_line);
29 28
30 // Notifies the callback. 29 // Notifies the callback.
31 void Notify(); 30 void Notify();
32 31
33 // Marks all cookies as existing. 32 // Marks all cookies as existing.
34 void Reset(); 33 void Reset();
35 34
36 // Returns true if all cookies since the last Reset() invocation were 35 // Returns true if all cookies since the last Reset() invocation were
37 // deleted. 36 // deleted.
38 bool AllDeleted(); 37 bool AllDeleted();
39 38
40 private: 39 private:
41 ~MockBrowsingDataCookieHelper() override; 40 ~MockBrowsingDataCookieHelper() override;
42 41
43 net::CookieStore::GetCookieListCallback callback_; 42 FetchCallback callback_;
44 43
45 net::CookieList cookie_list_; 44 net::CookieList cookie_list_;
46 45
47 // Stores which cookies exist. 46 // Stores which cookies exist.
48 std::map<const std::string, bool> cookies_; 47 std::map<const std::string, bool> cookies_;
49 48
50 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataCookieHelper); 49 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataCookieHelper);
51 }; 50 };
52 51
53 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_ 52 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_COOKIE_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698