Skip to content

Commit

Permalink
fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Aug 1, 2023
1 parent d008616 commit b0c9058
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,72 +3,72 @@ import XCTest

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)
class SentryFramesTrackerTests: XCTestCase {

private class Fixture {

var displayLinkWrapper: TestDisplayLinkWrapper
var queue: DispatchQueue
lazy var hub = TestHub(client: nil, andScope: nil)
lazy var tracer = SentryTracer(transactionContext: TransactionContext(name: "test transaction", operation: "test operation"), hub: hub)

init() {
displayLinkWrapper = TestDisplayLinkWrapper()
queue = DispatchQueue(label: "SentryFramesTrackerTests", qos: .background, attributes: [.concurrent])
}

lazy var sut: SentryFramesTracker = SentryFramesTracker(displayLinkWrapper: displayLinkWrapper)
}

private var fixture: Fixture!

override func setUp() {
super.setUp()
fixture = Fixture()

#if os(iOS) || os(macOS) || targetEnvironment(macCatalyst)
// the profiler must be running for the frames tracker to record frame rate info etc, validated in assertProfilingData()
SentryProfiler.start(with: fixture.tracer)
SentryProfiler.start(withTracer: fixture.tracer.traceId)
#endif
}

override func tearDown() {
super.tearDown()
clearTestState()
}

func testIsNotRunning_WhenNotStarted() {
XCTAssertFalse(fixture.sut.isRunning)
}

func testIsRunning_WhenStarted() {
let sut = fixture.sut
sut.start()
XCTAssertTrue(sut.isRunning)
}

func testIsNotRunning_WhenStopped() {
let sut = fixture.sut
sut.start()
sut.stop()
XCTAssertFalse(sut.isRunning)
}

func testSlowFrame() throws {
let sut = fixture.sut
sut.start()

fixture.displayLinkWrapper.call()
_ = fixture.displayLinkWrapper.fastestSlowFrame()
fixture.displayLinkWrapper.normalFrame()
_ = fixture.displayLinkWrapper.slowestSlowFrame()

try assert(slow: 2, frozen: 0, total: 3)
}

func testFrozenFrame() throws {
let sut = fixture.sut
sut.start()

fixture.displayLinkWrapper.call()
_ = fixture.displayLinkWrapper.fastestSlowFrame()
_ = fixture.displayLinkWrapper.fastestFrozenFrame()
Expand All @@ -91,7 +91,7 @@ class SentryFramesTrackerTests: XCTestCase {
func testPerformanceOfTrackingFrames() throws {
let sut = fixture.sut
sut.start()

let frames: UInt = 1_000
self.measure {
for _ in 0 ..< frames {
Expand Down
4 changes: 2 additions & 2 deletions Tests/SentryTests/PrivateSentrySDKOnlyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ class PrivateSentrySDKOnlyTests: XCTestCase {
XCTAssertEqual(PrivateSentrySDKOnly.options.enabled, true)
}

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

/**
* Smoke Tests profiling via PrivateSentrySDKOnly. Actual profiling unit tests are done elsewhere.
*/
Expand Down Expand Up @@ -148,8 +150,6 @@ class PrivateSentrySDKOnlyTests: XCTestCase {
XCTAssertNotNil(profile?["frames"])
}

#if os(iOS) || os(tvOS) || targetEnvironment(macCatalyst)

func testIsFramesTrackingRunning() {
XCTAssertFalse(PrivateSentrySDKOnly.isFramesTrackingRunning)
SentryDependencyContainer.sharedInstance().framesTracker.start()
Expand Down

0 comments on commit b0c9058

Please sign in to comment.