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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1696 | 1696 |
1697 // Cancelling by other methods shouldn't work either. | 1697 // Cancelling by other methods shouldn't work either. |
1698 host_.CancelRequestsForProcess(render_view_id); | 1698 host_.CancelRequestsForProcess(render_view_id); |
1699 EXPECT_EQ(1, host_.pending_requests()); | 1699 EXPECT_EQ(1, host_.pending_requests()); |
1700 | 1700 |
1701 // Cancelling by context should work. | 1701 // Cancelling by context should work. |
1702 host_.CancelRequestsForContext(filter_->resource_context()); | 1702 host_.CancelRequestsForContext(filter_->resource_context()); |
1703 EXPECT_EQ(0, host_.pending_requests()); | 1703 EXPECT_EQ(0, host_.pending_requests()); |
1704 } | 1704 } |
1705 | 1705 |
1706 // TODO(creis): How can we get this to pass? | |
1706 TEST_F(ResourceDispatcherHostTest, TransferNavigation) { | 1707 TEST_F(ResourceDispatcherHostTest, TransferNavigation) { |
1707 EXPECT_EQ(0, host_.pending_requests()); | 1708 EXPECT_EQ(0, host_.pending_requests()); |
1708 | 1709 |
1709 int render_view_id = 0; | 1710 int render_view_id = 0; |
1710 int request_id = 1; | 1711 int request_id = 1; |
1711 | 1712 |
1712 // Configure initial request. | 1713 // Configure initial request. |
1713 SetResponse("HTTP/1.1 302 Found\n" | 1714 SetResponse("HTTP/1.1 302 Found\n" |
1714 "Location: http://other.com/blech\n\n"); | 1715 "Location: http://other.com/blech\n\n"); |
1715 | 1716 |
(...skipping 27 matching lines...) Expand all Loading... | |
1743 GURL("http://other.com/blech")); | 1744 GURL("http://other.com/blech")); |
1744 request.transferred_request_child_id = filter_->child_id(); | 1745 request.transferred_request_child_id = filter_->child_id(); |
1745 request.transferred_request_request_id = request_id; | 1746 request.transferred_request_request_id = request_id; |
1746 | 1747 |
1747 // For cleanup. | 1748 // For cleanup. |
1748 child_ids_.insert(second_filter->child_id()); | 1749 child_ids_.insert(second_filter->child_id()); |
1749 ResourceHostMsg_RequestResource transfer_request_msg( | 1750 ResourceHostMsg_RequestResource transfer_request_msg( |
1750 new_render_view_id, new_request_id, request); | 1751 new_render_view_id, new_request_id, request); |
1751 bool msg_was_ok; | 1752 bool msg_was_ok; |
1752 host_.OnMessageReceived( | 1753 host_.OnMessageReceived( |
1753 transfer_request_msg, second_filter.get(), &msg_was_ok); | 1754 transfer_request_msg, second_filter.get(), &msg_was_ok); |
Matt Perry
2013/06/18 22:58:51
Why doesn't this result in another OnResponseStart
Charlie Reis
2013/06/19 00:17:01
We do get to BeginRequest in this call, but the de
Matt Perry
2013/06/19 00:28:42
Looks like ResourceDispatcherHostTest::Factory is
Charlie Reis
2013/06/19 01:09:24
Making progress! It's a URLRequestTestJob, and we
Matt Perry
2013/06/19 01:20:56
Not sure how to unblock. I'm assuming ResourceLoad
| |
1754 base::MessageLoop::current()->RunUntilIdle(); | 1755 base::MessageLoop::current()->RunUntilIdle(); |
1755 | 1756 |
1756 // Flush all the pending requests. | 1757 // Flush all the pending requests. |
1757 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} | 1758 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
1758 | 1759 |
1759 // Check generated messages. | 1760 // Check generated messages. |
1760 ResourceIPCAccumulator::ClassifiedMessages msgs; | 1761 ResourceIPCAccumulator::ClassifiedMessages msgs; |
1761 accum_.GetClassifiedMessages(&msgs); | 1762 accum_.GetClassifiedMessages(&msgs); |
1762 | 1763 |
1763 ASSERT_EQ(1U, msgs.size()); | 1764 ASSERT_EQ(1U, msgs.size()); |
1764 CheckSuccessfulRequest(msgs[0], kResponseBody); | 1765 CheckSuccessfulRequest(msgs[0], kResponseBody); |
1765 } | 1766 } |
1766 | 1767 |
1768 // TODO(creis): How can we get this to pass? | |
1767 TEST_F(ResourceDispatcherHostTest, TransferNavigationAndThenRedirect) { | 1769 TEST_F(ResourceDispatcherHostTest, TransferNavigationAndThenRedirect) { |
1768 EXPECT_EQ(0, host_.pending_requests()); | 1770 EXPECT_EQ(0, host_.pending_requests()); |
1769 | 1771 |
1770 int render_view_id = 0; | 1772 int render_view_id = 0; |
1771 int request_id = 1; | 1773 int request_id = 1; |
1772 | 1774 |
1773 // Configure initial request. | 1775 // Configure initial request. |
1774 SetResponse("HTTP/1.1 302 Found\n" | 1776 SetResponse("HTTP/1.1 302 Found\n" |
1775 "Location: http://other.com/blech\n\n"); | 1777 "Location: http://other.com/blech\n\n"); |
1776 | 1778 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1998 } | 2000 } |
1999 | 2001 |
2000 base::MessageLoop::current()->RunUntilIdle(); | 2002 base::MessageLoop::current()->RunUntilIdle(); |
2001 | 2003 |
2002 msgs.clear(); | 2004 msgs.clear(); |
2003 accum_.GetClassifiedMessages(&msgs); | 2005 accum_.GetClassifiedMessages(&msgs); |
2004 } | 2006 } |
2005 } | 2007 } |
2006 | 2008 |
2007 } // namespace content | 2009 } // namespace content |
OLD | NEW |