forked from ConnectSDK/Connect-SDK-iOS-Core
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix photo not displaying on Apple TV with OS 7.2
- Loading branch information
Eugene Nikolskyi
committed
Jun 2, 2015
1 parent
3016756
commit e40e816
Showing
6 changed files
with
177 additions
and
23 deletions.
There are no files selected for viewing
102 changes: 102 additions & 0 deletions
102
ConnectSDKIntegrationTests/AirPlayServiceIntegrationTests.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,102 @@ | ||
// | ||
// AirPlayServiceIntegrationTests.m | ||
// ConnectSDK | ||
// | ||
// Created by Eugene Nikolskyi on 2015-02-06. | ||
// Copyright (c) 2015 LG Electronics. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
#import "AirPlayService.h" | ||
#import "DiscoveryManager.h" | ||
#import "ZeroConfDiscoveryProvider.h" | ||
|
||
#import "OCMArg+ArgumentCaptor.h" | ||
#import "OCMStubRecorder+SpectaAsync.h" | ||
|
||
SpecBegin(AirPlayService) | ||
|
||
describe(@"ConnectSDK", ^{ | ||
__block DiscoveryManager *manager; | ||
__block id delegateStub; | ||
|
||
beforeEach(^{ | ||
manager = [DiscoveryManager new]; | ||
manager.deviceStore = nil; | ||
|
||
delegateStub = OCMProtocolMock(@protocol(DiscoveryManagerDelegate)); | ||
manager.delegate = delegateStub; | ||
|
||
[AirPlayService setAirPlayServiceMode:AirPlayServiceModeMedia]; | ||
[manager registerDeviceService:[AirPlayService class] | ||
withDiscovery:[ZeroConfDiscoveryProvider class]]; | ||
}); | ||
|
||
context(@"after AppleTV device is connected", ^{ | ||
__block ConnectableDevice *appleTV; | ||
|
||
beforeEach(^{ | ||
waitUntil(^(DoneCallback done) { | ||
[OCMStub([delegateStub discoveryManager:manager | ||
didFindDevice:[OCMArg captureTo:&appleTV]]) | ||
andDoneWaiting:done]; | ||
|
||
[manager startDiscovery]; | ||
}); | ||
|
||
expect([appleTV serviceWithName:kConnectSDKAirPlayServiceId]).notTo.beNil(); | ||
}); | ||
|
||
it(@"should display photo", ^{ | ||
NSURL *url = [[NSBundle bundleForClass:self.class] | ||
URLForResource:@"the-san-francisco-peaks-of-flagstaff-718x544" | ||
withExtension:@"jpg"]; | ||
MediaInfo *mediaInfo = [[MediaInfo alloc] initWithURL:url | ||
mimeType:@"image/jpg"]; | ||
|
||
waitUntil(^(DoneCallback done) { | ||
MediaPlayerSuccessBlock successBlock = ^(MediaLaunchObject *_) { | ||
// the delay is not required here, but allows to visually | ||
// check if the image is indeed displayed | ||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, .5 * NSEC_PER_SEC), | ||
dispatch_get_main_queue(), | ||
^{ | ||
done(); | ||
}); | ||
}; | ||
FailureBlock failureBlock = ^(NSError *error) { | ||
failure([NSString stringWithFormat:@"should not happen: %@", | ||
error]); | ||
done(); | ||
}; | ||
[[appleTV mediaPlayer] displayImageWithMediaInfo:mediaInfo | ||
success:successBlock | ||
failure:failureBlock]; | ||
}); | ||
}); | ||
|
||
afterEach(^{ | ||
[appleTV disconnect]; | ||
appleTV = nil; | ||
}); | ||
}); | ||
|
||
afterEach(^{ | ||
[manager stopDiscovery]; | ||
delegateStub = nil; | ||
manager = nil; | ||
}); | ||
}); | ||
|
||
SpecEnd |
File renamed without changes.
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
File renamed without changes.
Binary file added
BIN
+61.4 KB
ConnectSDKTests/SupportingFiles/the-san-francisco-peaks-of-flagstaff-718x544.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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