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

Side by Side Diff: webrtc/base/maccocoasocketserver_unittest.mm

Issue 2369013002: Delete macsocketserver.h and related files. (Closed)
Patch Set: Drop macsocketserver_unittest.cc. Created 4 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #include "webrtc/base/gunit.h"
12 #include "webrtc/base/thread.h"
13 #include "webrtc/base/maccocoasocketserver.h"
14
15 namespace rtc {
16
17 class WakeThread : public Thread {
18 public:
19 WakeThread(SocketServer* ss) : ss_(ss) {
20 }
21 virtual ~WakeThread() {
22 Stop();
23 }
24 void Run() {
25 ss_->WakeUp();
26 }
27 private:
28 SocketServer* ss_;
29 };
30
31 // Test that MacCocoaSocketServer::Wait works as expected.
32 TEST(MacCocoaSocketServer, TestWait) {
33 MacCocoaSocketServer server;
34 uint32_t start = Time();
35 server.Wait(1000, true);
36 EXPECT_GE(TimeSince(start), 1000);
37 }
38
39 // Test that MacCocoaSocketServer::Wakeup works as expected.
40 TEST(MacCocoaSocketServer, TestWakeup) {
41 MacCFSocketServer server;
42 WakeThread thread(&server);
43 uint32_t start = Time();
44 thread.Start();
45 server.Wait(10000, true);
46 EXPECT_LT(TimeSince(start), 10000);
47 }
48
49 } // namespace rtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698