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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
11 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "net/cookies/cookie_monster.h" | 13 #include "net/cookies/cookie_monster.h" |
14 #include "net/cookies/cookie_store.h" | 14 #include "net/cookies/cookie_store.h" |
15 #include "net/cookies/cookie_store_test_callbacks.h" | 15 #include "net/cookies/cookie_store_test_callbacks.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 // This file declares unittest templates that can be used to test common | 18 // This file declares unittest templates that can be used to test common |
19 // behavior of any CookieStore implementation. | 19 // behavior of any CookieStore implementation. |
20 // See cookie_monster_unittest.cc for an example of an implementation. | 20 // See cookie_monster_unittest.cc for an example of an implementation. |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 GURL url_google_foo_; | 245 GURL url_google_foo_; |
246 GURL url_google_bar_; | 246 GURL url_google_bar_; |
247 | 247 |
248 scoped_ptr<base::WeakPtrFactory<MessageLoop> > weak_factory_; | 248 scoped_ptr<base::WeakPtrFactory<MessageLoop> > weak_factory_; |
249 scoped_ptr<MessageLoop> message_loop_; | 249 scoped_ptr<MessageLoop> message_loop_; |
250 | 250 |
251 private: | 251 private: |
252 // Returns a set of strings of type "name=value". Fails in case of duplicate. | 252 // Returns a set of strings of type "name=value". Fails in case of duplicate. |
253 std::set<std::string> TokenizeCookieLine(const std::string& line) { | 253 std::set<std::string> TokenizeCookieLine(const std::string& line) { |
254 std::set<std::string> tokens; | 254 std::set<std::string> tokens; |
255 StringTokenizer tokenizer(line, " ;"); | 255 base::StringTokenizer tokenizer(line, " ;"); |
256 while (tokenizer.GetNext()) | 256 while (tokenizer.GetNext()) |
257 EXPECT_TRUE(tokens.insert(tokenizer.token()).second); | 257 EXPECT_TRUE(tokens.insert(tokenizer.token()).second); |
258 return tokens; | 258 return tokens; |
259 } | 259 } |
260 }; | 260 }; |
261 | 261 |
262 TYPED_TEST_CASE_P(CookieStoreTest); | 262 TYPED_TEST_CASE_P(CookieStoreTest); |
263 | 263 |
264 TYPED_TEST_P(CookieStoreTest, TypeTest) { | 264 TYPED_TEST_P(CookieStoreTest, TypeTest) { |
265 scoped_refptr<CookieStore> cs(this->GetCookieStore()); | 265 scoped_refptr<CookieStore> cs(this->GetCookieStore()); |
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 } | 1110 } |
1111 | 1111 |
1112 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, | 1112 REGISTER_TYPED_TEST_CASE_P(MultiThreadedCookieStoreTest, |
1113 ThreadCheckGetCookies, ThreadCheckGetCookiesWithOptions, | 1113 ThreadCheckGetCookies, ThreadCheckGetCookiesWithOptions, |
1114 ThreadCheckGetCookiesWithInfo, ThreadCheckSetCookieWithOptions, | 1114 ThreadCheckGetCookiesWithInfo, ThreadCheckSetCookieWithOptions, |
1115 ThreadCheckDeleteCookie, ThreadCheckDeleteSessionCookies); | 1115 ThreadCheckDeleteCookie, ThreadCheckDeleteSessionCookies); |
1116 | 1116 |
1117 } // namespace net | 1117 } // namespace net |
1118 | 1118 |
1119 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ | 1119 #endif // NET_COOKIES_COOKIE_STORE_UNITTEST_H_ |
OLD | NEW |