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

Side by Side Diff: net/dns/mdns_client_unittest.cc

Issue 623213004: replace OVERRIDE and FINAL with override and final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo unwanted change in comment 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/dns/mdns_client_impl.h ('k') | net/dns/mock_host_resolver.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 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 <queue> 5 #include <queue>
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "net/base/rand_callback.h" 9 #include "net/base/rand_callback.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 private: 385 private:
386 bool set_; 386 bool set_;
387 std::string name_; 387 std::string name_;
388 std::string ptrdomain_; 388 std::string ptrdomain_;
389 int ttl_; 389 int ttl_;
390 }; 390 };
391 391
392 class MDnsTest : public ::testing::Test { 392 class MDnsTest : public ::testing::Test {
393 public: 393 public:
394 virtual void SetUp() OVERRIDE; 394 virtual void SetUp() override;
395 void DeleteTransaction(); 395 void DeleteTransaction();
396 void DeleteBothListeners(); 396 void DeleteBothListeners();
397 void RunFor(base::TimeDelta time_period); 397 void RunFor(base::TimeDelta time_period);
398 void Stop(); 398 void Stop();
399 399
400 MOCK_METHOD2(MockableRecordCallback, void(MDnsTransaction::Result result, 400 MOCK_METHOD2(MockableRecordCallback, void(MDnsTransaction::Result result,
401 const RecordParsed* record)); 401 const RecordParsed* record));
402 402
403 MOCK_METHOD2(MockableRecordCallback2, void(MDnsTransaction::Result result, 403 MOCK_METHOD2(MockableRecordCallback2, void(MDnsTransaction::Result result,
404 const RecordParsed* record)); 404 const RecordParsed* record));
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 EXPECT_CALL(delegate_privet, OnRecordUpdate(MDnsListener::RECORD_REMOVED, _)); 1050 EXPECT_CALL(delegate_privet, OnRecordUpdate(MDnsListener::RECORD_REMOVED, _));
1051 1051
1052 RunFor(base::TimeDelta::FromSeconds(6)); 1052 RunFor(base::TimeDelta::FromSeconds(6));
1053 } 1053 }
1054 1054
1055 // Note: These tests assume that the ipv4 socket will always be created first. 1055 // Note: These tests assume that the ipv4 socket will always be created first.
1056 // This is a simplifying assumption based on the way the code works now. 1056 // This is a simplifying assumption based on the way the code works now.
1057 class SimpleMockSocketFactory : public MDnsSocketFactory { 1057 class SimpleMockSocketFactory : public MDnsSocketFactory {
1058 public: 1058 public:
1059 virtual void CreateSockets( 1059 virtual void CreateSockets(
1060 ScopedVector<DatagramServerSocket>* sockets) OVERRIDE { 1060 ScopedVector<DatagramServerSocket>* sockets) override {
1061 sockets->clear(); 1061 sockets->clear();
1062 sockets->swap(sockets_); 1062 sockets->swap(sockets_);
1063 } 1063 }
1064 1064
1065 void PushSocket(DatagramServerSocket* socket) { 1065 void PushSocket(DatagramServerSocket* socket) {
1066 sockets_.push_back(socket); 1066 sockets_.push_back(socket);
1067 } 1067 }
1068 1068
1069 private: 1069 private:
1070 ScopedVector<DatagramServerSocket> sockets_; 1070 ScopedVector<DatagramServerSocket> sockets_;
(...skipping 10 matching lines...) Expand all
1081 MOCK_METHOD1(OnConnectionError, void(int error)); 1081 MOCK_METHOD1(OnConnectionError, void(int error));
1082 }; 1082 };
1083 1083
1084 class MDnsConnectionTest : public ::testing::Test { 1084 class MDnsConnectionTest : public ::testing::Test {
1085 public: 1085 public:
1086 MDnsConnectionTest() : connection_(&delegate_) { 1086 MDnsConnectionTest() : connection_(&delegate_) {
1087 } 1087 }
1088 1088
1089 protected: 1089 protected:
1090 // Follow successful connection initialization. 1090 // Follow successful connection initialization.
1091 virtual void SetUp() OVERRIDE { 1091 virtual void SetUp() override {
1092 socket_ipv4_ = new MockMDnsDatagramServerSocket(ADDRESS_FAMILY_IPV4); 1092 socket_ipv4_ = new MockMDnsDatagramServerSocket(ADDRESS_FAMILY_IPV4);
1093 socket_ipv6_ = new MockMDnsDatagramServerSocket(ADDRESS_FAMILY_IPV6); 1093 socket_ipv6_ = new MockMDnsDatagramServerSocket(ADDRESS_FAMILY_IPV6);
1094 factory_.PushSocket(socket_ipv6_); 1094 factory_.PushSocket(socket_ipv6_);
1095 factory_.PushSocket(socket_ipv4_); 1095 factory_.PushSocket(socket_ipv4_);
1096 sample_packet_ = MakeString(kSamplePacket1, sizeof(kSamplePacket1)); 1096 sample_packet_ = MakeString(kSamplePacket1, sizeof(kSamplePacket1));
1097 sample_buffer_ = new StringIOBuffer(sample_packet_); 1097 sample_buffer_ = new StringIOBuffer(sample_packet_);
1098 } 1098 }
1099 1099
1100 bool InitConnection() { 1100 bool InitConnection() {
1101 return connection_.Init(&factory_); 1101 return connection_.Init(&factory_);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 1153
1154 ASSERT_TRUE(InitConnection()); 1154 ASSERT_TRUE(InitConnection());
1155 1155
1156 EXPECT_CALL(delegate_, OnConnectionError(ERR_SOCKET_NOT_CONNECTED)); 1156 EXPECT_CALL(delegate_, OnConnectionError(ERR_SOCKET_NOT_CONNECTED));
1157 callback.Run(ERR_SOCKET_NOT_CONNECTED); 1157 callback.Run(ERR_SOCKET_NOT_CONNECTED);
1158 base::MessageLoop::current()->RunUntilIdle(); 1158 base::MessageLoop::current()->RunUntilIdle();
1159 } 1159 }
1160 1160
1161 class MDnsConnectionSendTest : public MDnsConnectionTest { 1161 class MDnsConnectionSendTest : public MDnsConnectionTest {
1162 protected: 1162 protected:
1163 virtual void SetUp() OVERRIDE { 1163 virtual void SetUp() override {
1164 MDnsConnectionTest::SetUp(); 1164 MDnsConnectionTest::SetUp();
1165 EXPECT_CALL(*socket_ipv4_, RecvFrom(_, _, _, _)) 1165 EXPECT_CALL(*socket_ipv4_, RecvFrom(_, _, _, _))
1166 .WillOnce(Return(ERR_IO_PENDING)); 1166 .WillOnce(Return(ERR_IO_PENDING));
1167 EXPECT_CALL(*socket_ipv6_, RecvFrom(_, _, _, _)) 1167 EXPECT_CALL(*socket_ipv6_, RecvFrom(_, _, _, _))
1168 .WillOnce(Return(ERR_IO_PENDING)); 1168 .WillOnce(Return(ERR_IO_PENDING));
1169 EXPECT_TRUE(InitConnection()); 1169 EXPECT_TRUE(InitConnection());
1170 } 1170 }
1171 }; 1171 };
1172 1172
1173 TEST_F(MDnsConnectionSendTest, Send) { 1173 TEST_F(MDnsConnectionSendTest, Send) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 // Expect call for the second IPv6 packed. 1216 // Expect call for the second IPv6 packed.
1217 EXPECT_CALL(*socket_ipv6_, 1217 EXPECT_CALL(*socket_ipv6_,
1218 SendToInternal(sample_packet_, "[ff02::fb]:5353", _)) 1218 SendToInternal(sample_packet_, "[ff02::fb]:5353", _))
1219 .WillOnce(Return(OK)); 1219 .WillOnce(Return(OK));
1220 callback.Run(OK); 1220 callback.Run(OK);
1221 } 1221 }
1222 1222
1223 } // namespace 1223 } // namespace
1224 1224
1225 } // namespace net 1225 } // namespace net
OLDNEW
« no previous file with comments | « net/dns/mdns_client_impl.h ('k') | net/dns/mock_host_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698