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 #include <utility> | 5 #include <utility> |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
10 #include <windows.h> | 10 #include <windows.h> |
(...skipping 2646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 | 2657 |
2658 TestNetworkDelegate network_delegate; | 2658 TestNetworkDelegate network_delegate; |
2659 network_delegate.set_experimental_cookie_features_enabled(true); | 2659 network_delegate.set_experimental_cookie_features_enabled(true); |
2660 default_context_.set_network_delegate(&network_delegate); | 2660 default_context_.set_network_delegate(&network_delegate); |
2661 | 2661 |
2662 // Set up a 'SameSite' cookie (on '127.0.0.1', as that's where | 2662 // Set up a 'SameSite' cookie (on '127.0.0.1', as that's where |
2663 // LocalHttpTestServer points). | 2663 // LocalHttpTestServer points). |
2664 { | 2664 { |
2665 TestDelegate d; | 2665 TestDelegate d; |
2666 scoped_ptr<URLRequest> req(default_context_.CreateRequest( | 2666 scoped_ptr<URLRequest> req(default_context_.CreateRequest( |
2667 test_server.GetURL("/set-cookie?SameSiteCookieToSet=1;SameSite"), | 2667 test_server.GetURL("/set-cookie?SameSiteCookieToSet=1;SameSite=Strict"), |
2668 DEFAULT_PRIORITY, &d)); | 2668 DEFAULT_PRIORITY, &d)); |
2669 req->Start(); | 2669 req->Start(); |
2670 base::RunLoop().Run(); | 2670 base::RunLoop().Run(); |
2671 EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); | 2671 EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
2672 EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); | 2672 EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
2673 EXPECT_EQ(1, network_delegate.set_cookie_count()); | 2673 EXPECT_EQ(1, network_delegate.set_cookie_count()); |
2674 } | 2674 } |
2675 | 2675 |
2676 // Verify that the cookie is sent for same-site requests. | 2676 // Verify that the cookie is sent for same-site requests. |
2677 { | 2677 { |
(...skipping 7337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10015 AddTestInterceptor()->set_main_intercept_job(std::move(job)); | 10015 AddTestInterceptor()->set_main_intercept_job(std::move(job)); |
10016 | 10016 |
10017 req->Start(); | 10017 req->Start(); |
10018 req->Cancel(); | 10018 req->Cancel(); |
10019 base::RunLoop().RunUntilIdle(); | 10019 base::RunLoop().RunUntilIdle(); |
10020 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); | 10020 EXPECT_EQ(URLRequestStatus::CANCELED, req->status().status()); |
10021 EXPECT_EQ(0, d.received_redirect_count()); | 10021 EXPECT_EQ(0, d.received_redirect_count()); |
10022 } | 10022 } |
10023 | 10023 |
10024 } // namespace net | 10024 } // namespace net |
OLD | NEW |