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

Side by Side Diff: remoting/protocol/jingle_session_unittest.cc

Issue 8662001: Remove AccessVerifier interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years 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
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/file_path.h" 6 #include "base/file_path.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop_proxy.h" 8 #include "base/message_loop_proxy.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/time.h" 10 #include "base/time.h"
11 #include "base/test/test_timeouts.h" 11 #include "base/test/test_timeouts.h"
12 #include "crypto/nss_util.h" 12 #include "crypto/nss_util.h"
13 #include "net/base/completion_callback.h" 13 #include "net/base/completion_callback.h"
14 #include "net/base/io_buffer.h" 14 #include "net/base/io_buffer.h"
15 #include "net/base/net_errors.h" 15 #include "net/base/net_errors.h"
16 #include "net/socket/socket.h" 16 #include "net/socket/socket.h"
17 #include "net/socket/stream_socket.h" 17 #include "net/socket/stream_socket.h"
18 #include "remoting/protocol/auth_util.h"
18 #include "remoting/protocol/jingle_session.h" 19 #include "remoting/protocol/jingle_session.h"
19 #include "remoting/protocol/jingle_session_manager.h" 20 #include "remoting/protocol/jingle_session_manager.h"
20 #include "remoting/jingle_glue/jingle_thread.h" 21 #include "remoting/jingle_glue/jingle_thread.h"
21 #include "remoting/jingle_glue/fake_signal_strategy.h" 22 #include "remoting/jingle_glue/fake_signal_strategy.h"
22 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" 25 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h"
25 26
26 using testing::_; 27 using testing::_;
27 using testing::AtMost; 28 using testing::AtMost;
(...skipping 19 matching lines...) Expand all
47 namespace protocol { 48 namespace protocol {
48 49
49 namespace { 50 namespace {
50 51
51 // Send 100 messages 1024 bytes each. UDP messages are sent with 10ms delay 52 // Send 100 messages 1024 bytes each. UDP messages are sent with 10ms delay
52 // between messages (about 1 second for 100 messages). 53 // between messages (about 1 second for 100 messages).
53 const int kMessageSize = 1024; 54 const int kMessageSize = 1024;
54 const int kMessages = 100; 55 const int kMessages = 100;
55 const int kTestDataSize = kMessages * kMessageSize; 56 const int kTestDataSize = kMessages * kMessageSize;
56 const int kUdpWriteDelayMs = 10; 57 const int kUdpWriteDelayMs = 10;
57 const char kTestToken[] = "a_dummy_token";
58 const char kChannelName[] = "test_channel"; 58 const char kChannelName[] = "test_channel";
59 59
60 const char kHostJid[] = "host1@gmail.com/123"; 60 const char kHostJid[] = "host1@gmail.com/123";
61 const char kClientJid[] = "host2@gmail.com/321"; 61 const char kClientJid[] = "host2@gmail.com/321";
62 62
63 const char kTestHostPublicKey[] = 63 const char kTestHostPublicKey[] =
64 "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3nk/8ILc0JBqHgOS0UCOIl4m" 64 "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3nk/8ILc0JBqHgOS0UCOIl4m"
65 "0GUd2FIiZ/6Fc9D/iiyUgli+FIY5dwsrSoNJ87sYGifVDh8a5fdZNV5y58CcrapI5fJI" 65 "0GUd2FIiZ/6Fc9D/iiyUgli+FIY5dwsrSoNJ87sYGifVDh8a5fdZNV5y58CcrapI5fJI"
66 "FpXviSW4g8d/t1gcZkoz1ppmjzbgXm6ckw9Td0yRD0cHu732Ijs+eo8wT0pt4KiHkbyR" 66 "FpXviSW4g8d/t1gcZkoz1ppmjzbgXm6ckw9Td0yRD0cHu732Ijs+eo8wT0pt4KiHkbyR"
67 "iAvjrvkNDlfiEk7tiY7YzD9zTi3146GX6KLz5GQAd/3I8I5QW3ftF1s/m93AHuc383GZ" 67 "iAvjrvkNDlfiEk7tiY7YzD9zTi3146GX6KLz5GQAd/3I8I5QW3ftF1s/m93AHuc383GZ"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 OnStateChange(Session::CONNECTED)) 239 OnStateChange(Session::CONNECTED))
240 .Times(1) 240 .Times(1)
241 .WillOnce(QuitThreadOnCounter(&not_connected_peers)); 241 .WillOnce(QuitThreadOnCounter(&not_connected_peers));
242 // Expect that the connection will be closed eventually. 242 // Expect that the connection will be closed eventually.
243 EXPECT_CALL(client_connection_callback_, 243 EXPECT_CALL(client_connection_callback_,
244 OnStateChange(Session::CLOSED)) 244 OnStateChange(Session::CLOSED))
245 .Times(AtMost(1)); 245 .Times(AtMost(1));
246 } 246 }
247 247
248 client_session_.reset(client_server_->Connect( 248 client_session_.reset(client_server_->Connect(
249 kHostJid, kTestHostPublicKey, kTestToken, 249 kHostJid, kTestHostPublicKey,
250 GenerateSupportAuthToken(kClientJid, kTestSharedSecret),
250 CandidateSessionConfig::CreateDefault(), 251 CandidateSessionConfig::CreateDefault(),
251 base::Bind(&MockSessionCallback::OnStateChange, 252 base::Bind(&MockSessionCallback::OnStateChange,
252 base::Unretained(&client_connection_callback_)))); 253 base::Unretained(&client_connection_callback_))));
253 254
254 client_session_->set_shared_secret(shared_secret); 255 client_session_->set_shared_secret(shared_secret);
255 256
256 return RunMessageLoopWithTimeout(TestTimeouts::action_max_timeout_ms()); 257 return RunMessageLoopWithTimeout(TestTimeouts::action_max_timeout_ms());
257 } 258 }
258 259
259 static void DoNothing() { } 260 static void DoNothing() { }
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 EXPECT_CALL(client_connection_callback_, 665 EXPECT_CALL(client_connection_callback_,
665 OnStateChange(Session::CONNECTING)) 666 OnStateChange(Session::CONNECTING))
666 .Times(1); 667 .Times(1);
667 EXPECT_CALL(client_connection_callback_, 668 EXPECT_CALL(client_connection_callback_,
668 OnStateChange(Session::CLOSED)) 669 OnStateChange(Session::CLOSED))
669 .Times(1) 670 .Times(1)
670 .WillOnce(InvokeWithoutArgs(&QuitCurrentThread)); 671 .WillOnce(InvokeWithoutArgs(&QuitCurrentThread));
671 } 672 }
672 673
673 client_session_.reset(client_server_->Connect( 674 client_session_.reset(client_server_->Connect(
674 kHostJid, kTestHostPublicKey, kTestToken, 675 kHostJid, kTestHostPublicKey,
676 GenerateSupportAuthToken(kClientJid, kTestSharedSecret),
675 CandidateSessionConfig::CreateDefault(), 677 CandidateSessionConfig::CreateDefault(),
676 base::Bind(&MockSessionCallback::OnStateChange, 678 base::Bind(&MockSessionCallback::OnStateChange,
677 base::Unretained(&client_connection_callback_)))); 679 base::Unretained(&client_connection_callback_))));
678 680
679 ASSERT_TRUE(RunMessageLoopWithTimeout(TestTimeouts::action_max_timeout_ms())); 681 ASSERT_TRUE(RunMessageLoopWithTimeout(TestTimeouts::action_max_timeout_ms()));
680 } 682 }
681 683
682 // Verify that we can connect two endpoints. 684 // Verify that we can connect two endpoints.
683 TEST_F(JingleSessionTest, Connect) { 685 TEST_F(JingleSessionTest, Connect) {
684 CreateServerPair(); 686 CreateServerPair();
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 ASSERT_TRUE(tester->WaitFinished()); 773 ASSERT_TRUE(tester->WaitFinished());
772 LOG(INFO) << "Time for 500k bytes " 774 LOG(INFO) << "Time for 500k bytes "
773 << tester->GetElapsedTime().InMilliseconds() << " ms."; 775 << tester->GetElapsedTime().InMilliseconds() << " ms.";
774 776
775 // Connections must be closed while |tester| still exists. 777 // Connections must be closed while |tester| still exists.
776 CloseSessions(); 778 CloseSessions();
777 } 779 }
778 780
779 } // namespace protocol 781 } // namespace protocol
780 } // namespace remoting 782 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/jingle_session.cc ('k') | remoting/protocol/protocol_mock_objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698