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