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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 | 1558 |
1559 // But it continues detached. | 1559 // But it continues detached. |
1560 EXPECT_EQ(1, host_.pending_requests()); | 1560 EXPECT_EQ(1, host_.pending_requests()); |
1561 EXPECT_TRUE(info->detachable_handler()->is_detached()); | 1561 EXPECT_TRUE(info->detachable_handler()->is_detached()); |
1562 | 1562 |
1563 // Wait until after the delay timer times out before we start processing any | 1563 // Wait until after the delay timer times out before we start processing any |
1564 // messages. | 1564 // messages. |
1565 base::OneShotTimer timer; | 1565 base::OneShotTimer timer; |
1566 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), | 1566 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), |
1567 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); | 1567 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); |
1568 base::MessageLoop::current()->Run(); | 1568 base::RunLoop().Run(); |
1569 | 1569 |
1570 // The prefetch should be cancelled by now. | 1570 // The prefetch should be cancelled by now. |
1571 EXPECT_EQ(0, host_.pending_requests()); | 1571 EXPECT_EQ(0, host_.pending_requests()); |
1572 EXPECT_EQ(1, network_delegate()->completed_requests()); | 1572 EXPECT_EQ(1, network_delegate()->completed_requests()); |
1573 EXPECT_EQ(1, network_delegate()->canceled_requests()); | 1573 EXPECT_EQ(1, network_delegate()->canceled_requests()); |
1574 EXPECT_EQ(0, network_delegate()->error_count()); | 1574 EXPECT_EQ(0, network_delegate()->error_count()); |
1575 } | 1575 } |
1576 | 1576 |
1577 // If the filter has disappeared then detachable resources should continue to | 1577 // If the filter has disappeared then detachable resources should continue to |
1578 // load. | 1578 // load. |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 | 2010 |
2011 // Cancel the requests to the test process. | 2011 // Cancel the requests to the test process. |
2012 host_.CancelRequestsForProcess(filter_->child_id()); | 2012 host_.CancelRequestsForProcess(filter_->child_id()); |
2013 EXPECT_EQ(1, host_.pending_requests()); | 2013 EXPECT_EQ(1, host_.pending_requests()); |
2014 | 2014 |
2015 // Wait until after the delay timer times out before we start processing any | 2015 // Wait until after the delay timer times out before we start processing any |
2016 // messages. | 2016 // messages. |
2017 base::OneShotTimer timer; | 2017 base::OneShotTimer timer; |
2018 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), | 2018 timer.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(210), |
2019 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); | 2019 base::MessageLoop::current(), &base::MessageLoop::QuitWhenIdle); |
2020 base::MessageLoop::current()->Run(); | 2020 base::RunLoop().Run(); |
2021 | 2021 |
2022 // The prefetch should be cancelled by now. | 2022 // The prefetch should be cancelled by now. |
2023 EXPECT_EQ(0, host_.pending_requests()); | 2023 EXPECT_EQ(0, host_.pending_requests()); |
2024 | 2024 |
2025 // In case any messages are still to be processed. | 2025 // In case any messages are still to be processed. |
2026 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} | 2026 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
2027 base::RunLoop().RunUntilIdle(); | 2027 base::RunLoop().RunUntilIdle(); |
2028 | 2028 |
2029 ResourceIPCAccumulator::ClassifiedMessages msgs; | 2029 ResourceIPCAccumulator::ClassifiedMessages msgs; |
2030 accum_.GetClassifiedMessages(&msgs); | 2030 accum_.GetClassifiedMessages(&msgs); |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3896 return nullptr; | 3896 return nullptr; |
3897 } | 3897 } |
3898 | 3898 |
3899 INSTANTIATE_TEST_CASE_P( | 3899 INSTANTIATE_TEST_CASE_P( |
3900 ResourceDispatcherHostTests, | 3900 ResourceDispatcherHostTests, |
3901 ResourceDispatcherHostTest, | 3901 ResourceDispatcherHostTest, |
3902 testing::Values(TestConfig::kDefault, | 3902 testing::Values(TestConfig::kDefault, |
3903 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3903 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
3904 | 3904 |
3905 } // namespace content | 3905 } // namespace content |
OLD | NEW |