@@ -49,6 +49,11 @@ internal class MockRUMMonitor: RUMMonitorProtocol {
4949 let end : Date ?
5050 }
5151
52+ struct BodySize : Equatable {
53+ let encoded : Int64
54+ let decoded : Int64
55+ }
56+
5257 enum CalledMethod : Equatable {
5358 case startView( key: String , name: String ? )
5459 case stopView( key: String )
@@ -73,7 +78,8 @@ internal class MockRUMMonitor: RUMMonitorProtocol {
7378 ssl: Interval ,
7479 firstByte: Interval ,
7580 download: Interval ,
76- responseSize: Int64 ? )
81+ responseBodySize: BodySize ? ,
82+ requestBodySize: BodySize ? )
7783 case addLongTasks( time: Date , duration: TimeInterval )
7884 case updatePerformanceMetric( time: Date , metric: DatadogRUM . PerformanceMetric , value: Double )
7985 }
@@ -175,6 +181,14 @@ public struct MockRUMMonitorInternal: RUMMonitorInternalProtocol {
175181 monitor. lastReceivedPerformanceMetrics [ metric] = value
176182 }
177183
184+ public func setInternalViewAttribute(
185+ at time: Date ,
186+ key: AttributeKey ,
187+ value: AttributeValue
188+ ) {
189+ // not implemented in mock
190+ }
191+
178192 public func addResourceMetrics(
179193 at time: Date ,
180194 resourceKey: String ,
@@ -185,7 +199,8 @@ public struct MockRUMMonitorInternal: RUMMonitorInternalProtocol {
185199 ssl: ( start: Date , end: Date ) ? ,
186200 firstByte: ( start: Date , end: Date ) ? ,
187201 download: ( start: Date , end: Date ) ? ,
188- responseSize: Int64 ? ,
202+ responseBodySize: ( encoded: Int64 , decoded: Int64 ) ? ,
203+ requestBodySize: ( encoded: Int64 , decoded: Int64 ) ? ,
189204 attributes: [ AttributeKey : AttributeValue ]
190205 ) {
191206 monitor. calledMethods. append (
@@ -198,7 +213,8 @@ public struct MockRUMMonitorInternal: RUMMonitorInternalProtocol {
198213 ssl: MockRUMMonitor . Interval ( start: ssl? . start, end: ssl? . end) ,
199214 firstByte: MockRUMMonitor . Interval ( start: firstByte? . start, end: firstByte? . end) ,
200215 download: MockRUMMonitor . Interval ( start: download? . start, end: download? . end) ,
201- responseSize: responseSize
216+ responseBodySize: responseBodySize. map { MockRUMMonitor . BodySize ( encoded: $0. encoded, decoded: $0. decoded) } ,
217+ requestBodySize: requestBodySize. map { MockRUMMonitor . BodySize ( encoded: $0. encoded, decoded: $0. decoded) }
202218 )
203219 )
204220 monitor. receivedAttributes. append ( attributes)
0 commit comments