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

Unified Diff: net/dns/mdns_client_unittest.cc

Issue 87693002: Refactored to make MDnsSocketFactory return array of sockets. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: net/dns/mdns_client_unittest.cc
diff --git a/net/dns/mdns_client_unittest.cc b/net/dns/mdns_client_unittest.cc
index f524a5401c74446e558d0c3e4195a7a11dbbeacd..389b6f262d873559c7bec45b532a1a9374971014 100644
--- a/net/dns/mdns_client_unittest.cc
+++ b/net/dns/mdns_client_unittest.cc
@@ -1024,18 +1024,17 @@ class SimpleMockSocketFactory
virtual ~SimpleMockSocketFactory() {
}
- virtual scoped_ptr<DatagramServerSocket> CreateSocket() OVERRIDE {
- MockMDnsDatagramServerSocket* socket = sockets_.back();
- sockets_.weak_erase(sockets_.end() - 1);
- return scoped_ptr<DatagramServerSocket>(socket);
+ virtual void CreateSockets(
+ ScopedVector<MDnsConnection::Socket>* sockets) OVERRIDE {
+ sockets->swap(sockets_);
}
szym 2013/11/27 07:37:44 To avoid weird bugs, either sockets->clear() or DC
Vitaly Buka (NO REVIEWS) 2013/11/27 08:45:37 Done.
- void PushSocket(MockMDnsDatagramServerSocket* socket) {
+ void PushSocket(MDnsConnection::Socket* socket) {
sockets_.push_back(socket);
}
private:
- ScopedVector<MockMDnsDatagramServerSocket> sockets_;
+ ScopedVector<MDnsConnection::Socket> sockets_;
};
class MockMDnsConnectionDelegate : public MDnsConnection::Delegate {
@@ -1064,22 +1063,6 @@ class MDnsConnectionTest : public ::testing::Test {
}
bool InitConnection() {
- EXPECT_CALL(*socket_ipv4_, AllowAddressReuse());
- EXPECT_CALL(*socket_ipv6_, AllowAddressReuse());
-
- EXPECT_CALL(*socket_ipv4_, SetMulticastLoopbackMode(false));
- EXPECT_CALL(*socket_ipv6_, SetMulticastLoopbackMode(false));
-
- EXPECT_CALL(*socket_ipv4_, ListenInternal("0.0.0.0:5353"))
- .WillOnce(Return(OK));
- EXPECT_CALL(*socket_ipv6_, ListenInternal("[::]:5353"))
- .WillOnce(Return(OK));
-
- EXPECT_CALL(*socket_ipv4_, JoinGroupInternal("224.0.0.251"))
- .WillOnce(Return(OK));
- EXPECT_CALL(*socket_ipv6_, JoinGroupInternal("ff02::fb"))
- .WillOnce(Return(OK));
-
return connection_.Init(&factory_);
}
@@ -1142,10 +1125,8 @@ TEST_F(MDnsConnectionTest, Send) {
ASSERT_TRUE(InitConnection());
- EXPECT_CALL(*socket_ipv4_,
- SendToInternal(sample_packet, "224.0.0.251:5353", _));
- EXPECT_CALL(*socket_ipv6_,
- SendToInternal(sample_packet, "[ff02::fb]:5353", _));
+ EXPECT_CALL(*socket_ipv4_, SendToInternal(sample_packet, _));
+ EXPECT_CALL(*socket_ipv6_, SendToInternal(sample_packet, _));
connection_.Send(buf, buf->size());
}

Powered by Google App Engine
This is Rietveld 408576698