summaryrefslogtreecommitdiffstats
path: root/jingle
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-21 21:57:48 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-07-21 21:57:48 +0000
commit8b52913dab74239c1ecf7e92859af8e5c8207d19 (patch)
tree09583a17dc800b4f2d53237b04188bd85d17d130 /jingle
parent4af88caf126867032cec11c5a073884668647005 (diff)
downloadchromium_src-8b52913dab74239c1ecf7e92859af8e5c8207d19.zip
chromium_src-8b52913dab74239c1ecf7e92859af8e5c8207d19.tar.gz
chromium_src-8b52913dab74239c1ecf7e92859af8e5c8207d19.tar.bz2
Remove jingle_glue_test_util target
jingle_glue_test_util was added long time ago for P2P API in Pepper. The API was removed long time ago and we no longer need jingle_glue_test_util. Review URL: https://codereview.chromium.org/400093002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284514 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r--jingle/glue/fake_network_manager.cc51
-rw-r--r--jingle/glue/fake_network_manager.h41
-rw-r--r--jingle/glue/fake_socket_factory.cc199
-rw-r--r--jingle/glue/fake_socket_factory.h125
-rw-r--r--jingle/jingle.gyp15
5 files changed, 0 insertions, 431 deletions
diff --git a/jingle/glue/fake_network_manager.cc b/jingle/glue/fake_network_manager.cc
deleted file mode 100644
index 9694ee9..0000000
--- a/jingle/glue/fake_network_manager.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "jingle/glue/fake_network_manager.h"
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/message_loop/message_loop.h"
-#include "jingle/glue/utils.h"
-#include "net/base/ip_endpoint.h"
-#include "third_party/libjingle/source/talk/base/socketaddress.h"
-
-namespace jingle_glue {
-
-FakeNetworkManager::FakeNetworkManager(const net::IPAddressNumber& address)
- : started_(false),
- weak_factory_(this) {
- net::IPEndPoint endpoint(address, 0);
- talk_base::SocketAddress socket_address;
- CHECK(IPEndPointToSocketAddress(endpoint, &socket_address));
- network_.reset(new talk_base::Network("fake", "Fake Network",
- socket_address.ipaddr(), 32));
- network_->AddIP(socket_address.ipaddr());
-}
-
-FakeNetworkManager::~FakeNetworkManager() {
-}
-
-void FakeNetworkManager::StartUpdating() {
- started_ = true;
- base::MessageLoop::current()->PostTask(
- FROM_HERE,
- base::Bind(&FakeNetworkManager::SendNetworksChangedSignal,
- weak_factory_.GetWeakPtr()));
-}
-
-void FakeNetworkManager::StopUpdating() {
- started_ = false;
-}
-
-void FakeNetworkManager::GetNetworks(NetworkList* networks) const {
- networks->clear();
- networks->push_back(network_.get());
-}
-
-void FakeNetworkManager::SendNetworksChangedSignal() {
- SignalNetworksChanged();
-}
-
-} // namespace jingle_glue
diff --git a/jingle/glue/fake_network_manager.h b/jingle/glue/fake_network_manager.h
deleted file mode 100644
index 01e2f91..0000000
--- a/jingle/glue/fake_network_manager.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_
-#define JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_
-
-#include <vector>
-
-#include "base/compiler_specific.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "net/base/net_util.h"
-#include "third_party/libjingle/source/talk/base/network.h"
-
-namespace jingle_glue {
-
-// FakeNetworkManager always returns one interface with the IP address
-// specified in the constructor.
-class FakeNetworkManager : public talk_base::NetworkManager {
- public:
- FakeNetworkManager(const net::IPAddressNumber& address);
- virtual ~FakeNetworkManager();
-
- // talk_base::NetworkManager interface.
- virtual void StartUpdating() OVERRIDE;
- virtual void StopUpdating() OVERRIDE;
- virtual void GetNetworks(NetworkList* networks) const OVERRIDE;
-
- protected:
- void SendNetworksChangedSignal();
-
- bool started_;
- scoped_ptr<talk_base::Network> network_;
-
- base::WeakPtrFactory<FakeNetworkManager> weak_factory_;
-};
-
-} // namespace jingle_glue
-
-#endif // JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_
diff --git a/jingle/glue/fake_socket_factory.cc b/jingle/glue/fake_socket_factory.cc
deleted file mode 100644
index 570c22f..0000000
--- a/jingle/glue/fake_socket_factory.cc
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "jingle/glue/fake_socket_factory.h"
-
-#include "base/bind.h"
-#include "base/message_loop/message_loop.h"
-#include "jingle/glue/utils.h"
-#include "third_party/libjingle/source/talk/base/asyncpacketsocket.h"
-#include "third_party/libjingle/source/talk/base/asyncsocket.h"
-
-namespace jingle_glue {
-
-FakeUDPPacketSocket::FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager,
- const net::IPEndPoint& address)
- : fake_socket_manager_(fake_socket_manager),
- endpoint_(address), state_(IS_OPEN), error_(0) {
- CHECK(IPEndPointToSocketAddress(endpoint_, &local_address_));
- fake_socket_manager_->AddSocket(this);
-}
-
-FakeUDPPacketSocket::~FakeUDPPacketSocket() {
- fake_socket_manager_->RemoveSocket(this);
-}
-
-talk_base::SocketAddress FakeUDPPacketSocket::GetLocalAddress() const {
- DCHECK(CalledOnValidThread());
- return local_address_;
-}
-
-talk_base::SocketAddress FakeUDPPacketSocket::GetRemoteAddress() const {
- DCHECK(CalledOnValidThread());
- return remote_address_;
-}
-
-int FakeUDPPacketSocket::Send(const void *data, size_t data_size,
- const talk_base::PacketOptions& options) {
- DCHECK(CalledOnValidThread());
- return SendTo(data, data_size, remote_address_, options);
-}
-
-int FakeUDPPacketSocket::SendTo(const void *data, size_t data_size,
- const talk_base::SocketAddress& address,
- const talk_base::PacketOptions& options) {
- DCHECK(CalledOnValidThread());
-
- if (state_ == IS_CLOSED) {
- return ENOTCONN;
- }
-
- net::IPEndPoint destination;
- if (!SocketAddressToIPEndPoint(address, &destination)) {
- return EINVAL;
- }
-
- const char* data_char = reinterpret_cast<const char*>(data);
- std::vector<char> data_vector(data_char, data_char + data_size);
-
- fake_socket_manager_->SendPacket(endpoint_, destination, data_vector);
-
- return data_size;
-}
-
-int FakeUDPPacketSocket::Close() {
- DCHECK(CalledOnValidThread());
- state_ = IS_CLOSED;
- return 0;
-}
-
-talk_base::AsyncPacketSocket::State FakeUDPPacketSocket::GetState() const {
- DCHECK(CalledOnValidThread());
-
- switch (state_) {
- case IS_OPEN:
- return STATE_BOUND;
- case IS_CLOSED:
- return STATE_CLOSED;
- }
-
- NOTREACHED();
- return STATE_CLOSED;
-}
-
-int FakeUDPPacketSocket::GetOption(talk_base::Socket::Option opt, int* value) {
- DCHECK(CalledOnValidThread());
- return -1;
-}
-
-int FakeUDPPacketSocket::SetOption(talk_base::Socket::Option opt, int value) {
- DCHECK(CalledOnValidThread());
- return -1;
-}
-
-int FakeUDPPacketSocket::GetError() const {
- DCHECK(CalledOnValidThread());
- return error_;
-}
-
-void FakeUDPPacketSocket::SetError(int error) {
- DCHECK(CalledOnValidThread());
- error_ = error;
-}
-
-void FakeUDPPacketSocket::DeliverPacket(const net::IPEndPoint& from,
- const std::vector<char>& data) {
- DCHECK(CalledOnValidThread());
-
- talk_base::SocketAddress address;
- if (!jingle_glue::IPEndPointToSocketAddress(from, &address)) {
- // We should always be able to convert address here because we
- // don't expect IPv6 address on IPv4 connections.
- NOTREACHED();
- return;
- }
-
- SignalReadPacket(this, &data[0], data.size(), address,
- talk_base::CreatePacketTime(0));
-}
-
-FakeSocketManager::FakeSocketManager()
- : message_loop_(base::MessageLoop::current()) {}
-
-FakeSocketManager::~FakeSocketManager() { }
-
-void FakeSocketManager::SendPacket(const net::IPEndPoint& from,
- const net::IPEndPoint& to,
- const std::vector<char>& data) {
- DCHECK_EQ(base::MessageLoop::current(), message_loop_);
-
- message_loop_->PostTask(
- FROM_HERE,
- base::Bind(&FakeSocketManager::DeliverPacket, this, from, to, data));
-}
-
-void FakeSocketManager::DeliverPacket(const net::IPEndPoint& from,
- const net::IPEndPoint& to,
- const std::vector<char>& data) {
- DCHECK_EQ(base::MessageLoop::current(), message_loop_);
-
- std::map<net::IPEndPoint, FakeUDPPacketSocket*>::iterator it =
- endpoints_.find(to);
- if (it == endpoints_.end()) {
- LOG(WARNING) << "Dropping packet with unknown destination: "
- << to.ToString();
- return;
- }
- it->second->DeliverPacket(from, data);
-}
-
-void FakeSocketManager::AddSocket(FakeUDPPacketSocket* socket_factory) {
- DCHECK_EQ(base::MessageLoop::current(), message_loop_);
-
- endpoints_[socket_factory->endpoint()] = socket_factory;
-}
-
-void FakeSocketManager::RemoveSocket(FakeUDPPacketSocket* socket_factory) {
- DCHECK_EQ(base::MessageLoop::current(), message_loop_);
-
- endpoints_.erase(socket_factory->endpoint());
-}
-
-FakeSocketFactory::FakeSocketFactory(FakeSocketManager* socket_manager,
- const net::IPAddressNumber& address)
- : socket_manager_(socket_manager),
- address_(address),
- last_allocated_port_(0) {
-}
-
-FakeSocketFactory::~FakeSocketFactory() {
-}
-
-talk_base::AsyncPacketSocket* FakeSocketFactory::CreateUdpSocket(
- const talk_base::SocketAddress& local_address, int min_port, int max_port) {
- CHECK_EQ(min_port, 0);
- CHECK_EQ(max_port, 0);
- return new FakeUDPPacketSocket(
- socket_manager_.get(), net::IPEndPoint(address_, ++last_allocated_port_));
-}
-
-talk_base::AsyncPacketSocket* FakeSocketFactory::CreateServerTcpSocket(
- const talk_base::SocketAddress& local_address, int min_port, int max_port,
- int opts) {
- // TODO(sergeyu): Implement fake TCP sockets.
- NOTIMPLEMENTED();
- return NULL;
-}
-
-talk_base::AsyncPacketSocket* FakeSocketFactory::CreateClientTcpSocket(
- const talk_base::SocketAddress& local_address,
- const talk_base::SocketAddress& remote_address,
- const talk_base::ProxyInfo& proxy_info, const std::string& user_agent,
- int opts) {
- // TODO(sergeyu): Implement fake TCP sockets.
- NOTIMPLEMENTED();
- return NULL;
-}
-
-} // namespace jingle_glue
diff --git a/jingle/glue/fake_socket_factory.h b/jingle/glue/fake_socket_factory.h
deleted file mode 100644
index b46cdc6..0000000
--- a/jingle/glue/fake_socket_factory.h
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_
-#define JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_
-
-#include <map>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/memory/ref_counted.h"
-#include "base/threading/non_thread_safe.h"
-#include "net/base/ip_endpoint.h"
-#include "third_party/libjingle/source/talk/base/asyncpacketsocket.h"
-#include "third_party/libjingle/source/talk/p2p/base/packetsocketfactory.h"
-
-namespace base {
-class MessageLoop;
-}
-
-namespace jingle_glue {
-
-class FakeSocketManager;
-
-class FakeUDPPacketSocket : public talk_base::AsyncPacketSocket,
- public base::NonThreadSafe {
- public:
- FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager,
- const net::IPEndPoint& address);
- virtual ~FakeUDPPacketSocket();
-
- const net::IPEndPoint& endpoint() const { return endpoint_; }
- void DeliverPacket(const net::IPEndPoint& from,
- const std::vector<char>& data);
-
- // talk_base::AsyncPacketSocket implementation.
- virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE;
- virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE;
- virtual int Send(const void *pv, size_t cb,
- const talk_base::PacketOptions& options) OVERRIDE;
- virtual int SendTo(const void *pv, size_t cb,
- const talk_base::SocketAddress& addr,
- const talk_base::PacketOptions& options) OVERRIDE;
- virtual int Close() OVERRIDE;
- virtual State GetState() const OVERRIDE;
- virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE;
- virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE;
- virtual int GetError() const OVERRIDE;
- virtual void SetError(int error) OVERRIDE;
-
- private:
- enum InternalState {
- IS_OPEN,
- IS_CLOSED,
- };
-
- scoped_refptr<FakeSocketManager> fake_socket_manager_;
- net::IPEndPoint endpoint_;
- talk_base::SocketAddress local_address_;
- talk_base::SocketAddress remote_address_;
- InternalState state_;
- int error_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeUDPPacketSocket);
-};
-
-class FakeSocketManager : public base::RefCountedThreadSafe<FakeSocketManager> {
- public:
- FakeSocketManager();
-
- void SendPacket(const net::IPEndPoint& from,
- const net::IPEndPoint& to,
- const std::vector<char>& data);
-
- void AddSocket(FakeUDPPacketSocket* socket_factory);
- void RemoveSocket(FakeUDPPacketSocket* socket_factory);
-
- private:
- friend class base::RefCountedThreadSafe<FakeSocketManager>;
-
- ~FakeSocketManager();
-
- void DeliverPacket(const net::IPEndPoint& from,
- const net::IPEndPoint& to,
- const std::vector<char>& data);
-
- base::MessageLoop* message_loop_;
- std::map<net::IPEndPoint, FakeUDPPacketSocket*> endpoints_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeSocketManager);
-};
-
-class FakeSocketFactory : public talk_base::PacketSocketFactory {
- public:
- FakeSocketFactory(FakeSocketManager* socket_manager,
- const net::IPAddressNumber& address);
- virtual ~FakeSocketFactory();
-
- // talk_base::PacketSocketFactory implementation.
- virtual talk_base::AsyncPacketSocket* CreateUdpSocket(
- const talk_base::SocketAddress& local_address,
- int min_port, int max_port) OVERRIDE;
- virtual talk_base::AsyncPacketSocket* CreateServerTcpSocket(
- const talk_base::SocketAddress& local_address, int min_port, int max_port,
- int opts) OVERRIDE;
- virtual talk_base::AsyncPacketSocket* CreateClientTcpSocket(
- const talk_base::SocketAddress& local_address,
- const talk_base::SocketAddress& remote_address,
- const talk_base::ProxyInfo& proxy_info,
- const std::string& user_agent,
- int opts) OVERRIDE;
-
- private:
- scoped_refptr<FakeSocketManager> socket_manager_;
- net::IPAddressNumber address_;
- int last_allocated_port_;
-
- DISALLOW_COPY_AND_ASSIGN(FakeSocketFactory);
-};
-
-} // namespace jingle_glue
-
-#endif // JINGLE_GLUE_FAKE_SOCKET_FACTORY_H_
diff --git a/jingle/jingle.gyp b/jingle/jingle.gyp
index bb635a2..d7a64fa 100644
--- a/jingle/jingle.gyp
+++ b/jingle/jingle.gyp
@@ -118,20 +118,6 @@
],
},
{
- 'target_name': 'jingle_glue_test_util',
- 'type': 'static_library',
- 'sources': [
- 'glue/fake_network_manager.cc',
- 'glue/fake_network_manager.h',
- 'glue/fake_socket_factory.cc',
- 'glue/fake_socket_factory.h',
- ],
- 'dependencies': [
- '../base/base.gyp:base',
- 'jingle_glue',
- ],
- },
- {
'target_name': 'jingle_unittests',
'type': 'executable',
'sources': [
@@ -176,7 +162,6 @@
],
'dependencies': [
'jingle_glue',
- 'jingle_glue_test_util',
'notifier',
'notifier_test_util',
'../base/base.gyp:base',