wip
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:moonwell_launcher/features/launcher/data/launcher_api_client.dar
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/client_manifest.dart';
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/client_sync_status.dart';
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_account.dart';
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_game_ticket.dart';
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_news_item.dart';
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_realm.dart';
|
||||
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_session.dart';
|
||||
@@ -168,6 +169,8 @@ void main() {
|
||||
await pumpEventQueue(times: 20);
|
||||
|
||||
expect(gameService.launchCount, 1);
|
||||
expect(gameService.launchedWith?.account, 'PLAYERONE');
|
||||
expect(gameService.launchedWith?.ticket, 'A1B2C3D4E5F6G7H8');
|
||||
expect(bloc.state.model.isGameRunning, isTrue);
|
||||
expect(bloc.state.model.canPlay, isFalse);
|
||||
|
||||
@@ -234,6 +237,7 @@ class _FakeLauncherApiClient extends LauncherApiClient {
|
||||
final List<LauncherRealm> realms;
|
||||
final LauncherAccount account;
|
||||
int manifestRequestCount = 0;
|
||||
int gameTicketRequestCount = 0;
|
||||
|
||||
@override
|
||||
Future<List<LauncherNewsItem>> fetchNews(String accessToken) async =>
|
||||
@@ -245,6 +249,16 @@ class _FakeLauncherApiClient extends LauncherApiClient {
|
||||
@override
|
||||
Future<LauncherAccount> fetchAccount(String accessToken) async => account;
|
||||
|
||||
@override
|
||||
Future<LauncherGameTicket> issueGameTicket(String accessToken) async {
|
||||
gameTicketRequestCount += 1;
|
||||
return LauncherGameTicket(
|
||||
account: 'PLAYERONE',
|
||||
ticket: 'A1B2C3D4E5F6G7H8',
|
||||
expiresAt: DateTime.now().toUtc().add(const Duration(seconds: 60)),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ClientManifest> fetchManifest(String accessToken) async {
|
||||
manifestRequestCount += 1;
|
||||
@@ -272,6 +286,7 @@ class _FakeGameInstallationService extends GameInstallationService {
|
||||
class _TrackingGameInstallationService extends _FakeGameInstallationService {
|
||||
final Completer<int> exitCode = Completer<int>();
|
||||
int launchCount = 0;
|
||||
LauncherGameTicket? launchedWith;
|
||||
|
||||
@override
|
||||
Future<bool> hasClientExecutable(String installationDir) async => true;
|
||||
@@ -280,8 +295,12 @@ class _TrackingGameInstallationService extends _FakeGameInstallationService {
|
||||
Future<void> clearCache(String installationDir) async {}
|
||||
|
||||
@override
|
||||
Future<GameProcessHandle> launchGame(String installationDir) async {
|
||||
Future<GameProcessHandle> launchGame(
|
||||
String installationDir, {
|
||||
required LauncherGameTicket authorization,
|
||||
}) async {
|
||||
launchCount += 1;
|
||||
launchedWith = authorization;
|
||||
return GameProcessHandle(pid: 42, exitCode: exitCode.future);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user