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

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

Issue 10068037: RefCounted types should not have public destructors, content/browser part 1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: MSVC fixes Created 8 years, 8 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 "content/browser/renderer_host/resource_dispatcher_host_impl.h" 5 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 OnChannelConnected(base::GetCurrentProcId()); 171 OnChannelConnected(base::GetCurrentProcId());
172 } 172 }
173 173
174 // ResourceMessageFilter override 174 // ResourceMessageFilter override
175 virtual bool Send(IPC::Message* msg) { 175 virtual bool Send(IPC::Message* msg) {
176 if (!dest_) 176 if (!dest_)
177 return false; 177 return false;
178 return dest_->Send(msg); 178 return dest_->Send(msg);
179 } 179 }
180 180
181 protected:
182 virtual ~ForwardingFilter() {}
183
181 private: 184 private:
182 IPC::Message::Sender* dest_; 185 IPC::Message::Sender* dest_;
183 186
184 DISALLOW_COPY_AND_ASSIGN(ForwardingFilter); 187 DISALLOW_COPY_AND_ASSIGN(ForwardingFilter);
185 }; 188 };
186 189
187 // This class is a variation on URLRequestTestJob in that it does 190 // This class is a variation on URLRequestTestJob in that it does
188 // not complete start upon entry, only when specifically told to. 191 // not complete start upon entry, only when specifically told to.
189 class URLRequestTestDelayedStartJob : public net::URLRequestTestJob { 192 class URLRequestTestDelayedStartJob : public net::URLRequestTestJob {
190 public: 193 public:
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 // pending and some canceled. 702 // pending and some canceled.
700 class TestFilter : public ForwardingFilter { 703 class TestFilter : public ForwardingFilter {
701 public: 704 public:
702 explicit TestFilter(content::ResourceContext* resource_context) 705 explicit TestFilter(content::ResourceContext* resource_context)
703 : ForwardingFilter(NULL, resource_context), 706 : ForwardingFilter(NULL, resource_context),
704 has_canceled_(false), 707 has_canceled_(false),
705 received_after_canceled_(0) { 708 received_after_canceled_(0) {
706 } 709 }
707 710
708 // ForwardingFilter override 711 // ForwardingFilter override
709 virtual bool Send(IPC::Message* msg) { 712 virtual bool Send(IPC::Message* msg) OVERRIDE {
710 // no messages should be received when the process has been canceled 713 // no messages should be received when the process has been canceled
711 if (has_canceled_) 714 if (has_canceled_)
712 received_after_canceled_++; 715 received_after_canceled_++;
713 delete msg; 716 delete msg;
714 return true; 717 return true;
715 } 718 }
719
716 bool has_canceled_; 720 bool has_canceled_;
717 int received_after_canceled_; 721 int received_after_canceled_;
722
723 private:
724 virtual ~TestFilter() {}
718 }; 725 };
719 726
720 // Tests CancelRequestsForProcess 727 // Tests CancelRequestsForProcess
721 TEST_F(ResourceDispatcherHostTest, TestProcessCancel) { 728 TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
722 scoped_refptr<TestFilter> test_filter = new TestFilter( 729 scoped_refptr<TestFilter> test_filter = new TestFilter(
723 browser_context_->GetResourceContext()); 730 browser_context_->GetResourceContext());
724 731
725 // request 1 goes to the test delegate 732 // request 1 goes to the test delegate
726 ResourceHostMsg_Request request = CreateResourceRequest( 733 ResourceHostMsg_Request request = CreateResourceRequest(
727 "GET", ResourceType::SUB_RESOURCE, net::URLRequestTestJob::test_url_1()); 734 "GET", ResourceType::SUB_RESOURCE, net::URLRequestTestJob::test_url_1());
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 PickleIterator iter(msgs[0][0]); 1395 PickleIterator iter(msgs[0][0]);
1389 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); 1396 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id));
1390 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status)); 1397 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status));
1391 1398
1392 EXPECT_EQ(1, request_id); 1399 EXPECT_EQ(1, request_id);
1393 EXPECT_EQ(net::URLRequestStatus::FAILED, status.status()); 1400 EXPECT_EQ(net::URLRequestStatus::FAILED, status.status());
1394 EXPECT_EQ(net::ERR_UNKNOWN_URL_SCHEME, status.error()); 1401 EXPECT_EQ(net::ERR_UNKNOWN_URL_SCHEME, status.error());
1395 } 1402 }
1396 1403
1397 } // namespace content 1404 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/quota_dispatcher_host.cc ('k') | content/browser/renderer_host/socket_stream_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698