|
|
|
|
@@ -139,6 +139,14 @@ const FakeVmServiceRequest setAssetBundlePath = FakeVmServiceRequest(
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const FakeVmServiceRequest evict = FakeVmServiceRequest(
|
|
|
|
|
method: 'ext.flutter.evict',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
'value': 'asset',
|
|
|
|
|
'isolateId': '1',
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
final Uri testUri = Uri.parse('foo://bar');
|
|
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
|
@@ -179,7 +187,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
]);
|
|
|
|
|
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
|
|
|
|
final Completer<void> futureAppStart = Completer<void>.sync();
|
|
|
|
|
@@ -203,7 +210,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
]);
|
|
|
|
|
final FakeResidentCompiler residentCompiler = FakeResidentCompiler()
|
|
|
|
|
..nextOutput = const CompilerOutput('foo', 0 ,<Uri>[]);
|
|
|
|
|
@@ -295,7 +301,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
]);
|
|
|
|
|
final FakeResidentCompiler residentCompiler = FakeResidentCompiler()
|
|
|
|
|
..nextOutput = const CompilerOutput('foo', 0 ,<Uri>[]);
|
|
|
|
|
@@ -320,7 +325,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getIsolate',
|
|
|
|
|
@@ -389,7 +393,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
]);
|
|
|
|
|
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
|
|
|
|
@@ -422,7 +425,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
]);
|
|
|
|
|
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
|
|
|
|
final Completer<void> futureAppStart = Completer<void>.sync();
|
|
|
|
|
@@ -444,7 +446,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
]);
|
|
|
|
|
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
|
|
|
|
@@ -479,7 +480,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
]);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -526,7 +526,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getIsolate',
|
|
|
|
|
@@ -571,7 +570,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getVM',
|
|
|
|
|
@@ -632,7 +630,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getVM',
|
|
|
|
|
@@ -697,7 +694,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getVM',
|
|
|
|
|
@@ -765,7 +761,6 @@ void main() {
|
|
|
|
|
jsonResponse: fakeVM.toJson(),
|
|
|
|
|
),
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
listViews,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getVM',
|
|
|
|
|
@@ -853,7 +848,6 @@ void main() {
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getIsolate',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
@@ -914,7 +908,6 @@ void main() {
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getIsolate',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
@@ -981,7 +974,6 @@ void main() {
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
FakeVmServiceRequest(
|
|
|
|
|
method: 'getIsolate',
|
|
|
|
|
args: <String, Object>{
|
|
|
|
|
@@ -1103,7 +1095,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
]);
|
|
|
|
|
final Completer<DebugConnectionInfo> futureConnectionInfo = Completer<DebugConnectionInfo>.sync();
|
|
|
|
|
final Completer<void> futureAppStart = Completer<void>.sync();
|
|
|
|
|
@@ -1421,7 +1412,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
]);
|
|
|
|
|
residentRunner = ColdRunner(
|
|
|
|
|
<FlutterDevice>[
|
|
|
|
|
@@ -1465,7 +1455,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
], wsAddress: testUri);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1488,7 +1477,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
], wsAddress: testUri);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1511,7 +1499,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
], wsAddress: testUri);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1542,7 +1529,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
], wsAddress: testUri);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1573,7 +1559,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
], wsAddress: testUri);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1597,7 +1582,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
], wsAddress: testUri);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1625,7 +1609,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
], wsAddress: testUri);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1646,7 +1629,6 @@ void main() {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
]);
|
|
|
|
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
@@ -1925,6 +1907,72 @@ void main() {
|
|
|
|
|
|
|
|
|
|
expect((residentRunner.residentDevtoolsHandler as NoOpDevtoolsHandler).wasShutdown, true);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
testUsingContext('HotRunner sets asset directory when first evict assets', () => testbed.run(() async {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
setAssetBundlePath,
|
|
|
|
|
evict,
|
|
|
|
|
]);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
<FlutterDevice>[
|
|
|
|
|
flutterDevice,
|
|
|
|
|
],
|
|
|
|
|
stayResident: false,
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
target: 'main.dart',
|
|
|
|
|
devtoolsHandler: createNoOpHandler,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
(flutterDevice.devFS as FakeDevFS).assetPathsToEvict = <String>{'asset'};
|
|
|
|
|
|
|
|
|
|
expect(flutterDevice.devFS.hasSetAssetDirectory, false);
|
|
|
|
|
await (residentRunner as HotRunner).evictDirtyAssets();
|
|
|
|
|
expect(flutterDevice.devFS.hasSetAssetDirectory, true);
|
|
|
|
|
expect(fakeVmServiceHost.hasRemainingExpectations, false);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
testUsingContext('HotRunner does not sets asset directory when no assets to evict', () => testbed.run(() async {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
]);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
<FlutterDevice>[
|
|
|
|
|
flutterDevice,
|
|
|
|
|
],
|
|
|
|
|
stayResident: false,
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
target: 'main.dart',
|
|
|
|
|
devtoolsHandler: createNoOpHandler,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
expect(flutterDevice.devFS.hasSetAssetDirectory, false);
|
|
|
|
|
await (residentRunner as HotRunner).evictDirtyAssets();
|
|
|
|
|
expect(flutterDevice.devFS.hasSetAssetDirectory, false);
|
|
|
|
|
expect(fakeVmServiceHost.hasRemainingExpectations, false);
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
testUsingContext('HotRunner does not set asset directory if it has been set before', () => testbed.run(() async {
|
|
|
|
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
|
|
|
|
listViews,
|
|
|
|
|
evict,
|
|
|
|
|
]);
|
|
|
|
|
residentRunner = HotRunner(
|
|
|
|
|
<FlutterDevice>[
|
|
|
|
|
flutterDevice,
|
|
|
|
|
],
|
|
|
|
|
stayResident: false,
|
|
|
|
|
debuggingOptions: DebuggingOptions.enabled(BuildInfo.debug),
|
|
|
|
|
target: 'main.dart',
|
|
|
|
|
devtoolsHandler: createNoOpHandler,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
(flutterDevice.devFS as FakeDevFS).assetPathsToEvict = <String>{'asset'};
|
|
|
|
|
flutterDevice.devFS.hasSetAssetDirectory = true;
|
|
|
|
|
|
|
|
|
|
await (residentRunner as HotRunner).evictDirtyAssets();
|
|
|
|
|
expect(flutterDevice.devFS.hasSetAssetDirectory, true);
|
|
|
|
|
expect(fakeVmServiceHost.hasRemainingExpectations, false);
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class FakeDartDevelopmentServiceException implements dds.DartDevelopmentServiceException {
|
|
|
|
|
@@ -2231,6 +2279,9 @@ class FakeDevFS extends Fake implements DevFS {
|
|
|
|
|
|
|
|
|
|
UpdateFSReport nextUpdateReport = UpdateFSReport(success: true);
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
bool hasSetAssetDirectory = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Future<Uri> create() async {
|
|
|
|
|
return Uri();
|
|
|
|
|
|