Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1220)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_unittest.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 bool msg_was_ok; 763 bool msg_was_ok;
764 host_.OnMessageReceived(msg, filter, &msg_was_ok); 764 host_.OnMessageReceived(msg, filter, &msg_was_ok);
765 KickOffRequest(); 765 KickOffRequest();
766 } 766 }
767 767
768 void ResourceDispatcherHostTest::CancelRequest(int request_id) { 768 void ResourceDispatcherHostTest::CancelRequest(int request_id) {
769 host_.CancelRequest(filter_->child_id(), request_id, false); 769 host_.CancelRequest(filter_->child_id(), request_id, false);
770 } 770 }
771 771
772 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) { 772 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) {
773 CompleteStartRequest(filter_, request_id); 773 CompleteStartRequest(filter_.get(), request_id);
774 } 774 }
775 775
776 void ResourceDispatcherHostTest::CompleteStartRequest( 776 void ResourceDispatcherHostTest::CompleteStartRequest(
777 ResourceMessageFilter* filter, 777 ResourceMessageFilter* filter,
778 int request_id) { 778 int request_id) {
779 GlobalRequestID gid(filter->child_id(), request_id); 779 GlobalRequestID gid(filter->child_id(), request_id);
780 net::URLRequest* req = host_.GetURLRequest(gid); 780 net::URLRequest* req = host_.GetURLRequest(gid);
781 EXPECT_TRUE(req); 781 EXPECT_TRUE(req);
782 if (req) 782 if (req)
783 URLRequestTestDelayedStartJob::CompleteStart(req); 783 URLRequestTestDelayedStartJob::CompleteStart(req);
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 CreateResourceRequest("GET", ResourceType::MAIN_FRAME, 1742 CreateResourceRequest("GET", ResourceType::MAIN_FRAME,
1743 GURL("http://other.com/blech")); 1743 GURL("http://other.com/blech"));
1744 request.transferred_request_child_id = filter_->child_id(); 1744 request.transferred_request_child_id = filter_->child_id();
1745 request.transferred_request_request_id = request_id; 1745 request.transferred_request_request_id = request_id;
1746 1746
1747 // For cleanup. 1747 // For cleanup.
1748 child_ids_.insert(second_filter->child_id()); 1748 child_ids_.insert(second_filter->child_id());
1749 ResourceHostMsg_RequestResource transfer_request_msg( 1749 ResourceHostMsg_RequestResource transfer_request_msg(
1750 new_render_view_id, new_request_id, request); 1750 new_render_view_id, new_request_id, request);
1751 bool msg_was_ok; 1751 bool msg_was_ok;
1752 host_.OnMessageReceived(transfer_request_msg, second_filter, &msg_was_ok); 1752 host_.OnMessageReceived(
1753 transfer_request_msg, second_filter.get(), &msg_was_ok);
1753 base::MessageLoop::current()->RunUntilIdle(); 1754 base::MessageLoop::current()->RunUntilIdle();
1754 1755
1755 // Flush all the pending requests. 1756 // Flush all the pending requests.
1756 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} 1757 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
1757 1758
1758 // Check generated messages. 1759 // Check generated messages.
1759 ResourceIPCAccumulator::ClassifiedMessages msgs; 1760 ResourceIPCAccumulator::ClassifiedMessages msgs;
1760 accum_.GetClassifiedMessages(&msgs); 1761 accum_.GetClassifiedMessages(&msgs);
1761 1762
1762 ASSERT_EQ(1U, msgs.size()); 1763 ASSERT_EQ(1U, msgs.size());
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 CreateResourceRequest("GET", ResourceType::MAIN_FRAME, 1805 CreateResourceRequest("GET", ResourceType::MAIN_FRAME,
1805 GURL("http://other.com/blech")); 1806 GURL("http://other.com/blech"));
1806 request.transferred_request_child_id = filter_->child_id(); 1807 request.transferred_request_child_id = filter_->child_id();
1807 request.transferred_request_request_id = request_id; 1808 request.transferred_request_request_id = request_id;
1808 1809
1809 // For cleanup. 1810 // For cleanup.
1810 child_ids_.insert(second_filter->child_id()); 1811 child_ids_.insert(second_filter->child_id());
1811 ResourceHostMsg_RequestResource transfer_request_msg( 1812 ResourceHostMsg_RequestResource transfer_request_msg(
1812 new_render_view_id, new_request_id, request); 1813 new_render_view_id, new_request_id, request);
1813 bool msg_was_ok; 1814 bool msg_was_ok;
1814 host_.OnMessageReceived(transfer_request_msg, second_filter, &msg_was_ok); 1815 host_.OnMessageReceived(
1816 transfer_request_msg, second_filter.get(), &msg_was_ok);
1815 base::MessageLoop::current()->RunUntilIdle(); 1817 base::MessageLoop::current()->RunUntilIdle();
1816 1818
1817 // Response data for "http://other.com/blerg": 1819 // Response data for "http://other.com/blerg":
1818 const std::string kResponseBody = "hello world"; 1820 const std::string kResponseBody = "hello world";
1819 SetResponse("HTTP/1.1 200 OK\n" 1821 SetResponse("HTTP/1.1 200 OK\n"
1820 "Content-Type: text/plain\n\n", 1822 "Content-Type: text/plain\n\n",
1821 kResponseBody); 1823 kResponseBody);
1822 1824
1823 // OK, let the redirect happen. 1825 // OK, let the redirect happen.
1824 SetDelayedStartJobGeneration(false); 1826 SetDelayedStartJobGeneration(false);
1825 CompleteStartRequest(second_filter, new_request_id); 1827 CompleteStartRequest(second_filter.get(), new_request_id);
1826 base::MessageLoop::current()->RunUntilIdle(); 1828 base::MessageLoop::current()->RunUntilIdle();
1827 1829
1828 // Flush all the pending requests. 1830 // Flush all the pending requests.
1829 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} 1831 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
1830 1832
1831 // Now, simulate the renderer choosing to follow the redirect. 1833 // Now, simulate the renderer choosing to follow the redirect.
1832 ResourceHostMsg_FollowRedirect redirect_msg( 1834 ResourceHostMsg_FollowRedirect redirect_msg(
1833 new_render_view_id, new_request_id, false, GURL()); 1835 new_render_view_id, new_request_id, false, GURL());
1834 host_.OnMessageReceived(redirect_msg, second_filter, &msg_was_ok); 1836 host_.OnMessageReceived(redirect_msg, second_filter.get(), &msg_was_ok);
1835 base::MessageLoop::current()->RunUntilIdle(); 1837 base::MessageLoop::current()->RunUntilIdle();
1836 1838
1837 // Flush all the pending requests. 1839 // Flush all the pending requests.
1838 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} 1840 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
1839 1841
1840 // Check generated messages. 1842 // Check generated messages.
1841 ResourceIPCAccumulator::ClassifiedMessages msgs; 1843 ResourceIPCAccumulator::ClassifiedMessages msgs;
1842 accum_.GetClassifiedMessages(&msgs); 1844 accum_.GetClassifiedMessages(&msgs);
1843 1845
1844 ASSERT_EQ(1U, msgs.size()); 1846 ASSERT_EQ(1U, msgs.size());
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1942 } 1944 }
1943 1945
1944 base::MessageLoop::current()->RunUntilIdle(); 1946 base::MessageLoop::current()->RunUntilIdle();
1945 1947
1946 msgs.clear(); 1948 msgs.clear();
1947 accum_.GetClassifiedMessages(&msgs); 1949 accum_.GetClassifiedMessages(&msgs);
1948 } 1950 }
1949 } 1951 }
1950 1952
1951 } // namespace content 1953 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698