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

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

Issue 2819473004: base/testutils.h: Use namespace webrtc::testing instead of plain testing (Closed)
Patch Set: Created 3 years, 8 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/socket_unittest.cc ('k') | webrtc/base/virtualsocket_unittest.cc » ('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 19 matching lines...) Expand all
30 #include "webrtc/base/asyncsocket.h" 30 #include "webrtc/base/asyncsocket.h"
31 #include "webrtc/base/checks.h" 31 #include "webrtc/base/checks.h"
32 #include "webrtc/base/gunit.h" 32 #include "webrtc/base/gunit.h"
33 #include "webrtc/base/nethelpers.h" 33 #include "webrtc/base/nethelpers.h"
34 #include "webrtc/base/pathutils.h" 34 #include "webrtc/base/pathutils.h"
35 #include "webrtc/base/stream.h" 35 #include "webrtc/base/stream.h"
36 #include "webrtc/base/stringencode.h" 36 #include "webrtc/base/stringencode.h"
37 #include "webrtc/base/stringutils.h" 37 #include "webrtc/base/stringutils.h"
38 #include "webrtc/base/thread.h" 38 #include "webrtc/base/thread.h"
39 39
40 namespace webrtc {
40 namespace testing { 41 namespace testing {
41 42
42 using namespace rtc; 43 using namespace rtc;
43 44
44 /////////////////////////////////////////////////////////////////////////////// 45 ///////////////////////////////////////////////////////////////////////////////
45 // StreamSink - Monitor asynchronously signalled events from StreamInterface 46 // StreamSink - Monitor asynchronously signalled events from StreamInterface
46 // or AsyncSocket (which should probably be a StreamInterface. 47 // or AsyncSocket (which should probably be a StreamInterface.
47 /////////////////////////////////////////////////////////////////////////////// 48 ///////////////////////////////////////////////////////////////////////////////
48 49
49 // Note: Any event that is an error is treaded as SSE_ERROR instead of that 50 // Note: Any event that is an error is treaded as SSE_ERROR instead of that
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 414 }
414 415
415 std::unique_ptr<AsyncSocket> socket_; 416 std::unique_ptr<AsyncSocket> socket_;
416 std::vector<SocketTestClient*> clients_; 417 std::vector<SocketTestClient*> clients_;
417 }; 418 };
418 419
419 /////////////////////////////////////////////////////////////////////////////// 420 ///////////////////////////////////////////////////////////////////////////////
420 // Unittest predicates which are similar to STREQ, but for raw memory 421 // Unittest predicates which are similar to STREQ, but for raw memory
421 /////////////////////////////////////////////////////////////////////////////// 422 ///////////////////////////////////////////////////////////////////////////////
422 423
423 inline AssertionResult CmpHelperMemEq(const char* expected_expression, 424 inline ::testing::AssertionResult CmpHelperMemEq(
424 const char* expected_length_expression, 425 const char* expected_expression,
425 const char* actual_expression, 426 const char* expected_length_expression,
426 const char* actual_length_expression, 427 const char* actual_expression,
427 const void* expected, 428 const char* actual_length_expression,
428 size_t expected_length, 429 const void* expected,
429 const void* actual, 430 size_t expected_length,
430 size_t actual_length) 431 const void* actual,
431 { 432 size_t actual_length) {
432 if ((expected_length == actual_length) 433 if ((expected_length == actual_length)
433 && (0 == memcmp(expected, actual, expected_length))) { 434 && (0 == memcmp(expected, actual, expected_length))) {
434 return AssertionSuccess(); 435 return ::testing::AssertionSuccess();
435 } 436 }
436 437
437 Message msg; 438 ::testing::Message msg;
438 msg << "Value of: " << actual_expression 439 msg << "Value of: " << actual_expression
439 << " [" << actual_length_expression << "]"; 440 << " [" << actual_length_expression << "]";
440 if (true) { //!actual_value.Equals(actual_expression)) { 441 if (true) { //!actual_value.Equals(actual_expression)) {
441 size_t buffer_size = actual_length * 2 + 1; 442 size_t buffer_size = actual_length * 2 + 1;
442 char* buffer = STACK_ARRAY(char, buffer_size); 443 char* buffer = STACK_ARRAY(char, buffer_size);
443 hex_encode(buffer, buffer_size, 444 hex_encode(buffer, buffer_size,
444 reinterpret_cast<const char*>(actual), actual_length); 445 reinterpret_cast<const char*>(actual), actual_length);
445 msg << "\n Actual: " << buffer << " [" << actual_length << "]"; 446 msg << "\n Actual: " << buffer << " [" << actual_length << "]";
446 } 447 }
447 448
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 major_version < 1 || 552 major_version < 1 ||
552 (major_version < 2 && minor_version < 3)) { 553 (major_version < 2 && minor_version < 3)) {
553 LOG(LS_WARNING) << "XRandr version: " << major_version << "." 554 LOG(LS_WARNING) << "XRandr version: " << major_version << "."
554 << minor_version; 555 << minor_version;
555 LOG(LS_WARNING) << "XRandr is not supported or is too old (pre 1.3)."; 556 LOG(LS_WARNING) << "XRandr is not supported or is too old (pre 1.3).";
556 return false; 557 return false;
557 } 558 }
558 #endif 559 #endif
559 return true; 560 return true;
560 } 561 }
562
561 } // namespace testing 563 } // namespace testing
564 } // namespace webrtc
562 565
563 #endif // WEBRTC_BASE_TESTUTILS_H__ 566 #endif // WEBRTC_BASE_TESTUTILS_H__
OLDNEW
« no previous file with comments | « webrtc/base/socket_unittest.cc ('k') | webrtc/base/virtualsocket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698