| 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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 | 1726 |
| 1727 // Configure initial request. | 1727 // Configure initial request. |
| 1728 SetResponse("HTTP/1.1 302 Found\n" | 1728 SetResponse("HTTP/1.1 302 Found\n" |
| 1729 "Location: http://other.com/blech\n\n"); | 1729 "Location: http://other.com/blech\n\n"); |
| 1730 | 1730 |
| 1731 SetResourceType(ResourceType::MAIN_FRAME); | 1731 SetResourceType(ResourceType::MAIN_FRAME); |
| 1732 HandleScheme("http"); | 1732 HandleScheme("http"); |
| 1733 | 1733 |
| 1734 // Temporarily replace ContentBrowserClient with one that will trigger the | 1734 // Temporarily replace ContentBrowserClient with one that will trigger the |
| 1735 // transfer navigation code paths. | 1735 // transfer navigation code paths. |
| 1736 ContentBrowserClient* old_client = GetContentClient()->browser(); | |
| 1737 TransfersAllNavigationsContentBrowserClient new_client; | 1736 TransfersAllNavigationsContentBrowserClient new_client; |
| 1738 GetContentClient()->set_browser_for_testing(&new_client); | 1737 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client); |
| 1739 | 1738 |
| 1740 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); | 1739 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); |
| 1741 | 1740 |
| 1742 // Restore. | 1741 // Restore. |
| 1743 GetContentClient()->set_browser_for_testing(old_client); | 1742 SetBrowserClientForTesting(old_client); |
| 1744 | 1743 |
| 1745 // This second filter is used to emulate a second process. | 1744 // This second filter is used to emulate a second process. |
| 1746 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1745 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
| 1747 this, browser_context_->GetResourceContext()); | 1746 this, browser_context_->GetResourceContext()); |
| 1748 | 1747 |
| 1749 int new_render_view_id = 1; | 1748 int new_render_view_id = 1; |
| 1750 int new_request_id = 2; | 1749 int new_request_id = 2; |
| 1751 | 1750 |
| 1752 const std::string kResponseBody = "hello world"; | 1751 const std::string kResponseBody = "hello world"; |
| 1753 SetResponse("HTTP/1.1 200 OK\n" | 1752 SetResponse("HTTP/1.1 200 OK\n" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1785 | 1784 |
| 1786 // Configure initial request. | 1785 // Configure initial request. |
| 1787 SetResponse("HTTP/1.1 302 Found\n" | 1786 SetResponse("HTTP/1.1 302 Found\n" |
| 1788 "Location: http://other.com/blech\n\n"); | 1787 "Location: http://other.com/blech\n\n"); |
| 1789 | 1788 |
| 1790 SetResourceType(ResourceType::MAIN_FRAME); | 1789 SetResourceType(ResourceType::MAIN_FRAME); |
| 1791 HandleScheme("http"); | 1790 HandleScheme("http"); |
| 1792 | 1791 |
| 1793 // Temporarily replace ContentBrowserClient with one that will trigger the | 1792 // Temporarily replace ContentBrowserClient with one that will trigger the |
| 1794 // transfer navigation code paths. | 1793 // transfer navigation code paths. |
| 1795 ContentBrowserClient* old_client = GetContentClient()->browser(); | |
| 1796 TransfersAllNavigationsContentBrowserClient new_client; | 1794 TransfersAllNavigationsContentBrowserClient new_client; |
| 1797 GetContentClient()->set_browser_for_testing(&new_client); | 1795 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client); |
| 1798 | 1796 |
| 1799 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); | 1797 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); |
| 1800 | 1798 |
| 1801 // Restore. | 1799 // Restore. |
| 1802 GetContentClient()->set_browser_for_testing(old_client); | 1800 SetBrowserClientForTesting(old_client); |
| 1803 | 1801 |
| 1804 // This second filter is used to emulate a second process. | 1802 // This second filter is used to emulate a second process. |
| 1805 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1803 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
| 1806 this, browser_context_->GetResourceContext()); | 1804 this, browser_context_->GetResourceContext()); |
| 1807 | 1805 |
| 1808 int new_render_view_id = 1; | 1806 int new_render_view_id = 1; |
| 1809 int new_request_id = 2; | 1807 int new_request_id = 2; |
| 1810 | 1808 |
| 1811 // Delay the start of the next request so that we can setup the response for | 1809 // Delay the start of the next request so that we can setup the response for |
| 1812 // the next URL. | 1810 // the next URL. |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 } | 1953 } |
| 1956 | 1954 |
| 1957 MessageLoop::current()->RunUntilIdle(); | 1955 MessageLoop::current()->RunUntilIdle(); |
| 1958 | 1956 |
| 1959 msgs.clear(); | 1957 msgs.clear(); |
| 1960 accum_.GetClassifiedMessages(&msgs); | 1958 accum_.GetClassifiedMessages(&msgs); |
| 1961 } | 1959 } |
| 1962 } | 1960 } |
| 1963 | 1961 |
| 1964 } // namespace content | 1962 } // namespace content |
| OLD | NEW |