diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 02:19:10 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-06 02:19:10 +0000 |
commit | d7bd1f86f904275aed0aa483662e1ad72016d9a8 (patch) | |
tree | e9cdf88998324bb9eb87ccd088506c62f383960d /jingle | |
parent | f9939d9350f983a8f392036dc052bdbce7659b03 (diff) | |
download | chromium_src-d7bd1f86f904275aed0aa483662e1ad72016d9a8.zip chromium_src-d7bd1f86f904275aed0aa483662e1ad72016d9a8.tar.gz chromium_src-d7bd1f86f904275aed0aa483662e1ad72016d9a8.tar.bz2 |
Revert 80567 - P2P Transport implementation.TEST=Unittests.BUG=NoneReview URL: http://codereview.chromium.org/6791023
TBR=sergeyu@chromium.org
Review URL: http://codereview.chromium.org/6799003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle')
-rw-r--r-- | jingle/glue/fake_network_manager.cc | 31 | ||||
-rw-r--r-- | jingle/glue/fake_network_manager.h | 34 | ||||
-rw-r--r-- | jingle/glue/thread_wrapper.cc | 23 | ||||
-rw-r--r-- | jingle/glue/thread_wrapper.h | 4 | ||||
-rw-r--r-- | jingle/glue/thread_wrapper_unittest.cc | 31 | ||||
-rw-r--r-- | jingle/jingle.gyp | 2 |
6 files changed, 18 insertions, 107 deletions
diff --git a/jingle/glue/fake_network_manager.cc b/jingle/glue/fake_network_manager.cc deleted file mode 100644 index f37208d..0000000 --- a/jingle/glue/fake_network_manager.cc +++ /dev/null @@ -1,31 +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_network_manager.h" - -#include "base/logging.h" -#include "net/base/ip_endpoint.h" -#include "jingle/glue/utils.h" -#include "third_party/libjingle/source/talk/base/socketaddress.h" - -namespace jingle_glue { - -FakeNetworkManager::FakeNetworkManager(const net::IPAddressNumber& address) - : address_(address) { -} - -FakeNetworkManager::~FakeNetworkManager() { -} - -bool FakeNetworkManager::EnumNetworks( - bool include_ignored, std::vector<talk_base::Network*>* networks) { - net::IPEndPoint endpoint(address_, 0); - talk_base::SocketAddress address; - CHECK(IPEndPointToSocketAddress(endpoint, &address)); - networks->push_back(new talk_base::Network( - "fake", "Fake Network", address.ip(), 0)); - return true; -} - -} // namespace jingle_glue diff --git a/jingle/glue/fake_network_manager.h b/jingle/glue/fake_network_manager.h deleted file mode 100644 index f099c3c..0000000 --- a/jingle/glue/fake_network_manager.h +++ /dev/null @@ -1,34 +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 "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(); - - protected: - // Override from talk_base::NetworkManager. - virtual bool EnumNetworks( - bool include_ignored, - std::vector<talk_base::Network*>* networks) OVERRIDE; - - net::IPAddressNumber address_; -}; - -} // namespace jingle_glue - -#endif // JINGLE_GLUE_FAKE_NETWORK_MANAGER_H_ diff --git a/jingle/glue/thread_wrapper.cc b/jingle/glue/thread_wrapper.cc index fe26094..f4551de 100644 --- a/jingle/glue/thread_wrapper.cc +++ b/jingle/glue/thread_wrapper.cc @@ -6,25 +6,6 @@ namespace jingle_glue { -// static -void JingleThreadWrapper::EnsureForCurrentThread() { - talk_base::Thread* current_thread = talk_base::Thread::Current(); - // If JingleThreadWrapper already exists for the current thread then - // it is returned by talk_base::Thread::Current(). - // talk_base::Thread::Current() may also return non-null value for - // the main thread because talk_base::ThreadManager creates - // talk_base::Thread object for it. IsOwned() allows to distinguish - // talk_base::Thread object created by talk_base::ThreadManager from - // other talk_base::Thread objects. Because talk_base::Thread - // objects should never created by chromium code, we can assume that - // if talk_base::Thread::Current() returns non-null value and it - // isn't the object created by talk_base::ThreadManager then - // JingleThreadWrapper already exists for the current thread. - if (current_thread == NULL || !current_thread->IsOwned()) { - new JingleThreadWrapper(MessageLoop::current()); - } -} - JingleThreadWrapper::JingleThreadWrapper(MessageLoop* message_loop) : message_loop_(message_loop) { DCHECK_EQ(message_loop_, MessageLoop::current()); @@ -114,8 +95,10 @@ void JingleThreadWrapper::RunTask(int task_id) { } } - if (have_message) + if (have_message) { message.phandler->OnMessage(&message); + delete message.pdata; + } } // All methods below are marked as not reached. See comments in the diff --git a/jingle/glue/thread_wrapper.h b/jingle/glue/thread_wrapper.h index 5b5cf08..755d047 100644 --- a/jingle/glue/thread_wrapper.h +++ b/jingle/glue/thread_wrapper.h @@ -24,10 +24,6 @@ class JingleThreadWrapper : public MessageLoop::DestructionObserver, public talk_base::Thread { public: - // Create JingleThreadWrapper for the current thread if it hasn't - // been created yet. - static void EnsureForCurrentThread(); - JingleThreadWrapper(MessageLoop* message_loop); // MessageLoop::DestructionObserver implementation. diff --git a/jingle/glue/thread_wrapper_unittest.cc b/jingle/glue/thread_wrapper_unittest.cc index 18f8bb4..1c8943a 100644 --- a/jingle/glue/thread_wrapper_unittest.cc +++ b/jingle/glue/thread_wrapper_unittest.cc @@ -49,8 +49,7 @@ TEST_F(ThreadWrapperTest, Create) { EXPECT_EQ(thread(), static_cast<talk_base::Thread*>(wrapper_)); } -MATCHER_P3(MatchMessageAndDeleteData, handler, message_id, data, "") { - delete arg->pdata; +MATCHER_P3(MatchMessage, handler, message_id, data, "") { return arg->phandler == handler && arg->message_id == message_id && arg->pdata == data; @@ -70,13 +69,13 @@ TEST_F(ThreadWrapperTest, Post) { InSequence in_seq; EXPECT_CALL(handler1_, OnMessage( - MatchMessageAndDeleteData(&handler1_, kTestMessage1, data1_))); + MatchMessage(&handler1_, kTestMessage1, data1_))); EXPECT_CALL(handler1_, OnMessage( - MatchMessageAndDeleteData(&handler1_, kTestMessage2, data2_))); + MatchMessage(&handler1_, kTestMessage2, data2_))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage1, data3_))); + MatchMessage(&handler2_, kTestMessage1, data3_))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage1, data4_))); + MatchMessage(&handler2_, kTestMessage1, data4_))); message_loop_.RunAllPending(); } @@ -97,13 +96,13 @@ TEST_F(ThreadWrapperTest, PostDelayed) { InSequence in_seq; EXPECT_CALL(handler1_, OnMessage( - MatchMessageAndDeleteData(&handler1_, kTestMessage1, data1_))); + MatchMessage(&handler1_, kTestMessage1, data1_))); EXPECT_CALL(handler1_, OnMessage( - MatchMessageAndDeleteData(&handler1_, kTestMessage2, data2_))); + MatchMessage(&handler1_, kTestMessage2, data2_))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage1, data3_))); + MatchMessage(&handler2_, kTestMessage1, data3_))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage1, data4_))); + MatchMessage(&handler2_, kTestMessage1, data4_))); message_loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), kMaxTestDelay); @@ -122,11 +121,11 @@ TEST_F(ThreadWrapperTest, Clear) { talk_base::MessageData* null_data = NULL; EXPECT_CALL(handler1_, OnMessage( - MatchMessageAndDeleteData(&handler1_, kTestMessage1, null_data))); + MatchMessage(&handler1_, kTestMessage1, null_data))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage1, null_data))); + MatchMessage(&handler2_, kTestMessage1, null_data))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage2, null_data))); + MatchMessage(&handler2_, kTestMessage2, null_data))); message_loop_.RunAllPending(); } @@ -145,11 +144,11 @@ TEST_F(ThreadWrapperTest, ClearDelayed) { talk_base::MessageData* null_data = NULL; EXPECT_CALL(handler1_, OnMessage( - MatchMessageAndDeleteData(&handler1_, kTestMessage1, null_data))); + MatchMessage(&handler1_, kTestMessage1, null_data))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage1, null_data))); + MatchMessage(&handler2_, kTestMessage1, null_data))); EXPECT_CALL(handler2_, OnMessage( - MatchMessageAndDeleteData(&handler2_, kTestMessage1, null_data))); + MatchMessage(&handler2_, kTestMessage1, null_data))); message_loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask(), kMaxTestDelay); diff --git a/jingle/jingle.gyp b/jingle/jingle.gyp index fece532..29c6c82 100644 --- a/jingle/jingle.gyp +++ b/jingle/jingle.gyp @@ -128,8 +128,6 @@ 'target_name': 'jingle_glue_test_util', 'type': '<(library)', 'sources': [ - 'glue/fake_network_manager.cc', - 'glue/fake_network_manager.h', 'glue/fake_socket_factory.cc', 'glue/fake_socket_factory.h', ], |