| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 | 10 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 537 |
| 538 request2->Start(); | 538 request2->Start(); |
| 539 ASSERT_TRUE(request2->is_pending()); | 539 ASSERT_TRUE(request2->is_pending()); |
| 540 base::RunLoop().Run(); | 540 base::RunLoop().Run(); |
| 541 EXPECT_TRUE(request2->was_cached()); | 541 EXPECT_TRUE(request2->was_cached()); |
| 542 EXPECT_TRUE(request2->status().is_success()); | 542 EXPECT_TRUE(request2->status().is_success()); |
| 543 EXPECT_EQ(0, delegate2.received_before_network_start_count()); | 543 EXPECT_EQ(0, delegate2.received_before_network_start_count()); |
| 544 } | 544 } |
| 545 | 545 |
| 546 TEST_F(URLRequestHttpJobTest, TestCancelWhileReadingCookies) { | 546 TEST_F(URLRequestHttpJobTest, TestCancelWhileReadingCookies) { |
| 547 context_.set_cookie_store(new DelayedCookieMonster()); | 547 DelayedCookieMonster cookie_monster; |
| 548 TestURLRequestContext context(true); |
| 549 context.set_cookie_store(&cookie_monster); |
| 550 context.Init(); |
| 548 | 551 |
| 549 TestDelegate delegate; | 552 TestDelegate delegate; |
| 550 scoped_ptr<URLRequest> request = context_.CreateRequest( | 553 scoped_ptr<URLRequest> request = context.CreateRequest( |
| 551 GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); | 554 GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate); |
| 552 | 555 |
| 553 request->Start(); | 556 request->Start(); |
| 554 request->Cancel(); | 557 request->Cancel(); |
| 555 base::RunLoop().Run(); | 558 base::RunLoop().Run(); |
| 556 | 559 |
| 557 DCHECK_EQ(0, delegate.received_before_network_start_count()); | 560 DCHECK_EQ(0, delegate.received_before_network_start_count()); |
| 558 EXPECT_EQ(URLRequestStatus::CANCELED, request->status().status()); | 561 EXPECT_EQ(URLRequestStatus::CANCELED, request->status().status()); |
| 559 } | 562 } |
| 560 | 563 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 base::RunLoop().RunUntilIdle(); | 938 base::RunLoop().RunUntilIdle(); |
| 936 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); | 939 EXPECT_EQ(URLRequestStatus::IO_PENDING, req_->status().status()); |
| 937 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); | 940 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); |
| 938 } | 941 } |
| 939 | 942 |
| 940 #endif // !defined(OS_IOS) | 943 #endif // !defined(OS_IOS) |
| 941 | 944 |
| 942 } // namespace | 945 } // namespace |
| 943 | 946 |
| 944 } // namespace net | 947 } // namespace net |
| OLD | NEW |