media/webrtc/trunk/testing/gtest_mac.mm

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
michael@0 2 // Use of this source code is governed by a BSD-style license that can be
michael@0 3 // found in the LICENSE file.
michael@0 4
michael@0 5 #import "gtest_mac.h"
michael@0 6
michael@0 7 #include <gtest/internal/gtest-port.h>
michael@0 8 #include <gtest/internal/gtest-string.h>
michael@0 9 #include <gtest/gtest.h>
michael@0 10
michael@0 11 #ifdef GTEST_OS_MAC
michael@0 12
michael@0 13 #import <Foundation/Foundation.h>
michael@0 14
michael@0 15 namespace testing {
michael@0 16 namespace internal {
michael@0 17
michael@0 18 // This overloaded version allows comparison between ObjC objects that conform
michael@0 19 // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_EQ().
michael@0 20 GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
michael@0 21 const char* actual_expression,
michael@0 22 id<NSObject> expected,
michael@0 23 id<NSObject> actual) {
michael@0 24 if (expected == actual || [expected isEqual:actual]) {
michael@0 25 return AssertionSuccess();
michael@0 26 }
michael@0 27 return EqFailure(expected_expression,
michael@0 28 actual_expression,
michael@0 29 String([[expected description] UTF8String]),
michael@0 30 String([[actual description] UTF8String]),
michael@0 31 false);
michael@0 32 }
michael@0 33
michael@0 34 // This overloaded version allows comparison between ObjC objects that conform
michael@0 35 // to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NE().
michael@0 36 GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
michael@0 37 const char* actual_expression,
michael@0 38 id<NSObject> expected,
michael@0 39 id<NSObject> actual) {
michael@0 40 if (expected != actual && ![expected isEqual:actual]) {
michael@0 41 return AssertionSuccess();
michael@0 42 }
michael@0 43 Message msg;
michael@0 44 msg << "Expected: (" << expected_expression << ") != (" << actual_expression
michael@0 45 << "), actual: " << String([[expected description] UTF8String])
michael@0 46 << " vs " << String([[actual description] UTF8String]);
michael@0 47 return AssertionFailure(msg);
michael@0 48 }
michael@0 49
michael@0 50 } // namespace internal
michael@0 51 } // namespace testing
michael@0 52
michael@0 53 #endif // GTEST_OS_MAC

mercurial