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

Side by Side Diff: remoting/jingle_glue/chromium_socket_factory_unittest.cc

Issue 14314026: remoting: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/jingle_glue/chromium_socket_factory.h" 5 #include "remoting/jingle_glue/chromium_socket_factory.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 19 matching lines...) Expand all
30 void OnPacket(talk_base::AsyncPacketSocket* socket, 30 void OnPacket(talk_base::AsyncPacketSocket* socket,
31 const char* data, size_t size, 31 const char* data, size_t size,
32 const talk_base::SocketAddress& address) { 32 const talk_base::SocketAddress& address) {
33 EXPECT_EQ(socket, socket_.get()); 33 EXPECT_EQ(socket, socket_.get());
34 last_packet_.assign(data, data + size); 34 last_packet_.assign(data, data + size);
35 last_address_ = address; 35 last_address_ = address;
36 run_loop_.Quit(); 36 run_loop_.Quit();
37 } 37 }
38 38
39 protected: 39 protected:
40 MessageLoopForIO message_loop_; 40 base::MessageLoopForIO message_loop_;
41 base::RunLoop run_loop_; 41 base::RunLoop run_loop_;
42 42
43 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; 43 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_;
44 scoped_ptr<talk_base::AsyncPacketSocket> socket_; 44 scoped_ptr<talk_base::AsyncPacketSocket> socket_;
45 45
46 std::string last_packet_; 46 std::string last_packet_;
47 talk_base::SocketAddress last_address_; 47 talk_base::SocketAddress last_address_;
48 }; 48 };
49 49
50 TEST_F(ChromiumSocketFactoryTest, SendAndReceive) { 50 TEST_F(ChromiumSocketFactoryTest, SendAndReceive) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 const int kMaxPort = 12410; 85 const int kMaxPort = 12410;
86 socket_.reset(socket_factory_->CreateUdpSocket( 86 socket_.reset(socket_factory_->CreateUdpSocket(
87 talk_base::SocketAddress("127.0.0.1", 0), kMaxPort, kMaxPort)); 87 talk_base::SocketAddress("127.0.0.1", 0), kMaxPort, kMaxPort));
88 ASSERT_TRUE(socket_.get() != NULL); 88 ASSERT_TRUE(socket_.get() != NULL);
89 EXPECT_EQ(socket_->GetState(), talk_base::AsyncPacketSocket::STATE_BOUND); 89 EXPECT_EQ(socket_->GetState(), talk_base::AsyncPacketSocket::STATE_BOUND);
90 EXPECT_GE(socket_->GetLocalAddress().port(), kMinPort); 90 EXPECT_GE(socket_->GetLocalAddress().port(), kMinPort);
91 EXPECT_LE(socket_->GetLocalAddress().port(), kMaxPort); 91 EXPECT_LE(socket_->GetLocalAddress().port(), kMaxPort);
92 } 92 }
93 93
94 } // namespace remoting 94 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/win/wts_session_process_delegate.cc ('k') | remoting/jingle_glue/iq_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698