mirror of
https://github.com/status-im/react-native.git
synced 2025-01-16 04:24:15 +00:00
42f7b9e717
Summary: Adds a queue to postMessage so that messages sent close together are not lost. Setting location="a";location="b" results in only "b" reaching shouldStartLoadWithRequest. Making the second update asynchronous with setTimeout does not fix the issue unless a delay is added. With this update, postMessage queues "b" until it gets a "message:received" event that confirms "a" has already been processed. The included test sends two messages from a webview and checks that both are received. It fails against the preexisting code with the first message being dropped. Closes https://github.com/facebook/react-native/pull/11304 Differential Revision: D5481385 Pulled By: hramos fbshipit-source-id: 9b6af195eeff8f20c820e2fcdac997c90763e840
85 lines
2.0 KiB
Objective-C
85 lines
2.0 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 RNTesterIntegrationTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation RNTesterIntegrationTests
|
|
{
|
|
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)
|
|
//RCT_TEST(LayoutEventsTest) // Disabled due to flakiness: #8686784
|
|
RCT_TEST(SimpleSnapshotTest)
|
|
RCT_TEST(SyncMethodTest)
|
|
RCT_TEST(PromiseTest)
|
|
RCT_TEST_ONLY_WITH_PACKAGER(WebSocketTest)
|
|
RCT_TEST(AccessibilityManagerTest)
|
|
|
|
#if !TARGET_OS_TV // tvOS does not fully support WebView
|
|
RCT_TEST(WebViewTest)
|
|
#endif
|
|
|
|
|
|
@end
|