mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 13:50:40 +01:00
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:
parent
2e61a8fa60
commit
64c70a260e
2 changed files with 16 additions and 19 deletions
|
@ -1132,7 +1132,6 @@ if (is_ios || is_mac) {
|
|||
"../rtc_base:rtc_event",
|
||||
"../rtc_base/system:unused",
|
||||
"../system_wrappers",
|
||||
"../test:test_support", # TODO(webrtc:8382): Remove use of gtest
|
||||
"//third_party/libyuv",
|
||||
]
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@
|
|||
|
||||
#include "sdk/objc/helpers/scoped_cftyperef.h"
|
||||
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace {
|
||||
struct TestType {
|
||||
TestType() : has_value(true) {}
|
||||
|
@ -50,62 +48,62 @@ using ScopedTestType = rtc::internal::ScopedTypeRef<TestTypeRef, TestTypeTraits>
|
|||
- (void)testShouldNotRetainByDefault {
|
||||
TestType a;
|
||||
ScopedTestType ref(&a);
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
XCTAssertEqual(0, a.retain_count);
|
||||
}
|
||||
|
||||
- (void)testShouldRetainWithPolicy {
|
||||
TestType a;
|
||||
ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN);
|
||||
EXPECT_EQ(1, a.retain_count);
|
||||
XCTAssertEqual(1, a.retain_count);
|
||||
}
|
||||
|
||||
- (void)testShouldReleaseWhenLeavingScope {
|
||||
TestType a;
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
XCTAssertEqual(0, a.retain_count);
|
||||
{
|
||||
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 {
|
||||
TestType a;
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
XCTAssertEqual(0, a.retain_count);
|
||||
{
|
||||
ScopedTestType ref1(&a, rtc::RetainPolicy::RETAIN);
|
||||
EXPECT_EQ(1, a.retain_count);
|
||||
XCTAssertEqual(1, a.retain_count);
|
||||
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 {
|
||||
TestType a;
|
||||
EXPECT_EQ(0, a.retain_count);
|
||||
XCTAssertEqual(0, a.retain_count);
|
||||
{
|
||||
ScopedTestType ref(&a, rtc::RetainPolicy::RETAIN);
|
||||
EXPECT_EQ(1, a.retain_count);
|
||||
XCTAssertEqual(1, a.retain_count);
|
||||
TestTypeRef b = ref.release();
|
||||
}
|
||||
EXPECT_EQ(1, a.retain_count);
|
||||
XCTAssertEqual(1, a.retain_count);
|
||||
}
|
||||
|
||||
- (void)testShouldBeTestableForTruthiness {
|
||||
ScopedTestType ref;
|
||||
EXPECT_FALSE(ref);
|
||||
XCTAssertFalse(ref);
|
||||
TestType a;
|
||||
ref = &a;
|
||||
EXPECT_TRUE(ref);
|
||||
XCTAssertTrue(ref);
|
||||
ref.release();
|
||||
EXPECT_FALSE(ref);
|
||||
XCTAssertFalse(ref);
|
||||
}
|
||||
|
||||
- (void)testShouldProvideAccessToWrappedType {
|
||||
TestType a;
|
||||
ScopedTestType ref(&a);
|
||||
EXPECT_EQ(&(a.retain_count), &(ref->retain_count));
|
||||
XCTAssertEqual(&(a.retain_count), &(ref->retain_count));
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue