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

Side by Side Diff: jingle/glue/chrome_async_socket_unittest.cc

Issue 628123002: Replacing the OVERRIDE with override and FINAL with final in jingle (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 | « jingle/glue/chrome_async_socket.h ('k') | jingle/glue/fake_ssl_client_socket.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 "jingle/glue/chrome_async_socket.h" 5 #include "jingle/glue/chrome_async_socket.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 25 matching lines...) Expand all
36 public: 36 public:
37 AsyncSocketDataProvider() : has_pending_read_(false) {} 37 AsyncSocketDataProvider() : has_pending_read_(false) {}
38 38
39 virtual ~AsyncSocketDataProvider() { 39 virtual ~AsyncSocketDataProvider() {
40 EXPECT_TRUE(writes_.empty()); 40 EXPECT_TRUE(writes_.empty());
41 EXPECT_TRUE(reads_.empty()); 41 EXPECT_TRUE(reads_.empty());
42 } 42 }
43 43
44 // If there's no read, sets the "has pending read" flag. Otherwise, 44 // If there's no read, sets the "has pending read" flag. Otherwise,
45 // pops the next read. 45 // pops the next read.
46 virtual net::MockRead GetNextRead() OVERRIDE { 46 virtual net::MockRead GetNextRead() override {
47 if (reads_.empty()) { 47 if (reads_.empty()) {
48 DCHECK(!has_pending_read_); 48 DCHECK(!has_pending_read_);
49 has_pending_read_ = true; 49 has_pending_read_ = true;
50 const net::MockRead pending_read(net::SYNCHRONOUS, net::ERR_IO_PENDING); 50 const net::MockRead pending_read(net::SYNCHRONOUS, net::ERR_IO_PENDING);
51 return pending_read; 51 return pending_read;
52 } 52 }
53 net::MockRead mock_read = reads_.front(); 53 net::MockRead mock_read = reads_.front();
54 reads_.pop_front(); 54 reads_.pop_front();
55 return mock_read; 55 return mock_read;
56 } 56 }
57 57
58 // Simply pops the next write and, if applicable, compares it to 58 // Simply pops the next write and, if applicable, compares it to
59 // |data|. 59 // |data|.
60 virtual net::MockWriteResult OnWrite(const std::string& data) OVERRIDE { 60 virtual net::MockWriteResult OnWrite(const std::string& data) override {
61 DCHECK(!writes_.empty()); 61 DCHECK(!writes_.empty());
62 net::MockWrite mock_write = writes_.front(); 62 net::MockWrite mock_write = writes_.front();
63 writes_.pop_front(); 63 writes_.pop_front();
64 if (mock_write.result != net::OK) { 64 if (mock_write.result != net::OK) {
65 return net::MockWriteResult(mock_write.mode, mock_write.result); 65 return net::MockWriteResult(mock_write.mode, mock_write.result);
66 } 66 }
67 std::string expected_data(mock_write.data, mock_write.data_len); 67 std::string expected_data(mock_write.data, mock_write.data_len);
68 EXPECT_EQ(expected_data, data); 68 EXPECT_EQ(expected_data, data);
69 if (expected_data != data) { 69 if (expected_data != data) {
70 return net::MockWriteResult(net::SYNCHRONOUS, net::ERR_UNEXPECTED); 70 return net::MockWriteResult(net::SYNCHRONOUS, net::ERR_UNEXPECTED);
71 } 71 }
72 return net::MockWriteResult(mock_write.mode, data.size()); 72 return net::MockWriteResult(mock_write.mode, data.size());
73 } 73 }
74 74
75 // We ignore resets so we can pre-load the socket data provider with 75 // We ignore resets so we can pre-load the socket data provider with
76 // read/write events. 76 // read/write events.
77 virtual void Reset() OVERRIDE {} 77 virtual void Reset() override {}
78 78
79 // If there is a pending read, completes it with the given read. 79 // If there is a pending read, completes it with the given read.
80 // Otherwise, queues up the given read. 80 // Otherwise, queues up the given read.
81 void AddRead(const net::MockRead& mock_read) { 81 void AddRead(const net::MockRead& mock_read) {
82 DCHECK_NE(mock_read.result, net::ERR_IO_PENDING); 82 DCHECK_NE(mock_read.result, net::ERR_IO_PENDING);
83 if (has_pending_read_) { 83 if (has_pending_read_) {
84 socket()->OnReadComplete(mock_read); 84 socket()->OnReadComplete(mock_read);
85 has_pending_read_ = false; 85 has_pending_read_ = false;
86 return; 86 return;
87 } 87 }
(...skipping 20 matching lines...) Expand all
108 net::ClientSocketFactory* mock_client_socket_factory, 108 net::ClientSocketFactory* mock_client_socket_factory,
109 const net::AddressList& address_list) 109 const net::AddressList& address_list)
110 : mock_client_socket_factory_(mock_client_socket_factory), 110 : mock_client_socket_factory_(mock_client_socket_factory),
111 address_list_(address_list), 111 address_list_(address_list),
112 cert_verifier_(new net::MockCertVerifier), 112 cert_verifier_(new net::MockCertVerifier),
113 transport_security_state_(new net::TransportSecurityState) { 113 transport_security_state_(new net::TransportSecurityState) {
114 } 114 }
115 115
116 // ResolvingClientSocketFactory implementation. 116 // ResolvingClientSocketFactory implementation.
117 virtual scoped_ptr<net::StreamSocket> CreateTransportClientSocket( 117 virtual scoped_ptr<net::StreamSocket> CreateTransportClientSocket(
118 const net::HostPortPair& host_and_port) OVERRIDE { 118 const net::HostPortPair& host_and_port) override {
119 return mock_client_socket_factory_->CreateTransportClientSocket( 119 return mock_client_socket_factory_->CreateTransportClientSocket(
120 address_list_, NULL, net::NetLog::Source()); 120 address_list_, NULL, net::NetLog::Source());
121 } 121 }
122 122
123 virtual scoped_ptr<net::SSLClientSocket> CreateSSLClientSocket( 123 virtual scoped_ptr<net::SSLClientSocket> CreateSSLClientSocket(
124 scoped_ptr<net::ClientSocketHandle> transport_socket, 124 scoped_ptr<net::ClientSocketHandle> transport_socket,
125 const net::HostPortPair& host_and_port) OVERRIDE { 125 const net::HostPortPair& host_and_port) override {
126 net::SSLClientSocketContext context; 126 net::SSLClientSocketContext context;
127 context.cert_verifier = cert_verifier_.get(); 127 context.cert_verifier = cert_verifier_.get();
128 context.transport_security_state = transport_security_state_.get(); 128 context.transport_security_state = transport_security_state_.get();
129 return mock_client_socket_factory_->CreateSSLClientSocket( 129 return mock_client_socket_factory_->CreateSSLClientSocket(
130 transport_socket.Pass(), host_and_port, ssl_config_, context); 130 transport_socket.Pass(), host_and_port, ssl_config_, context);
131 } 131 }
132 132
133 private: 133 private:
134 scoped_ptr<net::ClientSocketFactory> mock_client_socket_factory_; 134 scoped_ptr<net::ClientSocketFactory> mock_client_socket_factory_;
135 net::AddressList address_list_; 135 net::AddressList address_list_;
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 message_loop_->RunUntilIdle(); 1083 message_loop_->RunUntilIdle();
1084 1084
1085 ExpectNoSignal(); 1085 ExpectNoSignal();
1086 1086
1087 DoSSLCloseOpenedNoError(); 1087 DoSSLCloseOpenedNoError();
1088 } 1088 }
1089 1089
1090 } // namespace 1090 } // namespace
1091 1091
1092 } // namespace jingle_glue 1092 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « jingle/glue/chrome_async_socket.h ('k') | jingle/glue/fake_ssl_client_socket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698