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_UNITTEST_H_ | 5 #ifndef NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
6 #define NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 6 #define NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 &ResultSavingCookieCallback<int>::Run, | 209 &ResultSavingCookieCallback<int>::Run, |
210 base::Unretained(&callback))); | 210 base::Unretained(&callback))); |
211 RunFor(kTimeout); | 211 RunFor(kTimeout); |
212 EXPECT_TRUE(callback.did_run()); | 212 EXPECT_TRUE(callback.did_run()); |
213 return callback.result(); | 213 return callback.result(); |
214 } | 214 } |
215 | 215 |
216 void RunFor(int ms) { | 216 void RunFor(int ms) { |
217 // Runs the test thread message loop for up to |ms| milliseconds. | 217 // Runs the test thread message loop for up to |ms| milliseconds. |
218 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 218 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
219 FROM_HERE, | 219 FROM_HERE, base::Bind(&base::MessageLoop::QuitWhenIdle, |
220 base::Bind(&base::MessageLoop::Quit, weak_factory_->GetWeakPtr()), | 220 weak_factory_->GetWeakPtr()), |
221 base::TimeDelta::FromMilliseconds(ms)); | 221 base::TimeDelta::FromMilliseconds(ms)); |
222 base::MessageLoop::current()->Run(); | 222 base::MessageLoop::current()->Run(); |
223 weak_factory_->InvalidateWeakPtrs(); | 223 weak_factory_->InvalidateWeakPtrs(); |
224 } | 224 } |
225 | 225 |
226 scoped_refptr<CookieStore> GetCookieStore() { | 226 scoped_refptr<CookieStore> GetCookieStore() { |
227 return CookieStoreTestTraits::Create(); | 227 return CookieStoreTestTraits::Create(); |
228 } | 228 } |
229 | 229 |
230 // Compares two cookie lines. | 230 // Compares two cookie lines. |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, | 1200 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, |
1201 ThreadCheckGetCookies, | 1201 ThreadCheckGetCookies, |
1202 ThreadCheckGetCookiesWithOptions, | 1202 ThreadCheckGetCookiesWithOptions, |
1203 ThreadCheckSetCookieWithOptions, | 1203 ThreadCheckSetCookieWithOptions, |
1204 ThreadCheckDeleteCookie, | 1204 ThreadCheckDeleteCookie, |
1205 ThreadCheckDeleteSessionCookies); | 1205 ThreadCheckDeleteSessionCookies); |
1206 | 1206 |
1207 } // namespace net | 1207 } // namespace net |
1208 | 1208 |
1209 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1209 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
OLD | NEW |