Skip to content

Commit 179b37a

Browse files
OmniLab Teamcopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 915311041
1 parent 047058c commit 179b37a

45 files changed

Lines changed: 2950 additions & 141 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/devtools/mobileharness/fe/v6/angular/app/core/models/host_action.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ export declare interface PopularFlag {
5555
}
5656

5757
/**
58-
* A preset configuration for pass-through flags.
58+
* Response for GetPopularFlags API.
5959
*/
60-
export declare interface FlagPreset {
61-
readonly label: string;
62-
readonly value: string;
63-
readonly description: string;
60+
export declare interface GetPopularFlagsResponse {
61+
readonly flags: PopularFlag[];
6462
}
6563

6664
/**
@@ -86,7 +84,12 @@ export declare interface ReleaseReady {
8684
/**
8785
* Represents the status of a Lab Server release.
8886
*/
89-
export type ReleaseStatus = 'Latest' | 'Current' | 'Deprecated' | '';
87+
export type ReleaseStatus =
88+
| 'LATEST'
89+
| 'CURRENT'
90+
| 'LATEST_AND_CURRENT'
91+
| 'VERSION_STATUS_UNSPECIFIED'
92+
| '';
9093

9194
/**
9295
* Configuration for a specific Lab Server release.
@@ -173,6 +176,11 @@ export declare interface CommandRecord {
173176
*/
174177
export declare interface DecommissionHostResponse {}
175178

179+
/**
180+
* Response for UpdatePassThroughFlags API.
181+
*/
182+
export declare interface UpdatePassThroughFlagsResponse {}
183+
176184
/**
177185
* Response for those rollout action
178186
*/

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/fake_host_service.ts

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import {Observable, of, throwError} from 'rxjs';
44
import {
55
DecommissionHostResponse,
66
GetHostDebugInfoResponse,
7+
GetPopularFlagsResponse,
78
HostHeaderInfo,
8-
PopularFlag,
99
PreflightLabServerReleaseResponse,
1010
ReleaseLabServerRequest,
1111
ReleaseLabServerResponse,
1212
RestartLabServerResponse,
1313
StartLabServerResponse,
1414
StopLabServerResponse,
15+
UpdatePassThroughFlagsResponse,
1516
} from '../../models/host_action';
1617
import {
1718
CheckRemoteControlEligibilityResponse,
@@ -113,34 +114,58 @@ export class FakeHostService extends HostService {
113114
});
114115
}
115116

116-
override getPopularFlags(hostName: string): Observable<PopularFlag[]> {
117-
return of([
118-
{
119-
name: 'No Mute Android',
120-
description: 'Disables muting of Android devices',
121-
cmd: '--nomute_android',
122-
},
123-
{
124-
name: 'No Binary Log',
125-
description: 'Disables binary logging to save space',
126-
cmd: '--nobinarylog',
127-
},
128-
{
129-
name: 'Enable Linux Device',
130-
description: 'Enables support for Linux devices',
131-
cmd: '--enable_linux_device',
132-
},
133-
]);
117+
override getPopularFlags(
118+
hostName: string,
119+
): Observable<GetPopularFlagsResponse> {
120+
return of({
121+
flags: [
122+
{
123+
name: 'Standard Satellite',
124+
cmd: '--nomute_android --noandroid_device_daemon',
125+
description: 'Default configuration for Android Satellite Labs',
126+
},
127+
{
128+
name: 'Linux Support',
129+
cmd: '--enable_linux_device',
130+
description: 'Enables detection of Linux devices',
131+
},
132+
{
133+
name: 'Debug Mode',
134+
cmd: '--debug_mode=true --verbose',
135+
description: 'Enables verbose logging for debugging',
136+
},
137+
{
138+
name: 'Flashstation Cache',
139+
cmd: '--flashstation_cache_dir=/tmp/fs_cache',
140+
description: 'Custom cache directory for Flashstation',
141+
},
142+
{
143+
name: 'No Binary Log',
144+
cmd: '--nobinarylog',
145+
description: 'Disables binary logging to save space',
146+
},
147+
{
148+
name: 'Custom Flag',
149+
cmd: `--my_message=":text: field_a: 'test' field_b: 123"`,
150+
description: 'Custom flag for testing',
151+
},
152+
{
153+
name: 'Custom Flag 2',
154+
cmd: `--flagD="some value"`,
155+
description: 'Custom flag for testing 2',
156+
},
157+
],
158+
});
134159
}
135160

136161
override updatePassThroughFlags(
137162
hostName: string,
138163
flags: string,
139-
): Observable<void> {
164+
): Observable<UpdatePassThroughFlagsResponse> {
140165
const scenario = MOCK_HOST_SCENARIOS.find((s) => s.hostName === hostName);
141166
if (scenario && scenario.overview) {
142167
scenario.overview.labServer.passThroughFlags = flags;
143-
return of(undefined);
168+
return of({});
144169
} else {
145170
return throwError(
146171
() =>

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/host_service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
import {InjectionToken} from '@angular/core';
22
import {Observable} from 'rxjs';
3+
34
import {
45
DecommissionHostResponse,
56
GetHostDebugInfoResponse,
7+
GetPopularFlagsResponse,
68
HostHeaderInfo,
7-
PopularFlag,
89
PreflightLabServerReleaseResponse,
910
ReleaseLabServerRequest,
1011
ReleaseLabServerResponse,
1112
RestartLabServerResponse,
1213
StartLabServerResponse,
1314
StopLabServerResponse,
15+
UpdatePassThroughFlagsResponse,
1416
} from '../../models/host_action';
1517
import {
1618
CheckRemoteControlEligibilityResponse,
@@ -57,15 +59,17 @@ export abstract class HostService {
5759
/**
5860
* Retrieves popular pass-through flags for a host.
5961
*/
60-
abstract getPopularFlags(hostName: string): Observable<PopularFlag[]>;
62+
abstract getPopularFlags(
63+
hostName: string,
64+
): Observable<GetPopularFlagsResponse>;
6165

6266
/**
6367
* Updates the pass through flags for a specific host.
6468
*/
6569
abstract updatePassThroughFlags(
6670
hostName: string,
6771
flags: string,
68-
): Observable<void>;
72+
): Observable<UpdatePassThroughFlagsResponse>;
6973

7074
/**
7175
* Retrieves release configurations for a host.

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/http_host_service.spec.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
DecommissionHostResponse,
1111
DeployableVersion,
1212
GetHostDebugInfoResponse,
13+
GetPopularFlagsResponse,
1314
HostHeaderInfo,
1415
PopularFlag,
1516
PreflightLabServerReleaseResponse,
@@ -134,14 +135,15 @@ describe('HttpHostService', () => {
134135

135136
it('should retrieve popular flags', () => {
136137
const mockPopularFlags: PopularFlag[] = [{name: 'flag1'} as PopularFlag];
137-
service.getPopularFlags('test-host').subscribe((flags) => {
138-
expect(flags).toEqual(mockPopularFlags);
138+
const mockResponse: GetPopularFlagsResponse = {flags: mockPopularFlags};
139+
service.getPopularFlags('test-host').subscribe((response) => {
140+
expect(response).toEqual(mockResponse);
139141
});
140142
const req = httpMock.expectOne(
141143
'http://testdomain.com/v6/hosts/test-host/popular-flags',
142144
);
143145
expect(req.request.method).toBe('GET');
144-
req.flush(mockPopularFlags);
146+
req.flush(mockResponse);
145147
});
146148

147149
it('should update pass-through flags', () => {

src/devtools/mobileharness/fe/v6/angular/app/core/services/host/http_host_service.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@ import {APP_DATA, AppData} from '../../models/app_data';
88
import {
99
DecommissionHostResponse,
1010
GetHostDebugInfoResponse,
11+
GetPopularFlagsResponse,
1112
HostHeaderInfo,
12-
PopularFlag,
1313
PreflightLabServerReleaseResponse,
1414
ReleaseLabServerRequest,
1515
ReleaseLabServerResponse,
1616
RestartLabServerResponse,
1717
StartLabServerResponse,
1818
StopLabServerResponse,
19+
UpdatePassThroughFlagsResponse,
1920
} from '../../models/host_action';
2021
import {
2122
CheckRemoteControlEligibilityResponse,
@@ -67,17 +68,19 @@ export class HttpHostService extends HostService {
6768
);
6869
}
6970

70-
override getPopularFlags(hostName: string): Observable<PopularFlag[]> {
71-
return this.http.get<PopularFlag[]>(
71+
override getPopularFlags(
72+
hostName: string,
73+
): Observable<GetPopularFlagsResponse> {
74+
return this.http.get<GetPopularFlagsResponse>(
7275
`${this.apiUrl}/${hostName}/popular-flags`,
7376
);
7477
}
7578

7679
override updatePassThroughFlags(
7780
hostName: string,
7881
flags: string,
79-
): Observable<void> {
80-
return this.http.post<void>(
82+
): Observable<UpdatePassThroughFlagsResponse> {
83+
return this.http.post<UpdatePassThroughFlagsResponse>(
8184
`${this.apiUrl}/${hostName}/updatePassThroughFlags`,
8285
{
8386
flags,

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/hosts/03_shared_mode.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/** @fileoverview Mock host scenario in SHARED device config mode. */
22

33
import {DeviceConfig} from '../../../models/device_config_models';
4+
import {PreflightLabServerReleaseResponse} from '../../../models/host_action';
45
import {HostConfig} from '../../../models/host_config_models';
56
import {MockHostScenario} from '../models';
67
import {
@@ -33,6 +34,25 @@ const HOST_CONFIG: HostConfig = {
3334
},
3435
};
3536

37+
const PREFLIGHT_RESPONSE: PreflightLabServerReleaseResponse = {
38+
ready: {
39+
versions: [
40+
{
41+
name: '[RELEASE] 4.358.0 mobileharness_lab_server',
42+
version: '4.358.0',
43+
status: 'LATEST_AND_CURRENT',
44+
buildTime: new Date(Date.now() - 3600000 * 24).toISOString(),
45+
},
46+
{
47+
name: '[RELEASE] 4.357.0 mobileharness_lab_server',
48+
version: '4.357.0',
49+
status: '',
50+
buildTime: new Date(Date.now() - 3600000 * 48).toISOString(),
51+
},
52+
],
53+
},
54+
};
55+
3656
export const SCENARIO_HOST_SHARED_MODE: MockHostScenario = {
3757
hostName: 'host-shared-mode.example.com',
3858
scenarioName: '3. Shared Mode',
@@ -44,4 +64,5 @@ export const SCENARIO_HOST_SHARED_MODE: MockHostScenario = {
4464
},
4565
defaultDeviceConfig: null, // No default in SHARED mode
4666
actions: createHostActions('RUNNING', true),
67+
releaseResponse: PREFLIGHT_RESPONSE,
4768
};

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/hosts/04_pusher_properties_only.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,7 @@ export const SCENARIO_HOST_PUSHER_PROPERTIES: MockHostScenario = {
5555
},
5656
defaultDeviceConfig: DEFAULT_DEVICE_CONFIG,
5757
actions: createHostActions(),
58+
releaseResponse: {
59+
permissionDenied: {},
60+
},
5861
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/** @fileoverview Mock host scenario with no valid versions for release. */
2+
3+
import {MockHostScenario} from '../models';
4+
import {SCENARIO_HOST_BASIC_EDITABLE} from './02_basic_editable';
5+
import {createDefaultHostOverview} from './ui_status_utils';
6+
7+
/**
8+
* Represents a mock host scenario where there are no valid versions for release.
9+
*/
10+
export const SCENARIO_HOST_NO_VALID_VERSIONS: MockHostScenario = {
11+
...SCENARIO_HOST_BASIC_EDITABLE,
12+
hostName: 'no-valid-versions.host.example.com',
13+
scenarioName: '12. No Valid Versions',
14+
overview: createDefaultHostOverview('no-valid-versions.host.example.com'),
15+
deviceSummaries: [],
16+
releaseResponse: {
17+
ready: {
18+
versions: [],
19+
},
20+
},
21+
};

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/hosts/ui_status_utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export function createDefaultReleaseResponse(): PreflightLabServerReleaseRespons
9090
{
9191
name: 'mobileharness_lab_server',
9292
version: 'v4.349.0',
93-
status: 'Latest',
93+
status: 'LATEST',
9494
buildTime: '2024-03-15 21:30:00',
9595
ports: [{protocol: 'grpc', portNumber: 9994}],
9696
releaseDetails: {
@@ -270,7 +270,7 @@ export function createDefaultReleaseResponse(): PreflightLabServerReleaseRespons
270270
{
271271
name: 'release_configs',
272272
version: 'v4.357.0',
273-
status: 'Current',
273+
status: 'CURRENT',
274274
buildTime: '2025-03-13 12:00:00',
275275
ports: [
276276
{

src/devtools/mobileharness/fe/v6/angular/app/core/services/mock_data/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import {SCENARIO_HOST_DISCOVERY_HIDDEN} from './hosts/08_device_discovery_hidden
4242
import {SCENARIO_HOST_DEVICE_CONFIG_HIDDEN} from './hosts/09_device_config_hidden';
4343
import {SCENARIO_HOST_DEVICE_CONFIG_WIFI_DIMENSIONS_ONLY} from './hosts/10_device_config_wifi_dimensions_only';
4444
import {SCENARIO_HOST_COMING_SOON} from './hosts/11_coming_soon';
45+
import {SCENARIO_HOST_NO_VALID_VERSIONS} from './hosts/12_no_valid_versions';
4546
import {SCENARIO_HOST_X_PROD} from './hosts/host_x_prod';
4647
import {SCENARIO_HOST_Z_PROD} from './hosts/host_z_prod';
4748
import {
@@ -117,6 +118,7 @@ export const MOCK_HOST_SCENARIOS: MockHostScenario[] = [
117118
SCENARIO_HOST_X_PROD,
118119
SCENARIO_HOST_Z_PROD,
119120
SCENARIO_HOST_COMING_SOON,
121+
SCENARIO_HOST_NO_VALID_VERSIONS,
120122
SCENARIO_RC_ALL_VALID,
121123
SCENARIO_RC_MIXED_ALL,
122124
SCENARIO_RC_PROXY_MISMATCH,

0 commit comments

Comments
 (0)