| OLD | NEW |
| 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/protocol/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 const char kHostJid[] = "host1@gmail.com/123"; | 49 const char kHostJid[] = "host1@gmail.com/123"; |
| 50 const char kClientJid[] = "host2@gmail.com/321"; | 50 const char kClientJid[] = "host2@gmail.com/321"; |
| 51 | 51 |
| 52 // 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 |
| 53 // between messages (about 1 second for 100 messages). | 53 // between messages (about 1 second for 100 messages). |
| 54 const int kMessageSize = 1024; | 54 const int kMessageSize = 1024; |
| 55 const int kMessages = 100; | 55 const int kMessages = 100; |
| 56 const char kChannelName[] = "test_channel"; | 56 const char kChannelName[] = "test_channel"; |
| 57 | 57 |
| 58 void QuitCurrentThread() { | 58 void QuitCurrentThread() { |
| 59 base::MessageLoop::current()->PostTask(FROM_HERE, | 59 base::MessageLoop::current()->PostTask( |
| 60 base::MessageLoop::QuitClosure()); | 60 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 ACTION(QuitThread) { | 63 ACTION(QuitThread) { |
| 64 QuitCurrentThread(); | 64 QuitCurrentThread(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 ACTION_P(QuitThreadOnCounter, counter) { | 67 ACTION_P(QuitThreadOnCounter, counter) { |
| 68 --(*counter); | 68 --(*counter); |
| 69 EXPECT_GE(*counter, 0); | 69 EXPECT_GE(*counter, 0); |
| 70 if (*counter == 0) | 70 if (*counter == 0) |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 | 629 |
| 630 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), | 630 StreamConnectionTester tester(host_socket_.get(), client_socket_.get(), |
| 631 kMessageSize, 1); | 631 kMessageSize, 1); |
| 632 tester.Start(); | 632 tester.Start(); |
| 633 message_loop_->Run(); | 633 message_loop_->Run(); |
| 634 tester.CheckResults(); | 634 tester.CheckResults(); |
| 635 } | 635 } |
| 636 | 636 |
| 637 } // namespace protocol | 637 } // namespace protocol |
| 638 } // namespace remoting | 638 } // namespace remoting |
| OLD | NEW |