Skip to content

Commit

Permalink
Some cleanups
Browse files Browse the repository at this point in the history
Remove unneeded headers
Clean up the interfaces to BPTestBundleConnection and
BPTestDaemonConnection

Signed-off-by: Oscar Bonilla <6f6231@gmail.com>
  • Loading branch information
ob committed Jun 16, 2021
1 parent fe000eb commit 95e469d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
2 changes: 0 additions & 2 deletions bp/src/BPSimulator.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#import "BPConstants.h"
#import "BPCreateSimulatorHandler.h"
#import "BPSimulator.h"
#import "BPTestBundleConnection.h"
#import "BPTestDaemonConnection.h"
#import "BPTreeParser.h"
#import "BPUtils.h"
#import "BPWaitTimer.h"
Expand Down
1 change: 0 additions & 1 deletion bp/src/BPTestBundleConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
@end

@interface BPTestBundleConnection : NSObject
@property (nonatomic, strong) BPConfiguration *config;
@property (nonatomic, strong) BPExecutionContext *context;
@property (nonatomic, strong) BPSimulator *simulator;
@property (nonatomic, copy) void (^completionBlock)(NSError *, pid_t);
Expand Down
4 changes: 2 additions & 2 deletions bp/src/BPTestBundleConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ - (void)connect {
path = NSBundle.mainBundle.executablePath;
}
__block DTXRemoteInvocationReceipt *receipt = [remoteProxy
_IDE_initiateSessionWithIdentifier:self.config.sessionIdentifier
_IDE_initiateSessionWithIdentifier:self.context.config.sessionIdentifier
forClient:[self clientProcessUniqueIdentifier]
atPath:path
protocolVersion:@(BP_DAEMON_PROTOCOL_VERSION)];
Expand Down Expand Up @@ -282,7 +282,7 @@ - (void)stopVideoRecording:(BOOL)forced
- (id)_XCT_launchProcessWithPath:(NSString *)path bundleID:(NSString *)bundleID arguments:(NSArray *)arguments environmentVariables:(NSDictionary *)environment
{
NSMutableDictionary<NSString *, NSString *> *env = [[NSMutableDictionary alloc] init];
[env addEntriesFromDictionary:[SimulatorHelper appLaunchEnvironmentWithBundleID:bundleID device:nil config:_config]];
[env addEntriesFromDictionary:[SimulatorHelper appLaunchEnvironmentWithBundleID:bundleID device:nil config:_context.config]];
[env addEntriesFromDictionary:environment];
NSDictionary *options = @{
@"arguments": arguments,
Expand Down
2 changes: 1 addition & 1 deletion bp/src/BPTestDaemonConnection.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
@interface BPTestDaemonConnection : NSObject
@property (nonatomic, assign) pid_t testRunnerPid;
@property (nonatomic, strong) BPSimulator *simulator;
- (instancetype)initWithDevice:(BPSimulator *)device andInterface:(id<XCTestManager_IDEInterface>)interface;
- (instancetype)initWithDevice:(BPSimulator *)device andInterface:(id<XCTestManager_IDEInterface>)interface andTestRunnerPID: (pid_t) pid;
- (void)connectWithTimeout:(NSTimeInterval)timeout;
@end
5 changes: 3 additions & 2 deletions bp/src/BPTestDaemonConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,19 @@ @interface BPTestDaemonConnection()<XCTestManager_IDEInterface>

@implementation BPTestDaemonConnection

- (instancetype)initWithDevice:(BPSimulator *)simulator andInterface:(id<XCTestManager_IDEInterface>)interface {
- (instancetype)initWithDevice:(BPSimulator *)simulator andInterface:(id<XCTestManager_IDEInterface>)interface andTestRunnerPID: (pid_t) pid {
self = [super init];
if (self) {
self.simulator = simulator;
self.interface = interface;
self.testRunnerPid = pid;
}
return self;
}

- (void)connectWithTimeout:(NSTimeInterval)timeout {
[self connect];
// Pool connection status till it passes.
// Poll connection status till it passes.
[BPUtils runWithTimeOut:timeout until:^BOOL{
return self.connected;
}];
Expand Down
5 changes: 1 addition & 4 deletions bp/src/Bluepill.m
Original file line number Diff line number Diff line change
Expand Up @@ -433,11 +433,8 @@ - (void)connectTestBundleAndTestDaemonWithContext:(BPExecutionContext *)context
return;
}
BPTestBundleConnection *bConnection = [[BPTestBundleConnection alloc] initWithContext:context andInterface:self];
bConnection.simulator = context.runner;
bConnection.config = self.config;
BPTestDaemonConnection *dConnection = [[BPTestDaemonConnection alloc] initWithDevice:context.runner andInterface:nil andTestRunnerPID: context.pid];

BPTestDaemonConnection *dConnection = [[BPTestDaemonConnection alloc] initWithDevice:context.runner andInterface:nil];
dConnection.testRunnerPid = context.pid;
[dConnection connectWithTimeout:180];
[bConnection connectWithTimeout:180];
[bConnection startTestPlan];
Expand Down

0 comments on commit 95e469d

Please sign in to comment.