HTTP2ClientTransportConfigTests.swift 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * Copyright 2024, gRPC Authors All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. import GRPCHTTP2Core
  17. import XCTest
  18. @available(macOS 13.0, iOS 16.0, watchOS 9.0, tvOS 16.0, *)
  19. final class HTTP2ClientTransportConfigTests: XCTestCase {
  20. func testCompressionDefaults() {
  21. let config = HTTP2ClientTransport.Config.Compression.defaults
  22. XCTAssertEqual(config.algorithm, .none)
  23. XCTAssertEqual(config.enabledAlgorithms, .none)
  24. }
  25. func testIdleDefaults() {
  26. let config = HTTP2ClientTransport.Config.Idle.defaults
  27. XCTAssertEqual(config.maxTime, .seconds(30 * 60))
  28. }
  29. func testBackoffDefaults() {
  30. let config = HTTP2ClientTransport.Config.Backoff.defaults
  31. XCTAssertEqual(config.initial, .seconds(1))
  32. XCTAssertEqual(config.max, .seconds(120))
  33. XCTAssertEqual(config.multiplier, 1.6)
  34. XCTAssertEqual(config.jitter, 0.2)
  35. }
  36. func testHTTP2Defaults() {
  37. let config = HTTP2ClientTransport.Config.HTTP2.defaults
  38. XCTAssertEqual(config.maxFrameSize, 16384)
  39. XCTAssertEqual(config.targetWindowSize, 8 * 1024 * 1024)
  40. }
  41. }