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

Unified Diff: remoting/protocol/chromium_socket_factory_unittest.cc

Issue 429113002: Webrtc deps roll. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use webrtc version 6825 and rebase and switch back to original workspace. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/chromium_socket_factory.cc ('k') | remoting/protocol/jingle_messages.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/chromium_socket_factory_unittest.cc
diff --git a/remoting/protocol/chromium_socket_factory_unittest.cc b/remoting/protocol/chromium_socket_factory_unittest.cc
index 8755d66da17e8ae26472c259373c594d8338d905..9a0a4dc025ff61b7eae1085191fd1de12cd4a3fd 100644
--- a/remoting/protocol/chromium_socket_factory_unittest.cc
+++ b/remoting/protocol/chromium_socket_factory_unittest.cc
@@ -8,8 +8,8 @@
#include "base/run_loop.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/libjingle/source/talk/base/asyncpacketsocket.h"
-#include "third_party/libjingle/source/talk/base/socketaddress.h"
+#include "third_party/webrtc/base/asyncpacketsocket.h"
+#include "third_party/webrtc/base/socketaddress.h"
namespace remoting {
namespace protocol {
@@ -21,30 +21,30 @@ class ChromiumSocketFactoryTest : public testing::Test,
socket_factory_.reset(new ChromiumPacketSocketFactory());
socket_.reset(socket_factory_->CreateUdpSocket(
- talk_base::SocketAddress("127.0.0.1", 0), 0, 0));
+ rtc::SocketAddress("127.0.0.1", 0), 0, 0));
ASSERT_TRUE(socket_.get() != NULL);
- EXPECT_EQ(socket_->GetState(), talk_base::AsyncPacketSocket::STATE_BOUND);
+ EXPECT_EQ(socket_->GetState(), rtc::AsyncPacketSocket::STATE_BOUND);
socket_->SignalReadPacket.connect(
this, &ChromiumSocketFactoryTest::OnPacket);
}
- void OnPacket(talk_base::AsyncPacketSocket* socket,
+ void OnPacket(rtc::AsyncPacketSocket* socket,
const char* data, size_t size,
- const talk_base::SocketAddress& address,
- const talk_base::PacketTime& packet_time) {
+ const rtc::SocketAddress& address,
+ const rtc::PacketTime& packet_time) {
EXPECT_EQ(socket, socket_.get());
last_packet_.assign(data, data + size);
last_address_ = address;
run_loop_.Quit();
}
- void VerifyCanSendAndReceive(talk_base::AsyncPacketSocket* sender) {
+ void VerifyCanSendAndReceive(rtc::AsyncPacketSocket* sender) {
// UDP packets may be lost, so we have to retry sending it more than once.
const int kMaxAttempts = 3;
const base::TimeDelta kAttemptPeriod = base::TimeDelta::FromSeconds(1);
std::string test_packet("TEST PACKET");
int attempts = 0;
- talk_base::PacketOptions options;
+ rtc::PacketOptions options;
while (last_packet_.empty() && attempts++ < kMaxAttempts) {
sender->SendTo(test_packet.data(), test_packet.size(),
socket_->GetLocalAddress(), options);
@@ -60,52 +60,52 @@ class ChromiumSocketFactoryTest : public testing::Test,
base::MessageLoopForIO message_loop_;
base::RunLoop run_loop_;
- scoped_ptr<talk_base::PacketSocketFactory> socket_factory_;
- scoped_ptr<talk_base::AsyncPacketSocket> socket_;
+ scoped_ptr<rtc::PacketSocketFactory> socket_factory_;
+ scoped_ptr<rtc::AsyncPacketSocket> socket_;
std::string last_packet_;
- talk_base::SocketAddress last_address_;
+ rtc::SocketAddress last_address_;
};
TEST_F(ChromiumSocketFactoryTest, SendAndReceive) {
- scoped_ptr<talk_base::AsyncPacketSocket> sending_socket(
+ scoped_ptr<rtc::AsyncPacketSocket> sending_socket(
socket_factory_->CreateUdpSocket(
- talk_base::SocketAddress("127.0.0.1", 0), 0, 0));
+ rtc::SocketAddress("127.0.0.1", 0), 0, 0));
ASSERT_TRUE(sending_socket.get() != NULL);
EXPECT_EQ(sending_socket->GetState(),
- talk_base::AsyncPacketSocket::STATE_BOUND);
+ rtc::AsyncPacketSocket::STATE_BOUND);
VerifyCanSendAndReceive(sending_socket.get());
}
TEST_F(ChromiumSocketFactoryTest, SetOptions) {
- EXPECT_EQ(0, socket_->SetOption(talk_base::Socket::OPT_SNDBUF, 4096));
- EXPECT_EQ(0, socket_->SetOption(talk_base::Socket::OPT_RCVBUF, 4096));
+ EXPECT_EQ(0, socket_->SetOption(rtc::Socket::OPT_SNDBUF, 4096));
+ EXPECT_EQ(0, socket_->SetOption(rtc::Socket::OPT_RCVBUF, 4096));
}
TEST_F(ChromiumSocketFactoryTest, PortRange) {
const int kMinPort = 12400;
const int kMaxPort = 12410;
socket_.reset(socket_factory_->CreateUdpSocket(
- talk_base::SocketAddress("127.0.0.1", 0), kMaxPort, kMaxPort));
+ rtc::SocketAddress("127.0.0.1", 0), kMaxPort, kMaxPort));
ASSERT_TRUE(socket_.get() != NULL);
- EXPECT_EQ(socket_->GetState(), talk_base::AsyncPacketSocket::STATE_BOUND);
+ EXPECT_EQ(socket_->GetState(), rtc::AsyncPacketSocket::STATE_BOUND);
EXPECT_GE(socket_->GetLocalAddress().port(), kMinPort);
EXPECT_LE(socket_->GetLocalAddress().port(), kMaxPort);
}
TEST_F(ChromiumSocketFactoryTest, TransientError) {
- scoped_ptr<talk_base::AsyncPacketSocket> sending_socket(
+ scoped_ptr<rtc::AsyncPacketSocket> sending_socket(
socket_factory_->CreateUdpSocket(
- talk_base::SocketAddress("127.0.0.1", 0), 0, 0));
+ rtc::SocketAddress("127.0.0.1", 0), 0, 0));
std::string test_packet("TEST");
// Try sending a packet to an IPv6 address from a socket that's bound to an
// IPv4 address. This send is expected to fail, but the socket should still be
// functional.
sending_socket->SendTo(test_packet.data(), test_packet.size(),
- talk_base::SocketAddress("::1", 0),
- talk_base::PacketOptions());
+ rtc::SocketAddress("::1", 0),
+ rtc::PacketOptions());
// Verify that socket is still usable.
VerifyCanSendAndReceive(sending_socket.get());
« no previous file with comments | « remoting/protocol/chromium_socket_factory.cc ('k') | remoting/protocol/jingle_messages.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698