|
2 | 2 | #include "Immutable/ImmutablePassport.h"
|
3 | 3 | #include "Immutable/ImmutableSubsystem.h"
|
4 | 4 | #include "Engine/GameEngine.h"
|
| 5 | +#include "Misc/AutomationTest.h" |
5 | 6 |
|
6 | 7 | #if WITH_EDITOR
|
7 | 8 | #include "Editor.h"
|
|
11 | 12 |
|
12 | 13 | ASWebAuthenticationSession *_authSession;
|
13 | 14 |
|
14 |
| -// Global variable to track if we're in automation mode |
15 |
| -static BOOL g_isInAutomationMode = NO; |
| 15 | +// Remove the global automation mode variable |
16 | 16 | static NSString* _pendingRedirectScheme = nil;
|
17 | 17 |
|
18 | 18 | @implementation ImmutableMac
|
@@ -65,9 +65,9 @@ static NSString* _pendingRedirectScheme = nil;
|
65 | 65 |
|
66 | 66 | - (void)launchUrl:(const char *)url forRedirectUri:(const char *)redirectUri {
|
67 | 67 | // For automation, use the browser-based method
|
68 |
| - if (g_isInAutomationMode) { |
69 |
| - NSLog(@"Using automation mode for authentication"); |
70 |
| - [self launchUrlInBrowser:url forRedirectUri:redirectUri forAutomation:YES]; |
| 68 | + if (GIsAutomationTesting) { |
| 69 | + NSLog(@"Using automation mode for authentication (GIsAutomationTesting is true)"); |
| 70 | + [self launchUrlInBrowser:url forRedirectUri:redirectUri]; |
71 | 71 | return;
|
72 | 72 | }
|
73 | 73 |
|
@@ -108,11 +108,12 @@ static NSString* _pendingRedirectScheme = nil;
|
108 | 108 | }
|
109 | 109 | }
|
110 | 110 |
|
111 |
| -- (void)launchUrlInBrowser:(const char *)url forRedirectUri:(const char *)redirectUri forAutomation:(BOOL)forAutomation { |
112 |
| - // Set automation mode |
113 |
| - g_isInAutomationMode = forAutomation; |
114 |
| - NSLog(@"Setting automation mode: %@", g_isInAutomationMode ? @"YES" : @"NO"); |
115 |
| - |
| 111 | +- (void)launchUrlInBrowser:(const char *)url forRedirectUri:(const char *)redirectUri { |
| 112 | + // Add redundant check to ensure this only runs for automated testing |
| 113 | + if (!GIsAutomationTesting) { |
| 114 | + return; |
| 115 | + } |
| 116 | + |
116 | 117 | // Create URL object
|
117 | 118 | NSURL *URL = [NSURL URLWithString:[[NSString alloc] initWithUTF8String:url]];
|
118 | 119 |
|
@@ -149,15 +150,4 @@ static NSString* _pendingRedirectScheme = nil;
|
149 | 150 | return [[[NSApplication sharedApplication] windows] firstObject];
|
150 | 151 | }
|
151 | 152 |
|
152 |
| -// Helper method to enable automation mode |
153 |
| -+ (void)setAutomationMode:(BOOL)enabled { |
154 |
| - g_isInAutomationMode = enabled; |
155 |
| - NSLog(@"setAutomationMode called with: %@", enabled ? @"YES" : @"NO"); |
156 |
| -} |
157 |
| - |
158 |
| -// Helper method to check if we're in automation mode |
159 |
| -+ (BOOL)isInAutomationMode { |
160 |
| - return g_isInAutomationMode; |
161 |
| -} |
162 |
| - |
163 | 153 | @end
|
0 commit comments