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

Unified Diff: webrtc/base/macsocketserver_unittest.cc

Issue 2316563002: Revert of Remove all reference to carbon api (Closed)
Patch Set: Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/macsocketserver.cc ('k') | webrtc/base/macutils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/macsocketserver_unittest.cc
diff --git a/webrtc/base/macsocketserver_unittest.cc b/webrtc/base/macsocketserver_unittest.cc
index 520d226899bc6ef5cff6495f7c35423dee2c7c7c..87cfe07b2f1644ddd16f1945c68e6be729355089 100644
--- a/webrtc/base/macsocketserver_unittest.cc
+++ b/webrtc/base/macsocketserver_unittest.cc
@@ -31,6 +31,64 @@
SocketServer* ss_;
};
+#ifndef CARBON_DEPRECATED
+
+// Test that MacCFSocketServer::Wait works as expected.
+TEST(MacCFSocketServerTest, TestWait) {
+ MacCFSocketServer server;
+ uint32_t start = Time();
+ server.Wait(1000, true);
+ EXPECT_GE(TimeSince(start), 1000);
+}
+
+// Test that MacCFSocketServer::Wakeup works as expected.
+TEST(MacCFSocketServerTest, TestWakeup) {
+ MacCFSocketServer server;
+ WakeThread thread(&server);
+ uint32_t start = Time();
+ thread.Start();
+ server.Wait(10000, true);
+ EXPECT_LT(TimeSince(start), 10000);
+}
+
+// Test that MacCarbonSocketServer::Wait works as expected.
+TEST(MacCarbonSocketServerTest, TestWait) {
+ MacCarbonSocketServer server;
+ uint32_t start = Time();
+ server.Wait(1000, true);
+ EXPECT_GE(TimeSince(start), 1000);
+}
+
+// Test that MacCarbonSocketServer::Wakeup works as expected.
+TEST(MacCarbonSocketServerTest, TestWakeup) {
+ MacCarbonSocketServer server;
+ WakeThread thread(&server);
+ uint32_t start = Time();
+ thread.Start();
+ server.Wait(10000, true);
+ EXPECT_LT(TimeSince(start), 10000);
+}
+
+// Test that MacCarbonAppSocketServer::Wait works as expected.
+TEST(MacCarbonAppSocketServerTest, TestWait) {
+ MacCarbonAppSocketServer server;
+ uint32_t start = Time();
+ server.Wait(1000, true);
+ EXPECT_GE(TimeSince(start), 1000);
+}
+
+// Test that MacCarbonAppSocketServer::Wakeup works as expected.
+TEST(MacCarbonAppSocketServerTest, TestWakeup) {
+ MacCarbonAppSocketServer server;
+ WakeThread thread(&server);
+ uint32_t start = Time();
+ thread.Start();
+ server.Wait(10000, true);
+ EXPECT_LT(TimeSince(start), 10000);
+}
+
+#endif
+
// Test that MacAsyncSocket passes all the generic Socket tests.
class MacAsyncSocketTest : public SocketTest {
protected:
@@ -162,4 +220,20 @@
TEST_F(MacAsyncSocketTest, DISABLED_TestGetSetOptionsIPv6) {
SocketTest::TestGetSetOptionsIPv6();
}
+
+#ifndef CARBON_DEPRECATED
+class MacCarbonAppAsyncSocketTest : public MacAsyncSocketTest {
+ virtual MacBaseSocketServer* CreateSocketServer() {
+ return new MacCarbonAppSocketServer();
+ };
+};
+
+TEST_F(MacCarbonAppAsyncSocketTest, TestSocketServerWaitIPv4) {
+ SocketTest::TestSocketServerWaitIPv4();
+}
+
+TEST_F(MacCarbonAppAsyncSocketTest, TestSocketServerWaitIPv6) {
+ SocketTest::TestSocketServerWaitIPv6();
+}
+#endif
} // namespace rtc
« no previous file with comments | « webrtc/base/macsocketserver.cc ('k') | webrtc/base/macutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698