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

Side by Side Diff: net/url_request/url_request_ftp_job_unittest.cc

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/url_request/url_request_ftp_job.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/url_request/url_request_ftp_job.h" 5 #include "net/url_request/url_request_ftp_job.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 namespace { 61 namespace {
62 62
63 class SimpleProxyConfigService : public ProxyConfigService { 63 class SimpleProxyConfigService : public ProxyConfigService {
64 public: 64 public:
65 SimpleProxyConfigService() { 65 SimpleProxyConfigService() {
66 // Any FTP requests that ever go through HTTP paths are proxied requests. 66 // Any FTP requests that ever go through HTTP paths are proxied requests.
67 config_.proxy_rules().ParseFromString("ftp=localhost"); 67 config_.proxy_rules().ParseFromString("ftp=localhost");
68 } 68 }
69 69
70 virtual void AddObserver(Observer* observer) override { 70 void AddObserver(Observer* observer) override { observer_ = observer; }
71 observer_ = observer;
72 }
73 71
74 virtual void RemoveObserver(Observer* observer) override { 72 void RemoveObserver(Observer* observer) override {
75 if (observer_ == observer) { 73 if (observer_ == observer) {
76 observer_ = NULL; 74 observer_ = NULL;
77 } 75 }
78 } 76 }
79 77
80 virtual ConfigAvailability GetLatestProxyConfig( 78 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override {
81 ProxyConfig* config) override {
82 *config = config_; 79 *config = config_;
83 return CONFIG_VALID; 80 return CONFIG_VALID;
84 } 81 }
85 82
86 void IncrementConfigId() { 83 void IncrementConfigId() {
87 config_.set_id(config_.id() + 1); 84 config_.set_id(config_.id() + 1);
88 observer_->OnProxyConfigChanged(config_, ProxyConfigService::CONFIG_VALID); 85 observer_->OnProxyConfigChanged(config_, ProxyConfigService::CONFIG_VALID);
89 } 86 }
90 87
91 private: 88 private:
92 ProxyConfig config_; 89 ProxyConfig config_;
93 Observer* observer_; 90 Observer* observer_;
94 }; 91 };
95 92
96 // Inherit from URLRequestFtpJob to expose the priority and some 93 // Inherit from URLRequestFtpJob to expose the priority and some
97 // other hidden functions. 94 // other hidden functions.
98 class TestURLRequestFtpJob : public URLRequestFtpJob { 95 class TestURLRequestFtpJob : public URLRequestFtpJob {
99 public: 96 public:
100 TestURLRequestFtpJob(URLRequest* request, 97 TestURLRequestFtpJob(URLRequest* request,
101 FtpTransactionFactory* ftp_factory, 98 FtpTransactionFactory* ftp_factory,
102 FtpAuthCache* ftp_auth_cache) 99 FtpAuthCache* ftp_auth_cache)
103 : URLRequestFtpJob(request, NULL, ftp_factory, ftp_auth_cache) {} 100 : URLRequestFtpJob(request, NULL, ftp_factory, ftp_auth_cache) {}
104 101
105 using URLRequestFtpJob::SetPriority; 102 using URLRequestFtpJob::SetPriority;
106 using URLRequestFtpJob::Start; 103 using URLRequestFtpJob::Start;
107 using URLRequestFtpJob::Kill; 104 using URLRequestFtpJob::Kill;
108 using URLRequestFtpJob::priority; 105 using URLRequestFtpJob::priority;
109 106
110 protected: 107 protected:
111 virtual ~TestURLRequestFtpJob() {} 108 ~TestURLRequestFtpJob() override {}
112 }; 109 };
113 110
114 class MockFtpTransactionFactory : public FtpTransactionFactory { 111 class MockFtpTransactionFactory : public FtpTransactionFactory {
115 public: 112 public:
116 virtual FtpTransaction* CreateTransaction() override { 113 FtpTransaction* CreateTransaction() override { return NULL; }
117 return NULL;
118 }
119 114
120 virtual void Suspend(bool suspend) override {} 115 void Suspend(bool suspend) override {}
121 }; 116 };
122 117
123 // Fixture for priority-related tests. Priority matters when there is 118 // Fixture for priority-related tests. Priority matters when there is
124 // an HTTP proxy. 119 // an HTTP proxy.
125 class URLRequestFtpJobPriorityTest : public testing::Test { 120 class URLRequestFtpJobPriorityTest : public testing::Test {
126 protected: 121 protected:
127 URLRequestFtpJobPriorityTest() 122 URLRequestFtpJobPriorityTest()
128 : proxy_service_(new SimpleProxyConfigService, NULL, NULL), 123 : proxy_service_(new SimpleProxyConfigService, NULL, NULL),
129 req_(context_.CreateRequest(GURL("ftp://ftp.example.com"), 124 req_(context_.CreateRequest(GURL("ftp://ftp.example.com"),
130 DEFAULT_PRIORITY, 125 DEFAULT_PRIORITY,
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 EXPECT_TRUE(url_request2->status().is_success()); 697 EXPECT_TRUE(url_request2->status().is_success());
703 EXPECT_EQ(2, network_delegate()->completed_requests()); 698 EXPECT_EQ(2, network_delegate()->completed_requests());
704 EXPECT_EQ(0, network_delegate()->error_count()); 699 EXPECT_EQ(0, network_delegate()->error_count());
705 EXPECT_FALSE(request_delegate2.auth_required_called()); 700 EXPECT_FALSE(request_delegate2.auth_required_called());
706 EXPECT_EQ("test2.html", request_delegate2.data_received()); 701 EXPECT_EQ("test2.html", request_delegate2.data_received());
707 } 702 }
708 703
709 } // namespace 704 } // namespace
710 705
711 } // namespace net 706 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_ftp_job.h ('k') | net/url_request/url_request_http_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698