Replace use of gtest expectation macro with XCTest's macro

Bug: webrtc:8382
Change-Id: I9d9276fcb0a9b13a8caa3baca5d3bc5c95c03c6a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/272120
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@google.com>
Cr-Commit-Position: refs/heads/main@{#37879}
This commit is contained in:
Byoungchan Lee 2022-08-19 06:55:59 +09:00 committed by WebRTC LUCI CQ
parent 2e61a8fa60
commit 64c70a260e
2 changed files with 16 additions and 19 deletions

View file

@ -1132,7 +1132,6 @@ if (is_ios || is_mac) {
"../rtc_base:rtc_event", "../rtc_base:rtc_event",
"../rtc_base/system:unused", "../rtc_base/system:unused",
"../system_wrappers", "../system_wrappers",
"../test:test_support", # TODO(webrtc:8382): Remove use of gtest
"//third_party/libyuv", "//third_party/libyuv",
] ]

View file

@ -12,8 +12,6 @@
#include "sdk/objc/helpers/scoped_cftyperef.h" #include "sdk/objc/helpers/scoped_cftyperef.h"
#include "test/gtest.h"
namespace { namespace {
struct TestType { struct TestType {
TestType() : has_value(true) {} TestType() : has_value(true) {}
@ -50,62 +48,62 @@ using ScopedTestType = rtc::internal::ScopedTypeRef<TestTypeRef, TestTypeTraits>
- (void)testShouldNotRetainByDefault { - (void)testShouldNotRetainByDefault {
TestType a; TestType a;
ScopedTestType ref(&a); ScopedTestType ref(&a);
EXPECT_EQ(0, a.retain_count); XCTAssertEqual(0, a.retain_count);
} }
- (void)testShouldRetainWithPolicy { - (void)testShouldRetainWithPolicy {
TestType a; TestType a;
ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN); ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN);
EXPECT_EQ(1, a.retain_count); XCTAssertEqual(1, a.retain_count);
} }
- (void)testShouldReleaseWhenLeavingScope { - (void)testShouldReleaseWhenLeavingScope {
TestType a; TestType a;
EXPECT_EQ(0, a.retain_count); XCTAssertEqual(0, a.retain_count);
{ {
ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN); ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN);
EXPECT_EQ(1, a.retain_count); XCTAssertEqual(1, a.retain_count);
} }
EXPECT_EQ(0, a.retain_count); XCTAssertEqual(0, a.retain_count);
} }
- (void)testShouldBeCopyable { - (void)testShouldBeCopyable {
TestType a; TestType a;
EXPECT_EQ(0, a.retain_count); XCTAssertEqual(0, a.retain_count);
{ {
ScopedTestType ref1(&a, rtc::RetainPolicy::RETAIN); ScopedTestType ref1(&a, rtc::RetainPolicy::RETAIN);
EXPECT_EQ(1, a.retain_count); XCTAssertEqual(1, a.retain_count);
ScopedTestType ref2 = ref1; ScopedTestType ref2 = ref1;
EXPECT_EQ(2, a.retain_count); XCTAssertEqual(2, a.retain_count);
} }
EXPECT_EQ(0, a.retain_count); XCTAssertEqual(0, a.retain_count);
} }
- (void)testCanReleaseOwnership { - (void)testCanReleaseOwnership {
TestType a; TestType a;
EXPECT_EQ(0, a.retain_count); XCTAssertEqual(0, a.retain_count);
{ {
ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN); ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN);
EXPECT_EQ(1, a.retain_count); XCTAssertEqual(1, a.retain_count);
TestTypeRef b = ref.release(); TestTypeRef b = ref.release();
} }
EXPECT_EQ(1, a.retain_count); XCTAssertEqual(1, a.retain_count);
} }
- (void)testShouldBeTestableForTruthiness { - (void)testShouldBeTestableForTruthiness {
ScopedTestType ref; ScopedTestType ref;
EXPECT_FALSE(ref); XCTAssertFalse(ref);
TestType a; TestType a;
ref = &a; ref = &a;
EXPECT_TRUE(ref); XCTAssertTrue(ref);
ref.release(); ref.release();
EXPECT_FALSE(ref); XCTAssertFalse(ref);
} }
- (void)testShouldProvideAccessToWrappedType { - (void)testShouldProvideAccessToWrappedType {
TestType a; TestType a;
ScopedTestType ref(&a); ScopedTestType ref(&a);
EXPECT_EQ(&(a.retain_count), &(ref->retain_count)); XCTAssertEqual(&(a.retain_count), &(ref->retain_count));
} }
@end @end