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 <WebRTC/RTCFileVideoCapturer.h>
18
19NS_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 = OCMClassMock([RTC_OBJC_TYPE(RTCFileVideoCapturer) class]);
35  self.fileCaptureController =
36      [[ARDFileCaptureController alloc] initWithCapturer:self.fileCapturerMock];
37}
38
39- (void)tearDown {
40  self.fileCaptureController = nil;
41  [self.fileCapturerMock stopMocking];
42  self.fileCapturerMock = nil;
43  [super tearDown];
44}
45
46- (void)testCaptureIsStarted {
47  [[self.fileCapturerMock expect] startCapturingFromFileNamed:[OCMArg any] onError:[OCMArg any]];
48
49  [self.fileCaptureController startCapture];
50
51  [self.fileCapturerMock verify];
52}
53
54- (void)testCaptureIsStoped {
55  [[self.fileCapturerMock expect] stopCapture];
56
57  [self.fileCaptureController stopCapture];
58
59  [self.fileCapturerMock verify];
60}
61
62@end
63