mirror of
https://github.com/status-im/react-native.git
synced 2025-01-17 04:50:59 +00:00
52d8851fc8
Summary: In the context of an app an image exists in three resolutions on the server: `thumb` (30px) `feed` (300px) `full` (900px). When looking at an individual item a user can come either from the feed, via a permalink or from other parts of the app. This allows a situation where the `feed` image might or might not already be loaded somewhere in the app. In the detail view I want to render `thumb` with a blur (to quickly display something), then the `feed` image if it exists to have something decent to display until `full` loads. However it is quite a waste to load the `feed` image if it isn't already in cache, and will slow down the time until `full` is loaded. It is possible to track the navigation from feed->detail and that the `feed` image has actually completed loading by the feed component however as component hierarchies grow this turns into quite a lot of prop passing and bad separation of concerns. NSURLRequests accepts a [Cache Policy](https://developer.apple.com/reference/fo Closes https://github.com/facebook/react-native/pull/10844 Differential Revision: D4425959 Pulled By: lacker fbshipit-source-id: 679835439c761a2fc894f56eb6d744c036cf0b49
79 lines
1.9 KiB
Objective-C
79 lines
1.9 KiB
Objective-C
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
|
|
#import <UIKit/UIKit.h>
|
|
#import <XCTest/XCTest.h>
|
|
|
|
#import <RCTTest/RCTTestRunner.h>
|
|
|
|
#define RCT_TEST(name) \
|
|
- (void)test##name \
|
|
{ \
|
|
[_runner runTest:_cmd module:@#name]; \
|
|
}
|
|
|
|
#define RCT_TEST_ONLY_WITH_PACKAGER(name) \
|
|
- (void)test##name \
|
|
{ \
|
|
if (getenv("CI_USE_PACKAGER")) { \
|
|
[_runner runTest:_cmd module:@#name]; \
|
|
} \
|
|
}
|
|
|
|
@interface UIExplorerIntegrationTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation UIExplorerIntegrationTests
|
|
{
|
|
RCTTestRunner *_runner;
|
|
}
|
|
|
|
- (void)setUp
|
|
{
|
|
_runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp", nil);
|
|
_runner.recordMode = NO;
|
|
}
|
|
|
|
#pragma mark - Test harness
|
|
|
|
- (void)testTheTester_waitOneFrame
|
|
{
|
|
[_runner runTest:_cmd
|
|
module:@"IntegrationTestHarnessTest"
|
|
initialProps:@{@"waitOneFrame": @YES}
|
|
configurationBlock:nil];
|
|
}
|
|
|
|
- (void)testTheTester_ExpectError
|
|
{
|
|
[_runner runTest:_cmd
|
|
module:@"IntegrationTestHarnessTest"
|
|
initialProps:@{@"shouldThrow": @YES}
|
|
configurationBlock:nil
|
|
expectErrorRegex:@"because shouldThrow"];
|
|
}
|
|
|
|
#pragma mark - JS tests
|
|
|
|
// This list should be kept in sync with IntegrationTestsApp.js
|
|
RCT_TEST(IntegrationTestHarnessTest)
|
|
RCT_TEST(TimersTest)
|
|
RCT_TEST(AsyncStorageTest)
|
|
RCT_TEST(AppEventsTest)
|
|
RCT_TEST(ImageCachePolicyTest)
|
|
//RCT_TEST(ImageSnapshotTest) // Disabled: #8985988
|
|
//RCT_TEST(LayoutEventsTest) // Disabled due to flakiness: #8686784
|
|
RCT_TEST(SimpleSnapshotTest)
|
|
RCT_TEST(PromiseTest)
|
|
RCT_TEST_ONLY_WITH_PACKAGER(WebSocketTest)
|
|
|
|
|
|
@end
|