OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/basictypes.h" | 5 #include "base/macros.h" |
6 #include "base/sync_socket.h" | 6 #include "base/sync_socket.h" |
7 #include "base/threading/simple_thread.h" | 7 #include "base/threading/simple_thread.h" |
8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 | 12 |
13 const int kReceiveTimeoutInMilliseconds = 750; | 13 const int kReceiveTimeoutInMilliseconds = 750; |
14 | 14 |
15 class HangingReceiveThread : public base::DelegateSimpleThread::Delegate { | 15 class HangingReceiveThread : public base::DelegateSimpleThread::Delegate { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ASSERT_TRUE(socket_b.Shutdown()); | 122 ASSERT_TRUE(socket_b.Shutdown()); |
123 thread.Stop(); | 123 thread.Stop(); |
124 | 124 |
125 // Ensure the receive didn't just timeout. | 125 // Ensure the receive didn't just timeout. |
126 ASSERT_LT((base::TimeTicks::Now() - start).InMilliseconds(), | 126 ASSERT_LT((base::TimeTicks::Now() - start).InMilliseconds(), |
127 kReceiveTimeoutInMilliseconds); | 127 kReceiveTimeoutInMilliseconds); |
128 | 128 |
129 ASSERT_TRUE(socket_a.Close()); | 129 ASSERT_TRUE(socket_a.Close()); |
130 ASSERT_TRUE(socket_b.Close()); | 130 ASSERT_TRUE(socket_b.Close()); |
131 } | 131 } |
OLD | NEW |