-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[camera] Remove OCMock from FLTCamPhotoCaptureTests, FLTSavePhotoDele…
…gateTests and StreamingTests (#8590) Continuation of OCMock removal from tests related to flutter/flutter#119109. Introduces two new protocols `FLTFileWriter` and `FLTCapturePhotoOutput`.
- Loading branch information
Showing
19 changed files
with
329 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCapturePhotoOutput.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
@import camera_avfoundation; | ||
@import AVFoundation; | ||
|
||
/// Mock implementation of `FLTCapturePhotoOutput` protocol which allows injecting a custom | ||
/// implementation. | ||
@interface MockCapturePhotoOutput : NSObject <FLTCapturePhotoOutput> | ||
|
||
// Properties re-declared as read/write so a mocked value can be set during testing. | ||
@property(nonatomic, strong) AVCapturePhotoOutput *photoOutput; | ||
@property(nonatomic, strong) NSArray<AVVideoCodecType> *availablePhotoCodecTypes; | ||
@property(nonatomic, assign) BOOL highResolutionCaptureEnabled; | ||
@property(nonatomic, strong) NSArray<NSNumber *> *supportedFlashModes; | ||
|
||
// Stub that is called when the corresponding public method is called. | ||
@property(nonatomic, copy) void (^capturePhotoWithSettingsStub) | ||
(AVCapturePhotoSettings *, NSObject<AVCapturePhotoCaptureDelegate> *); | ||
|
||
@end |
19 changes: 19 additions & 0 deletions
19
packages/camera/camera_avfoundation/example/ios/RunnerTests/Mocks/MockCapturePhotoOutput.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#import "MockCapturePhotoOutput.h" | ||
|
||
@implementation MockCapturePhotoOutput | ||
- (void)capturePhotoWithSettings:(AVCapturePhotoSettings *)settings | ||
delegate:(id<AVCapturePhotoCaptureDelegate>)delegate { | ||
if (self.capturePhotoWithSettingsStub) { | ||
self.capturePhotoWithSettingsStub(settings, delegate); | ||
} | ||
} | ||
|
||
- (nullable AVCaptureConnection *)connectionWithMediaType:(nonnull AVMediaType)mediaType { | ||
return nil; | ||
} | ||
|
||
@end |
Oops, something went wrong.