FBVideoRecordingTests.m 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * Copyright (c) 2015-present, Facebook, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. */
  9. #import <XCTest/XCTest.h>
  10. #import "FBIntegrationTestCase.h"
  11. #import "FBConfiguration.h"
  12. #import "FBMacros.h"
  13. #import "FBScreenRecordingPromise.h"
  14. #import "FBScreenRecordingRequest.h"
  15. #import "FBScreenRecordingContainer.h"
  16. #import "FBXCTestDaemonsProxy.h"
  17. @interface FBVideoRecordingTests : FBIntegrationTestCase
  18. @end
  19. @implementation FBVideoRecordingTests
  20. - (void)setUp
  21. {
  22. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"DisableDiagnosticScreenRecordings"];
  23. [super setUp];
  24. }
  25. - (void)testStartingAndStoppingVideoRecording
  26. {
  27. XCTSkip(@"Failed on Azure Pipeline. Local run succeeded.");
  28. // Video recording is only available since iOS 17
  29. if (SYSTEM_VERSION_LESS_THAN(@"17.0")) {
  30. return;
  31. }
  32. FBScreenRecordingRequest *recordingRequest = [[FBScreenRecordingRequest alloc] initWithFps:24
  33. codec:0];
  34. NSError *error;
  35. FBScreenRecordingPromise *promise = [FBXCTestDaemonsProxy startScreenRecordingWithRequest:recordingRequest
  36. error:&error];
  37. XCTAssertNotNil(promise);
  38. XCTAssertNotNil(promise.identifier);
  39. XCTAssertNil(error);
  40. [FBScreenRecordingContainer.sharedInstance storeScreenRecordingPromise:promise
  41. fps:24
  42. codec:0];
  43. XCTAssertEqual(FBScreenRecordingContainer.sharedInstance.screenRecordingPromise, promise);
  44. [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:2.]];
  45. BOOL isSuccessfull = [FBXCTestDaemonsProxy stopScreenRecordingWithUUID:promise.identifier error:&error];
  46. XCTAssertTrue(isSuccessfull);
  47. XCTAssertNil(error);
  48. [FBScreenRecordingContainer.sharedInstance reset];
  49. XCTAssertNil(FBScreenRecordingContainer.sharedInstance.screenRecordingPromise);
  50. }
  51. @end