Skip to content

Commit 2081cfa

Browse files
eDO Teammobile-devx-github-bot
authored andcommitted
Test fixes
PiperOrigin-RevId: 879342931
1 parent d09cb63 commit 2081cfa

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

Service/Tests/FunctionalTests/EDOServiceUIBlockTest.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#import "Service/Tests/FunctionalTests/EDOServiceUIBaseTest.h"
1818

19+
#include <pthread.h>
20+
1921
#import "Service/Sources/EDOClientService.h"
2022
#import "Service/Sources/EDOHostService.h"
2123
#import "Service/Sources/NSObject+EDOValueObject.h"
@@ -154,6 +156,7 @@ - (void)testBlockResolveToLocalAddress {
154156

155157
// Sending block to remote process through background eDO host.
156158
dispatch_sync(backgroundQueue, ^{
159+
pthread_set_qos_class_self_np(QOS_CLASS_DEFAULT, 0);
157160
remoteDummy.block = localBlock;
158161
});
159162

Service/Tests/FunctionalTests/EDOServiceUITest.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#import "Service/Tests/FunctionalTests/EDOServiceUIBaseTest.h"
1818

1919
#include <objc/runtime.h>
20+
#include <pthread.h>
2021

2122
#import <CoreImage/CoreImage.h>
2223

@@ -223,7 +224,10 @@ - (void)testMultiplexInvocationStressfully {
223224
- (void)testTemporaryServiceHandlesRecursiveCall {
224225
[self launchApplicationWithPort:EDOTEST_APP_SERVICE_PORT initValue:5];
225226
EDOTestDummy *remoteDummy = [EDOClientService rootObjectWithPort:EDOTEST_APP_SERVICE_PORT];
226-
dispatch_queue_t testQueue = dispatch_queue_create("com.google.edotest", DISPATCH_QUEUE_SERIAL);
227+
// Align QoS with eDO internal threads to avoid priority inversion.
228+
dispatch_queue_attr_t attr =
229+
dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0);
230+
dispatch_queue_t testQueue = dispatch_queue_create("com.google.edotest", attr);
227231

228232
XCTestExpectation *expectation = [self expectationWithDescription:@"recursive call completes."];
229233
__block NSUInteger recursiveLayer = 5;
@@ -273,8 +277,10 @@ - (void)testDispatchAsyncEarlyReturn {
273277

274278
- (void)testDispatchAsyncManyTimes {
275279
[self launchApplicationWithPort:EDOTEST_APP_SERVICE_PORT initValue:8];
280+
dispatch_queue_attr_t attr =
281+
dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_DEFAULT, 0);
276282
NS_VALID_UNTIL_END_OF_SCOPE dispatch_queue_t backgroundQueue =
277-
dispatch_queue_create("com.google.edo.uitest", DISPATCH_QUEUE_SERIAL);
283+
dispatch_queue_create("com.google.edo.uitest", attr);
278284
EDOTestDummyInTest *rootDummy = [[EDOTestDummyInTest alloc] initWithValue:9];
279285
EDOHostService *service = [EDOHostService serviceWithPort:2234
280286
rootObject:rootDummy

0 commit comments

Comments
 (0)