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

Side by Side Diff: net/quic/quic_end_to_end_unittest.cc

Issue 663043004: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/quic/quic_client_session_test.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "net/base/elements_upload_data_stream.h" 10 #include "net/base/elements_upload_data_stream.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 namespace { 42 namespace {
43 43
44 const char kResponseBody[] = "some arbitrary response body"; 44 const char kResponseBody[] = "some arbitrary response body";
45 45
46 // Factory for creating HttpTransactions, used by TestTransactionConsumer. 46 // Factory for creating HttpTransactions, used by TestTransactionConsumer.
47 class TestTransactionFactory : public HttpTransactionFactory { 47 class TestTransactionFactory : public HttpTransactionFactory {
48 public: 48 public:
49 TestTransactionFactory(const HttpNetworkSession::Params& params) 49 TestTransactionFactory(const HttpNetworkSession::Params& params)
50 : session_(new HttpNetworkSession(params)) {} 50 : session_(new HttpNetworkSession(params)) {}
51 51
52 virtual ~TestTransactionFactory() { 52 ~TestTransactionFactory() override {}
53 }
54 53
55 // HttpTransactionFactory methods 54 // HttpTransactionFactory methods
56 virtual int CreateTransaction(RequestPriority priority, 55 int CreateTransaction(RequestPriority priority,
57 scoped_ptr<HttpTransaction>* trans) override { 56 scoped_ptr<HttpTransaction>* trans) override {
58 trans->reset(new HttpNetworkTransaction(priority, session_.get())); 57 trans->reset(new HttpNetworkTransaction(priority, session_.get()));
59 return OK; 58 return OK;
60 } 59 }
61 60
62 virtual HttpCache* GetCache() override { 61 HttpCache* GetCache() override { return nullptr; }
63 return nullptr;
64 }
65 62
66 virtual HttpNetworkSession* GetSession() override { return session_.get(); }; 63 HttpNetworkSession* GetSession() override { return session_.get(); };
67 64
68 private: 65 private:
69 scoped_refptr<HttpNetworkSession> session_; 66 scoped_refptr<HttpNetworkSession> session_;
70 }; 67 };
71 68
72 } // namespace 69 } // namespace
73 70
74 class QuicEndToEndTest : public PlatformTest { 71 class QuicEndToEndTest : public PlatformTest {
75 protected: 72 protected:
76 QuicEndToEndTest() 73 QuicEndToEndTest()
(...skipping 21 matching lines...) Expand all
98 } 95 }
99 96
100 // Creates a mock host resolver in which www.google.com 97 // Creates a mock host resolver in which www.google.com
101 // resolves to localhost. 98 // resolves to localhost.
102 static MockHostResolver* CreateResolverImpl() { 99 static MockHostResolver* CreateResolverImpl() {
103 MockHostResolver* resolver = new MockHostResolver(); 100 MockHostResolver* resolver = new MockHostResolver();
104 resolver->rules()->AddRule("www.google.com", "127.0.0.1"); 101 resolver->rules()->AddRule("www.google.com", "127.0.0.1");
105 return resolver; 102 return resolver;
106 } 103 }
107 104
108 virtual void SetUp() { 105 void SetUp() override {
109 QuicInMemoryCachePeer::ResetForTests(); 106 QuicInMemoryCachePeer::ResetForTests();
110 StartServer(); 107 StartServer();
111 108
112 // Use a mapped host resolver so that request for www.google.com (port 80) 109 // Use a mapped host resolver so that request for www.google.com (port 80)
113 // reach the server running on localhost. 110 // reach the server running on localhost.
114 std::string map_rule = "MAP www.google.com www.google.com:" + 111 std::string map_rule = "MAP www.google.com www.google.com:" +
115 base::IntToString(server_thread_->GetPort()); 112 base::IntToString(server_thread_->GetPort());
116 EXPECT_TRUE(host_resolver_.AddRuleFromString(map_rule)); 113 EXPECT_TRUE(host_resolver_.AddRuleFromString(map_rule));
117 114
118 // To simplify the test, and avoid the race with the HTTP request, we force 115 // To simplify the test, and avoid the race with the HTTP request, we force
119 // QUIC for these requests. 116 // QUIC for these requests.
120 params_.origin_to_force_quic_on = 117 params_.origin_to_force_quic_on =
121 HostPortPair::FromString("www.google.com:80"); 118 HostPortPair::FromString("www.google.com:80");
122 119
123 transaction_factory_.reset(new TestTransactionFactory(params_)); 120 transaction_factory_.reset(new TestTransactionFactory(params_));
124 } 121 }
125 122
126 virtual void TearDown() { 123 void TearDown() override {
127 StopServer(); 124 StopServer();
128 QuicInMemoryCachePeer::ResetForTests(); 125 QuicInMemoryCachePeer::ResetForTests();
129 } 126 }
130 127
131 // Starts the QUIC server listening on a random port. 128 // Starts the QUIC server listening on a random port.
132 void StartServer() { 129 void StartServer() {
133 net::IPAddressNumber ip; 130 net::IPAddressNumber ip;
134 CHECK(net::ParseIPLiteralToNumber("127.0.0.1", &ip)); 131 CHECK(net::ParseIPLiteralToNumber("127.0.0.1", &ip));
135 server_address_ = IPEndPoint(ip, 0); 132 server_address_ = IPEndPoint(ip, 0);
136 server_config_.SetInitialFlowControlWindowToSend( 133 server_config_.SetInitialFlowControlWindowToSend(
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 base::MessageLoop::current()->Run(); 302 base::MessageLoop::current()->Run();
306 303
307 for (size_t i = 0; i < num_requests; ++i) { 304 for (size_t i = 0; i < num_requests; ++i) {
308 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody); 305 CheckResponse(*consumers[i], "HTTP/1.1 200 OK", kResponseBody);
309 } 306 }
310 STLDeleteElements(&consumers); 307 STLDeleteElements(&consumers);
311 } 308 }
312 309
313 } // namespace test 310 } // namespace test
314 } // namespace net 311 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session_test.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698