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

Side by Side Diff: net/cookies/cookie_store_test_helpers.h

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_ 5 #ifndef NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_
6 #define NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_ 6 #define NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_
7 7
8 #include "net/cookies/cookie_monster.h" 8 #include "net/cookies/cookie_monster.h"
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 class DelayedCookieMonster : public CookieStore { 18 class DelayedCookieMonster : public CookieStore {
19 public: 19 public:
20 DelayedCookieMonster(); 20 DelayedCookieMonster();
21 21
22 // Call the asynchronous CookieMonster function, expect it to immediately 22 // Call the asynchronous CookieMonster function, expect it to immediately
23 // invoke the internal callback. 23 // invoke the internal callback.
24 // Post a delayed task to invoke the original callback with the results. 24 // Post a delayed task to invoke the original callback with the results.
25 25
26 virtual void SetCookieWithOptionsAsync( 26 void SetCookieWithOptionsAsync(
27 const GURL& url, 27 const GURL& url,
28 const std::string& cookie_line, 28 const std::string& cookie_line,
29 const CookieOptions& options, 29 const CookieOptions& options,
30 const CookieMonster::SetCookiesCallback& callback) override; 30 const CookieMonster::SetCookiesCallback& callback) override;
31 31
32 virtual void GetCookiesWithOptionsAsync( 32 void GetCookiesWithOptionsAsync(
33 const GURL& url, 33 const GURL& url,
34 const CookieOptions& options, 34 const CookieOptions& options,
35 const CookieMonster::GetCookiesCallback& callback) override; 35 const CookieMonster::GetCookiesCallback& callback) override;
36 36
37 virtual void GetAllCookiesForURLAsync( 37 void GetAllCookiesForURLAsync(const GURL& url,
38 const GURL& url, 38 const GetCookieListCallback& callback) override;
39 const GetCookieListCallback& callback) override;
40 39
41 virtual bool SetCookieWithOptions(const GURL& url, 40 virtual bool SetCookieWithOptions(const GURL& url,
42 const std::string& cookie_line, 41 const std::string& cookie_line,
43 const CookieOptions& options); 42 const CookieOptions& options);
44 43
45 virtual std::string GetCookiesWithOptions(const GURL& url, 44 virtual std::string GetCookiesWithOptions(const GURL& url,
46 const CookieOptions& options); 45 const CookieOptions& options);
47 46
48 virtual void DeleteCookie(const GURL& url, 47 virtual void DeleteCookie(const GURL& url,
49 const std::string& cookie_name); 48 const std::string& cookie_name);
50 49
51 virtual void DeleteCookieAsync(const GURL& url, 50 void DeleteCookieAsync(const GURL& url,
52 const std::string& cookie_name, 51 const std::string& cookie_name,
53 const base::Closure& callback) override; 52 const base::Closure& callback) override;
54 53
55 virtual void DeleteAllCreatedBetweenAsync( 54 void DeleteAllCreatedBetweenAsync(const base::Time& delete_begin,
56 const base::Time& delete_begin, 55 const base::Time& delete_end,
57 const base::Time& delete_end, 56 const DeleteCallback& callback) override;
58 const DeleteCallback& callback) override;
59 57
60 virtual void DeleteAllCreatedBetweenForHostAsync( 58 void DeleteAllCreatedBetweenForHostAsync(
61 const base::Time delete_begin, 59 const base::Time delete_begin,
62 const base::Time delete_end, 60 const base::Time delete_end,
63 const GURL& url, 61 const GURL& url,
64 const DeleteCallback& callback) override; 62 const DeleteCallback& callback) override;
65 63
66 virtual void DeleteSessionCookiesAsync(const DeleteCallback&) override; 64 void DeleteSessionCookiesAsync(const DeleteCallback&) override;
67 65
68 virtual CookieMonster* GetCookieMonster() override; 66 CookieMonster* GetCookieMonster() override;
69 67
70 private: 68 private:
71 69
72 // Be called immediately from CookieMonster. 70 // Be called immediately from CookieMonster.
73 71
74 void SetCookiesInternalCallback(bool result); 72 void SetCookiesInternalCallback(bool result);
75 73
76 void GetCookiesWithOptionsInternalCallback(const std::string& cookie); 74 void GetCookiesWithOptionsInternalCallback(const std::string& cookie);
77 75
78 // Invoke the original callbacks. 76 // Invoke the original callbacks.
79 77
80 void InvokeSetCookiesCallback( 78 void InvokeSetCookiesCallback(
81 const CookieMonster::SetCookiesCallback& callback); 79 const CookieMonster::SetCookiesCallback& callback);
82 80
83 void InvokeGetCookieStringCallback( 81 void InvokeGetCookieStringCallback(
84 const CookieMonster::GetCookiesCallback& callback); 82 const CookieMonster::GetCookiesCallback& callback);
85 83
86 friend class base::RefCountedThreadSafe<DelayedCookieMonster>; 84 friend class base::RefCountedThreadSafe<DelayedCookieMonster>;
87 virtual ~DelayedCookieMonster(); 85 ~DelayedCookieMonster() override;
88 86
89 scoped_refptr<CookieMonster> cookie_monster_; 87 scoped_refptr<CookieMonster> cookie_monster_;
90 88
91 bool did_run_; 89 bool did_run_;
92 bool result_; 90 bool result_;
93 std::string cookie_; 91 std::string cookie_;
94 std::string cookie_line_; 92 std::string cookie_line_;
95 }; 93 };
96 94
97 } // namespace net 95 } // namespace net
98 96
99 #endif // NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_ 97 #endif // NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_
OLDNEW
« no previous file with comments | « net/cookies/cookie_monster_unittest.cc ('k') | net/disk_cache/backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698