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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1349 ASSERT_EQ(2U, msgs[0].size()); | 1349 ASSERT_EQ(2U, msgs[0].size()); |
1350 ASSERT_EQ(ResourceMsg_ReceivedResponse::ID, msgs[0][0].type()); | 1350 ASSERT_EQ(ResourceMsg_ReceivedResponse::ID, msgs[0][0].type()); |
1351 CheckRequestCompleteErrorCode(msgs[0][1], net::ERR_ABORTED); | 1351 CheckRequestCompleteErrorCode(msgs[0][1], net::ERR_ABORTED); |
1352 | 1352 |
1353 // But it continues detached. | 1353 // But it continues detached. |
1354 EXPECT_EQ(1, host_.pending_requests()); | 1354 EXPECT_EQ(1, host_.pending_requests()); |
1355 EXPECT_TRUE(info->detachable_handler()->is_detached()); | 1355 EXPECT_TRUE(info->detachable_handler()->is_detached()); |
1356 | 1356 |
1357 // Wait until after the delay timer times out before we start processing any | 1357 // Wait until after the delay timer times out before we start processing any |
1358 // messages. | 1358 // messages. |
1359 base::OneShotTimer<base::MessageLoop> timer; | 1359 base::OneShotTimer timer; |
1360 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), | 1360 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), |
1361 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); | 1361 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); |
1362 base::MessageLoop::current()->Run(); | 1362 base::MessageLoop::current()->Run(); |
1363 | 1363 |
1364 // The prefetch should be cancelled by now. | 1364 // The prefetch should be cancelled by now. |
1365 EXPECT_EQ(0, host_.pending_requests()); | 1365 EXPECT_EQ(0, host_.pending_requests()); |
1366 EXPECT_EQ(1, network_delegate()->completed_requests()); | 1366 EXPECT_EQ(1, network_delegate()->completed_requests()); |
1367 EXPECT_EQ(1, network_delegate()->canceled_requests()); | 1367 EXPECT_EQ(1, network_delegate()->canceled_requests()); |
1368 EXPECT_EQ(0, network_delegate()->error_count()); | 1368 EXPECT_EQ(0, network_delegate()->error_count()); |
1369 } | 1369 } |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1752 info->detachable_handler()->set_cancel_delay( | 1752 info->detachable_handler()->set_cancel_delay( |
1753 base::TimeDelta::FromMilliseconds(200)); | 1753 base::TimeDelta::FromMilliseconds(200)); |
1754 base::MessageLoop::current()->RunUntilIdle(); | 1754 base::MessageLoop::current()->RunUntilIdle(); |
1755 | 1755 |
1756 // Cancel the requests to the test process. | 1756 // Cancel the requests to the test process. |
1757 host_.CancelRequestsForProcess(filter_->child_id()); | 1757 host_.CancelRequestsForProcess(filter_->child_id()); |
1758 EXPECT_EQ(1, host_.pending_requests()); | 1758 EXPECT_EQ(1, host_.pending_requests()); |
1759 | 1759 |
1760 // Wait until after the delay timer times out before we start processing any | 1760 // Wait until after the delay timer times out before we start processing any |
1761 // messages. | 1761 // messages. |
1762 base::OneShotTimer<base::MessageLoop> timer; | 1762 base::OneShotTimer timer; |
1763 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), | 1763 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), |
1764 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); | 1764 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); |
1765 base::MessageLoop::current()->Run(); | 1765 base::MessageLoop::current()->Run(); |
1766 | 1766 |
1767 // The prefetch should be cancelled by now. | 1767 // The prefetch should be cancelled by now. |
1768 EXPECT_EQ(0, host_.pending_requests()); | 1768 EXPECT_EQ(0, host_.pending_requests()); |
1769 | 1769 |
1770 // In case any messages are still to be processed. | 1770 // In case any messages are still to be processed. |
1771 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} | 1771 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
1772 base::MessageLoop::current()->RunUntilIdle(); | 1772 base::MessageLoop::current()->RunUntilIdle(); |
(...skipping 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3488 return nullptr; | 3488 return nullptr; |
3489 } | 3489 } |
3490 | 3490 |
3491 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( | 3491 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( |
3492 net::URLRequest* request, | 3492 net::URLRequest* request, |
3493 net::NetworkDelegate* network_delegate) const { | 3493 net::NetworkDelegate* network_delegate) const { |
3494 return nullptr; | 3494 return nullptr; |
3495 } | 3495 } |
3496 | 3496 |
3497 } // namespace content | 3497 } // namespace content |
OLD | NEW |