| OLD | NEW |
| 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" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 } | 76 } |
| 77 | 77 |
| 78 void OnTimeoutTerminateThread(bool* timeout) { | 78 void OnTimeoutTerminateThread(bool* timeout) { |
| 79 *timeout = true; | 79 *timeout = true; |
| 80 QuitCurrentThread(); | 80 QuitCurrentThread(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool RunMessageLoopWithTimeout(int timeout_ms) { | 83 bool RunMessageLoopWithTimeout(int timeout_ms) { |
| 84 bool timeout = false; | 84 bool timeout = false; |
| 85 MessageLoop::current()->PostDelayedTask( | 85 MessageLoop::current()->PostDelayedTask( |
| 86 FROM_HERE, base::Bind(OnTimeoutTerminateThread, &timeout), timeout_ms); | 86 FROM_HERE, base::Bind(&OnTimeoutTerminateThread, &timeout), timeout_ms); |
| 87 MessageLoop::current()->Run(); | 87 MessageLoop::current()->Run(); |
| 88 return !timeout; | 88 return !timeout; |
| 89 } | 89 } |
| 90 | 90 |
| 91 ACTION_P(QuitThreadOnCounter, counter) { | 91 ACTION_P(QuitThreadOnCounter, counter) { |
| 92 (*counter)--; | 92 (*counter)--; |
| 93 EXPECT_GE(*counter, 0); | 93 EXPECT_GE(*counter, 0); |
| 94 if (*counter == 0) | 94 if (*counter == 0) |
| 95 QuitCurrentThread(); | 95 QuitCurrentThread(); |
| 96 } | 96 } |
| (...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 ASSERT_TRUE(tester->WaitFinished()); | 788 ASSERT_TRUE(tester->WaitFinished()); |
| 789 LOG(INFO) << "Time for 500k bytes " | 789 LOG(INFO) << "Time for 500k bytes " |
| 790 << tester->GetElapsedTime().InMilliseconds() << " ms."; | 790 << tester->GetElapsedTime().InMilliseconds() << " ms."; |
| 791 | 791 |
| 792 // Connections must be closed while |tester| still exists. | 792 // Connections must be closed while |tester| still exists. |
| 793 CloseSessions(); | 793 CloseSessions(); |
| 794 } | 794 } |
| 795 | 795 |
| 796 } // namespace protocol | 796 } // namespace protocol |
| 797 } // namespace remoting | 797 } // namespace remoting |
| OLD | NEW |