tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

ARDFileCaptureController_xctest.mm (1793B)


      1 /*
      2 *  Copyright 2017 The WebRTC project authors. All Rights Reserved.
      3 *
      4 *  Use of this source code is governed by a BSD-style license
      5 *  that can be found in the LICENSE file in the root of the source
      6 *  tree. An additional intellectual property rights grant can be found
      7 *  in the file PATENTS.  All contributing project authors may
      8 *  be found in the AUTHORS file in the root of the source tree.
      9 */
     10 
     11 #import <Foundation/Foundation.h>
     12 #import <OCMock/OCMock.h>
     13 #import <XCTest/XCTest.h>
     14 
     15 #import "ARDFileCaptureController.h"
     16 
     17 #import "sdk/objc/components/capturer/RTCFileVideoCapturer.h"
     18 
     19 NS_CLASS_AVAILABLE_IOS(10)
     20 @interface ARDFileCaptureControllerTests : XCTestCase
     21 
     22 @property(nonatomic, strong) ARDFileCaptureController *fileCaptureController;
     23 @property(nonatomic, strong) id fileCapturerMock;
     24 
     25 @end
     26 
     27 @implementation ARDFileCaptureControllerTests
     28 
     29 @synthesize fileCaptureController = _fileCaptureController;
     30 @synthesize fileCapturerMock = _fileCapturerMock;
     31 
     32 - (void)setUp {
     33  [super setUp];
     34  self.fileCapturerMock =
     35      OCMClassMock([RTC_OBJC_TYPE(RTCFileVideoCapturer) class]);
     36  self.fileCaptureController =
     37      [[ARDFileCaptureController alloc] initWithCapturer:self.fileCapturerMock];
     38 }
     39 
     40 - (void)tearDown {
     41  self.fileCaptureController = nil;
     42  [self.fileCapturerMock stopMocking];
     43  self.fileCapturerMock = nil;
     44  [super tearDown];
     45 }
     46 
     47 - (void)testCaptureIsStarted {
     48  [[self.fileCapturerMock expect] startCapturingFromFileNamed:[OCMArg any]
     49                                                      onError:[OCMArg any]];
     50 
     51  [self.fileCaptureController startCapture];
     52 
     53  [self.fileCapturerMock verify];
     54 }
     55 
     56 - (void)testCaptureIsStoped {
     57  [[self.fileCapturerMock expect] stopCapture];
     58 
     59  [self.fileCaptureController stopCapture];
     60 
     61  [self.fileCapturerMock verify];
     62 }
     63 
     64 @end