| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "android_webview/browser/net/aw_cookie_store_wrapper.h" | 5 #include "android_webview/browser/net/aw_cookie_store_wrapper.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <memory> | 9 #include <memory> |
| 8 | 10 |
| 9 #include "net/cookies/cookie_store.h" | 11 #include "net/cookies/cookie_store.h" |
| 10 #include "net/cookies/cookie_store_test_callbacks.h" | 12 #include "net/cookies/cookie_store_test_callbacks.h" |
| 11 #include "net/cookies/cookie_store_unittest.h" | 13 #include "net/cookies/cookie_store_unittest.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 15 |
| 14 namespace android_webview { | 16 namespace android_webview { |
| 15 | 17 |
| 16 struct AwCookieStoreWrapperTestTraits { | 18 struct AwCookieStoreWrapperTestTraits { |
| 17 static std::unique_ptr<net::CookieStore> Create() { | 19 static std::unique_ptr<net::CookieStore> Create() { |
| 18 std::unique_ptr<net::CookieStore> cookie_store(new AwCookieStoreWrapper()); | 20 std::unique_ptr<net::CookieStore> cookie_store(new AwCookieStoreWrapper()); |
| 19 | 21 |
| 20 // Android Webview can run multiple tests without restarting the binary, | 22 // Android Webview can run multiple tests without restarting the binary, |
| 21 // so have to delete any cookies the global store may have from an earlier | 23 // so have to delete any cookies the global store may have from an earlier |
| 22 // test. | 24 // test. |
| 23 net::ResultSavingCookieCallback<int> callback; | 25 net::ResultSavingCookieCallback<uint32_t> callback; |
| 24 cookie_store->DeleteAllAsync( | 26 cookie_store->DeleteAllAsync( |
| 25 base::Bind(&net::ResultSavingCookieCallback<int>::Run, | 27 base::Bind(&net::ResultSavingCookieCallback<uint32_t>::Run, |
| 26 base::Unretained(&callback))); | 28 base::Unretained(&callback))); |
| 27 callback.WaitUntilDone(); | 29 callback.WaitUntilDone(); |
| 28 | 30 |
| 29 return cookie_store; | 31 return cookie_store; |
| 30 } | 32 } |
| 31 | 33 |
| 32 static const bool supports_http_only = true; | 34 static const bool supports_http_only = true; |
| 33 static const bool supports_non_dotted_domains = true; | 35 static const bool supports_non_dotted_domains = true; |
| 34 static const bool preserves_trailing_dots = true; | 36 static const bool preserves_trailing_dots = true; |
| 35 static const bool filters_schemes = true; | 37 static const bool filters_schemes = true; |
| 36 static const bool has_path_prefix_bug = false; | 38 static const bool has_path_prefix_bug = false; |
| 37 static const bool forbids_setting_empty_name = false; | 39 static const bool forbids_setting_empty_name = false; |
| 38 static const int creation_time_granularity_in_ms = 0; | 40 static const int creation_time_granularity_in_ms = 0; |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 } // namespace android_webview | 43 } // namespace android_webview |
| 42 | 44 |
| 43 // Run the standard cookie tests with AwCookieStoreWrapper. Macro must be in | 45 // Run the standard cookie tests with AwCookieStoreWrapper. Macro must be in |
| 44 // net namespace. | 46 // net namespace. |
| 45 namespace net { | 47 namespace net { |
| 46 INSTANTIATE_TYPED_TEST_CASE_P(AwCookieStoreWrapper, | 48 INSTANTIATE_TYPED_TEST_CASE_P(AwCookieStoreWrapper, |
| 47 CookieStoreTest, | 49 CookieStoreTest, |
| 48 android_webview::AwCookieStoreWrapperTestTraits); | 50 android_webview::AwCookieStoreWrapperTestTraits); |
| 49 } // namespace net | 51 } // namespace net |
| OLD | NEW |