| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 private: | 29 private: |
| 30 SocketServer* ss_; | 30 SocketServer* ss_; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 #ifndef CARBON_DEPRECATED | 33 #ifndef CARBON_DEPRECATED |
| 34 | 34 |
| 35 // Test that MacCFSocketServer::Wait works as expected. | 35 // Test that MacCFSocketServer::Wait works as expected. |
| 36 TEST(MacCFSocketServerTest, TestWait) { | 36 TEST(MacCFSocketServerTest, TestWait) { |
| 37 MacCFSocketServer server; | 37 MacCFSocketServer server; |
| 38 uint32 start = Time(); | 38 uint32_t start = Time(); |
| 39 server.Wait(1000, true); | 39 server.Wait(1000, true); |
| 40 EXPECT_GE(TimeSince(start), 1000); | 40 EXPECT_GE(TimeSince(start), 1000); |
| 41 } | 41 } |
| 42 | 42 |
| 43 // Test that MacCFSocketServer::Wakeup works as expected. | 43 // Test that MacCFSocketServer::Wakeup works as expected. |
| 44 TEST(MacCFSocketServerTest, TestWakeup) { | 44 TEST(MacCFSocketServerTest, TestWakeup) { |
| 45 MacCFSocketServer server; | 45 MacCFSocketServer server; |
| 46 WakeThread thread(&server); | 46 WakeThread thread(&server); |
| 47 uint32 start = Time(); | 47 uint32_t start = Time(); |
| 48 thread.Start(); | 48 thread.Start(); |
| 49 server.Wait(10000, true); | 49 server.Wait(10000, true); |
| 50 EXPECT_LT(TimeSince(start), 10000); | 50 EXPECT_LT(TimeSince(start), 10000); |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Test that MacCarbonSocketServer::Wait works as expected. | 53 // Test that MacCarbonSocketServer::Wait works as expected. |
| 54 TEST(MacCarbonSocketServerTest, TestWait) { | 54 TEST(MacCarbonSocketServerTest, TestWait) { |
| 55 MacCarbonSocketServer server; | 55 MacCarbonSocketServer server; |
| 56 uint32 start = Time(); | 56 uint32_t start = Time(); |
| 57 server.Wait(1000, true); | 57 server.Wait(1000, true); |
| 58 EXPECT_GE(TimeSince(start), 1000); | 58 EXPECT_GE(TimeSince(start), 1000); |
| 59 } | 59 } |
| 60 | 60 |
| 61 // Test that MacCarbonSocketServer::Wakeup works as expected. | 61 // Test that MacCarbonSocketServer::Wakeup works as expected. |
| 62 TEST(MacCarbonSocketServerTest, TestWakeup) { | 62 TEST(MacCarbonSocketServerTest, TestWakeup) { |
| 63 MacCarbonSocketServer server; | 63 MacCarbonSocketServer server; |
| 64 WakeThread thread(&server); | 64 WakeThread thread(&server); |
| 65 uint32 start = Time(); | 65 uint32_t start = Time(); |
| 66 thread.Start(); | 66 thread.Start(); |
| 67 server.Wait(10000, true); | 67 server.Wait(10000, true); |
| 68 EXPECT_LT(TimeSince(start), 10000); | 68 EXPECT_LT(TimeSince(start), 10000); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Test that MacCarbonAppSocketServer::Wait works as expected. | 71 // Test that MacCarbonAppSocketServer::Wait works as expected. |
| 72 TEST(MacCarbonAppSocketServerTest, TestWait) { | 72 TEST(MacCarbonAppSocketServerTest, TestWait) { |
| 73 MacCarbonAppSocketServer server; | 73 MacCarbonAppSocketServer server; |
| 74 uint32 start = Time(); | 74 uint32_t start = Time(); |
| 75 server.Wait(1000, true); | 75 server.Wait(1000, true); |
| 76 EXPECT_GE(TimeSince(start), 1000); | 76 EXPECT_GE(TimeSince(start), 1000); |
| 77 } | 77 } |
| 78 | 78 |
| 79 // Test that MacCarbonAppSocketServer::Wakeup works as expected. | 79 // Test that MacCarbonAppSocketServer::Wakeup works as expected. |
| 80 TEST(MacCarbonAppSocketServerTest, TestWakeup) { | 80 TEST(MacCarbonAppSocketServerTest, TestWakeup) { |
| 81 MacCarbonAppSocketServer server; | 81 MacCarbonAppSocketServer server; |
| 82 WakeThread thread(&server); | 82 WakeThread thread(&server); |
| 83 uint32 start = Time(); | 83 uint32_t start = Time(); |
| 84 thread.Start(); | 84 thread.Start(); |
| 85 server.Wait(10000, true); | 85 server.Wait(10000, true); |
| 86 EXPECT_LT(TimeSince(start), 10000); | 86 EXPECT_LT(TimeSince(start), 10000); |
| 87 } | 87 } |
| 88 | 88 |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 // Test that MacAsyncSocket passes all the generic Socket tests. | 91 // Test that MacAsyncSocket passes all the generic Socket tests. |
| 92 class MacAsyncSocketTest : public SocketTest { | 92 class MacAsyncSocketTest : public SocketTest { |
| 93 protected: | 93 protected: |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 229 |
| 230 TEST_F(MacCarbonAppAsyncSocketTest, TestSocketServerWaitIPv4) { | 230 TEST_F(MacCarbonAppAsyncSocketTest, TestSocketServerWaitIPv4) { |
| 231 SocketTest::TestSocketServerWaitIPv4(); | 231 SocketTest::TestSocketServerWaitIPv4(); |
| 232 } | 232 } |
| 233 | 233 |
| 234 TEST_F(MacCarbonAppAsyncSocketTest, TestSocketServerWaitIPv6) { | 234 TEST_F(MacCarbonAppAsyncSocketTest, TestSocketServerWaitIPv6) { |
| 235 SocketTest::TestSocketServerWaitIPv6(); | 235 SocketTest::TestSocketServerWaitIPv6(); |
| 236 } | 236 } |
| 237 #endif | 237 #endif |
| 238 } // namespace rtc | 238 } // namespace rtc |
| OLD | NEW |