forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update setAssetDirectory service extension to fail if provided path i…
…s invalid (flutter#35178)
- Loading branch information
1 parent
cdccc60
commit 2c7b4f6
Showing
5 changed files
with
76 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import 'dart:developer' as developer; | ||
|
||
import 'package:litetest/litetest.dart'; | ||
import 'package:vm_service/vm_service.dart' as vms; | ||
import 'package:vm_service/vm_service_io.dart'; | ||
|
||
void main() { | ||
test('Setting invalid directory returns an error', () async { | ||
vms.VmService? vmService; | ||
try { | ||
final developer.ServiceProtocolInfo info = await developer.Service.getInfo(); | ||
if (info.serverUri == null) { | ||
fail('This test must not be run with --disable-observatory.'); | ||
} | ||
|
||
vmService = await vmServiceConnectUri( | ||
'ws://localhost:${info.serverUri!.port}${info.serverUri!.path}ws', | ||
); | ||
final vms.Response response = await vmService.callMethod('_flutter.listViews'); | ||
final List<Object?>? rawViews = response.json!['views'] as List<Object?>?; | ||
final String viewId = (rawViews![0]! as Map<String, Object?>?)!['id']! as String; | ||
|
||
dynamic error; | ||
try { | ||
final vms.Response setAssetDirectoryPath = await vmService.callMethod( | ||
'_flutter.setAssetBundlePath', | ||
args: <String, Object>{ | ||
'viewId': viewId, | ||
'assetDirectory': '' | ||
}, | ||
); | ||
} catch (err) { | ||
error = err; | ||
} | ||
expect(error != null, true); | ||
} finally { | ||
await vmService?.dispose(); | ||
} | ||
}); | ||
} |