OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 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 10 matching lines...) Expand all Loading... |
21 #undef None | 21 #undef None |
22 #undef Bool | 22 #undef Bool |
23 #endif | 23 #endif |
24 | 24 |
25 #include <algorithm> | 25 #include <algorithm> |
26 #include <map> | 26 #include <map> |
27 #include <memory> | 27 #include <memory> |
28 #include <vector> | 28 #include <vector> |
29 #include "webrtc/base/arraysize.h" | 29 #include "webrtc/base/arraysize.h" |
30 #include "webrtc/base/asyncsocket.h" | 30 #include "webrtc/base/asyncsocket.h" |
| 31 #include "webrtc/base/checks.h" |
31 #include "webrtc/base/common.h" | 32 #include "webrtc/base/common.h" |
32 #include "webrtc/base/gunit.h" | 33 #include "webrtc/base/gunit.h" |
33 #include "webrtc/base/nethelpers.h" | 34 #include "webrtc/base/nethelpers.h" |
34 #include "webrtc/base/pathutils.h" | 35 #include "webrtc/base/pathutils.h" |
35 #include "webrtc/base/stream.h" | 36 #include "webrtc/base/stream.h" |
36 #include "webrtc/base/stringencode.h" | 37 #include "webrtc/base/stringencode.h" |
37 #include "webrtc/base/stringutils.h" | 38 #include "webrtc/base/stringutils.h" |
38 #include "webrtc/base/thread.h" | 39 #include "webrtc/base/thread.h" |
39 | 40 |
40 namespace testing { | 41 namespace testing { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 write_block_ = SIZE_UNKNOWN; | 171 write_block_ = SIZE_UNKNOWN; |
171 } | 172 } |
172 void QueueString(const char* data) { | 173 void QueueString(const char* data) { |
173 QueueData(data, strlen(data)); | 174 QueueData(data, strlen(data)); |
174 } | 175 } |
175 void QueueStringF(const char* format, ...) { | 176 void QueueStringF(const char* format, ...) { |
176 va_list args; | 177 va_list args; |
177 va_start(args, format); | 178 va_start(args, format); |
178 char buffer[1024]; | 179 char buffer[1024]; |
179 size_t len = vsprintfn(buffer, sizeof(buffer), format, args); | 180 size_t len = vsprintfn(buffer, sizeof(buffer), format, args); |
180 ASSERT(len < sizeof(buffer) - 1); | 181 RTC_CHECK(len < sizeof(buffer) - 1); |
181 va_end(args); | 182 va_end(args); |
182 QueueData(buffer, len); | 183 QueueData(buffer, len); |
183 } | 184 } |
184 void QueueData(const char* data, size_t len) { | 185 void QueueData(const char* data, size_t len) { |
185 readable_data_.insert(readable_data_.end(), data, data + len); | 186 readable_data_.insert(readable_data_.end(), data, data + len); |
186 if ((SS_OPEN == state_) && (readable_data_.size() == len)) { | 187 if ((SS_OPEN == state_) && (readable_data_.size() == len)) { |
187 SignalEvent(this, SE_READ, 0); | 188 SignalEvent(this, SE_READ, 0); |
188 } | 189 } |
189 } | 190 } |
190 std::string ReadData() { | 191 std::string ReadData() { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 AsyncSocket* socket() { return socket_.get(); } | 291 AsyncSocket* socket() { return socket_.get(); } |
291 | 292 |
292 void QueueString(const char* data) { | 293 void QueueString(const char* data) { |
293 QueueData(data, strlen(data)); | 294 QueueData(data, strlen(data)); |
294 } | 295 } |
295 void QueueStringF(const char* format, ...) { | 296 void QueueStringF(const char* format, ...) { |
296 va_list args; | 297 va_list args; |
297 va_start(args, format); | 298 va_start(args, format); |
298 char buffer[1024]; | 299 char buffer[1024]; |
299 size_t len = vsprintfn(buffer, sizeof(buffer), format, args); | 300 size_t len = vsprintfn(buffer, sizeof(buffer), format, args); |
300 ASSERT(len < sizeof(buffer) - 1); | 301 RTC_CHECK(len < sizeof(buffer) - 1); |
301 va_end(args); | 302 va_end(args); |
302 QueueData(buffer, len); | 303 QueueData(buffer, len); |
303 } | 304 } |
304 void QueueData(const char* data, size_t len) { | 305 void QueueData(const char* data, size_t len) { |
305 send_buffer_.insert(send_buffer_.end(), data, data + len); | 306 send_buffer_.insert(send_buffer_.end(), data, data + len); |
306 if (Socket::CS_CONNECTED == socket_->GetState()) { | 307 if (Socket::CS_CONNECTED == socket_->GetState()) { |
307 Flush(); | 308 Flush(); |
308 } | 309 } |
309 } | 310 } |
310 std::string ReadData() { | 311 std::string ReadData() { |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 << minor_version; | 558 << minor_version; |
558 LOG(LS_WARNING) << "XRandr is not supported or is too old (pre 1.3)."; | 559 LOG(LS_WARNING) << "XRandr is not supported or is too old (pre 1.3)."; |
559 return false; | 560 return false; |
560 } | 561 } |
561 #endif | 562 #endif |
562 return true; | 563 return true; |
563 } | 564 } |
564 } // namespace testing | 565 } // namespace testing |
565 | 566 |
566 #endif // WEBRTC_BASE_TESTUTILS_H__ | 567 #endif // WEBRTC_BASE_TESTUTILS_H__ |
OLD | NEW |