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 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 ~DelayedCookieMonster() override; |
| 23 |
22 // Call the asynchronous CookieMonster function, expect it to immediately | 24 // Call the asynchronous CookieMonster function, expect it to immediately |
23 // invoke the internal callback. | 25 // invoke the internal callback. |
24 // Post a delayed task to invoke the original callback with the results. | 26 // Post a delayed task to invoke the original callback with the results. |
25 | 27 |
26 void SetCookieWithOptionsAsync( | 28 void SetCookieWithOptionsAsync( |
27 const GURL& url, | 29 const GURL& url, |
28 const std::string& cookie_line, | 30 const std::string& cookie_line, |
29 const CookieOptions& options, | 31 const CookieOptions& options, |
30 const CookieMonster::SetCookiesCallback& callback) override; | 32 const CookieMonster::SetCookiesCallback& callback) override; |
31 | 33 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void InvokeSetCookiesCallback( | 106 void InvokeSetCookiesCallback( |
105 const CookieMonster::SetCookiesCallback& callback); | 107 const CookieMonster::SetCookiesCallback& callback); |
106 | 108 |
107 void InvokeGetCookieStringCallback( | 109 void InvokeGetCookieStringCallback( |
108 const CookieMonster::GetCookiesCallback& callback); | 110 const CookieMonster::GetCookiesCallback& callback); |
109 | 111 |
110 void InvokeGetCookieListCallback( | 112 void InvokeGetCookieListCallback( |
111 const CookieMonster::GetCookieListCallback& callback); | 113 const CookieMonster::GetCookieListCallback& callback); |
112 | 114 |
113 friend class base::RefCountedThreadSafe<DelayedCookieMonster>; | 115 friend class base::RefCountedThreadSafe<DelayedCookieMonster>; |
114 ~DelayedCookieMonster() override; | |
115 | 116 |
116 scoped_refptr<CookieMonster> cookie_monster_; | 117 scoped_ptr<CookieMonster> cookie_monster_; |
117 | 118 |
118 bool did_run_; | 119 bool did_run_; |
119 bool result_; | 120 bool result_; |
120 std::string cookie_; | 121 std::string cookie_; |
121 std::string cookie_line_; | 122 std::string cookie_line_; |
122 CookieList cookie_list_; | 123 CookieList cookie_list_; |
123 }; | 124 }; |
124 | 125 |
125 class CookieURLHelper { | 126 class CookieURLHelper { |
126 public: | 127 public: |
(...skipping 11 matching lines...) Expand all Loading... |
138 | 139 |
139 private: | 140 private: |
140 const GURL url_; | 141 const GURL url_; |
141 const std::string registry_; | 142 const std::string registry_; |
142 const std::string domain_and_registry_; | 143 const std::string domain_and_registry_; |
143 }; | 144 }; |
144 | 145 |
145 } // namespace net | 146 } // namespace net |
146 | 147 |
147 #endif // NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_ | 148 #endif // NET_COOKIES_COOKIE_STORE_TEST_HELPERS_H_ |
OLD | NEW |