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

Side by Side Diff: webrtc/base/testutils.h

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. Created 3 years, 9 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
« no previous file with comments | « webrtc/base/testechoserver.h ('k') | webrtc/base/thread.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 size_t read_block_, write_block_; 269 size_t read_block_, write_block_;
270 }; 270 };
271 271
272 /////////////////////////////////////////////////////////////////////////////// 272 ///////////////////////////////////////////////////////////////////////////////
273 // SocketTestClient 273 // SocketTestClient
274 // Creates a simulated client for testing. Works on real and virtual networks. 274 // Creates a simulated client for testing. Works on real and virtual networks.
275 /////////////////////////////////////////////////////////////////////////////// 275 ///////////////////////////////////////////////////////////////////////////////
276 276
277 class SocketTestClient : public sigslot::has_slots<> { 277 class SocketTestClient : public sigslot::has_slots<> {
278 public: 278 public:
279 SocketTestClient() { 279 SocketTestClient() { Init(nullptr, AF_INET); }
280 Init(NULL, AF_INET); 280 SocketTestClient(AsyncSocket* socket) {
281 } 281 Init(socket, socket->GetLocalAddress().family());
282 SocketTestClient(AsyncSocket* socket) {
283 Init(socket, socket->GetLocalAddress().family());
284 } 282 }
285 SocketTestClient(const SocketAddress& address) { 283 SocketTestClient(const SocketAddress& address) {
286 Init(NULL, address.family()); 284 Init(nullptr, address.family());
287 socket_->Connect(address); 285 socket_->Connect(address);
288 } 286 }
289 287
290 AsyncSocket* socket() { return socket_.get(); } 288 AsyncSocket* socket() { return socket_.get(); }
291 289
292 void QueueString(const char* data) { 290 void QueueString(const char* data) {
293 QueueData(data, strlen(data)); 291 QueueData(data, strlen(data));
294 } 292 }
295 void QueueStringF(const char* format, ...) { 293 void QueueStringF(const char* format, ...) {
296 va_list args; 294 va_list args;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 399
402 void clear() { 400 void clear() {
403 for (size_t i=0; i<clients_.size(); ++i) { 401 for (size_t i=0; i<clients_.size(); ++i) {
404 delete clients_[i]; 402 delete clients_[i];
405 } 403 }
406 clients_.clear(); 404 clients_.clear();
407 } 405 }
408 406
409 private: 407 private:
410 void OnReadEvent(AsyncSocket* socket) { 408 void OnReadEvent(AsyncSocket* socket) {
411 AsyncSocket* accepted = 409 AsyncSocket* accepted = static_cast<AsyncSocket*>(socket_->Accept(nullptr));
412 static_cast<AsyncSocket*>(socket_->Accept(NULL));
413 if (!accepted) 410 if (!accepted)
414 return; 411 return;
415 clients_.push_back(new SocketTestClient(accepted)); 412 clients_.push_back(new SocketTestClient(accepted));
416 } 413 }
417 414
418 std::unique_ptr<AsyncSocket> socket_; 415 std::unique_ptr<AsyncSocket> socket_;
419 std::vector<SocketTestClient*> clients_; 416 std::vector<SocketTestClient*> clients_;
420 }; 417 };
421 418
422 /////////////////////////////////////////////////////////////////////////////// 419 ///////////////////////////////////////////////////////////////////////////////
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 520
524 #define MAYBE_SKIP_SCREENCAST_TEST() \ 521 #define MAYBE_SKIP_SCREENCAST_TEST() \
525 if (!testing::IsScreencastingAvailable()) { \ 522 if (!testing::IsScreencastingAvailable()) { \
526 LOG(LS_WARNING) << "Skipping test, since it doesn't have the requisite " \ 523 LOG(LS_WARNING) << "Skipping test, since it doesn't have the requisite " \
527 << "X environment for screen capture."; \ 524 << "X environment for screen capture."; \
528 return; \ 525 return; \
529 } \ 526 } \
530 527
531 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) 528 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
532 struct XDisplay { 529 struct XDisplay {
533 XDisplay() : display_(XOpenDisplay(NULL)) { } 530 XDisplay() : display_(XOpenDisplay(nullptr)) {}
534 ~XDisplay() { if (display_) XCloseDisplay(display_); } 531 ~XDisplay() { if (display_) XCloseDisplay(display_); }
535 bool IsValid() const { return display_ != NULL; } 532 bool IsValid() const { return display_ != nullptr; }
536 operator Display*() { return display_; } 533 operator Display*() { return display_; }
537 private: 534 private:
538 Display* display_; 535 Display* display_;
539 }; 536 };
540 #endif 537 #endif
541 538
542 // Returns true if screencasting is available. When false, anything that uses 539 // Returns true if screencasting is available. When false, anything that uses
543 // screencasting features may fail. 540 // screencasting features may fail.
544 inline bool IsScreencastingAvailable() { 541 inline bool IsScreencastingAvailable() {
545 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) 542 #if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
(...skipping 11 matching lines...) Expand all
557 << minor_version; 554 << minor_version;
558 LOG(LS_WARNING) << "XRandr is not supported or is too old (pre 1.3)."; 555 LOG(LS_WARNING) << "XRandr is not supported or is too old (pre 1.3).";
559 return false; 556 return false;
560 } 557 }
561 #endif 558 #endif
562 return true; 559 return true;
563 } 560 }
564 } // namespace testing 561 } // namespace testing
565 562
566 #endif // WEBRTC_BASE_TESTUTILS_H__ 563 #endif // WEBRTC_BASE_TESTUTILS_H__
OLDNEW
« no previous file with comments | « webrtc/base/testechoserver.h ('k') | webrtc/base/thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698