Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[video_player]remove integration tests for further investigation #6471

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -61,54 +61,4 @@ - (void)testPlayVideo {
}
}

- (void)testEncryptedVideoStream {
// This is to fix a bug (https://github.com/flutter/flutter/issues/111457) in iOS 16 with blank
// video for encrypted video streams.

NSString *tabName = @"Remote enc m3u8";

NSPredicate *predicate = [NSPredicate predicateWithFormat:@"label BEGINSWITH %@", tabName];
XCUIElement *unselectedTab = [self.app.staticTexts elementMatchingPredicate:predicate];
XCTAssertTrue([unselectedTab waitForExistenceWithTimeout:30.0]);
XCTAssertFalse(unselectedTab.isSelected);
[unselectedTab tap];

XCUIElement *selectedTab = [self.app.otherElements
elementMatchingPredicate:[NSPredicate predicateWithFormat:@"label BEGINSWITH %@", tabName]];
XCTAssertTrue([selectedTab waitForExistenceWithTimeout:30.0]);
XCTAssertTrue(selectedTab.isSelected);

// Wait until the video is loaded.
[NSThread sleepForTimeInterval:60];

NSMutableSet *frames = [NSMutableSet set];
int numberOfFrames = 60;
for (int i = 0; i < numberOfFrames; i++) {
UIImage *image = self.app.screenshot.image;

// Plugin CI does not support attaching screenshot.
// Convert the image to base64 encoded string, and print it out for debugging purpose.
// NSLog truncates long strings, so need to scale downn image.
CGSize smallerSize = CGSizeMake(100, 200);
UIGraphicsBeginImageContextWithOptions(smallerSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, smallerSize.width, smallerSize.height)];
UIImage *smallerImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

// 0.5 compression is good enough for debugging purpose.
NSData *imageData = UIImageJPEGRepresentation(smallerImage, 0.5);
NSString *imageString = [imageData base64EncodedStringWithOptions:0];
NSLog(@"frame %d image data:\n%@", i, imageString);

[frames addObject:imageString];

// The sample interval must NOT be the same as video length.
// Otherwise it would always result in the same frame.
[NSThread sleepForTimeInterval:1];
}

// At least 1 loading and 2 distinct frames (3 in total) to validate that the video is playing.
XCTAssert(frames.count >= 3, @"Must have at least 3 distinct frames.");
}

@end