Skip to content

Commit ca7c95c

Browse files
authored
Check file contents, remove tests that are now invalid (: 'none') (flutter#172788)
Closes flutter#171919. The tests removed are covering cases no longer supported, but we never caught them.
1 parent c087fb3 commit ca7c95c

File tree

1 file changed

+7
-104
lines changed

1 file changed

+7
-104
lines changed

packages/flutter_tools/test/general.shard/plugins_test.dart

Lines changed: 7 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,7 @@ flutter:
12451245
.childFile('GeneratedPluginRegistrant.java');
12461246

12471247
expect(registrantFile, exists);
1248-
expect(registrantFile, isNot(contains('SomePlugin')));
1248+
expect(registrantFile.readAsStringSync(), isNot(contains('SomePlugin')));
12491249
},
12501250
overrides: <Type, Generator>{
12511251
FileSystem: () => fs,
@@ -1278,7 +1278,7 @@ flutter:
12781278
final File registrantFile = iosProject.pluginRegistrantImplementation;
12791279

12801280
expect(registrantFile, exists);
1281-
expect(registrantFile, isNot(contains('SomePlugin')));
1281+
expect(registrantFile.readAsStringSync(), isNot(contains('SomePlugin')));
12821282
},
12831283
overrides: <Type, Generator>{
12841284
FileSystem: () => fs,
@@ -1337,44 +1337,7 @@ flutter:
13371337
);
13381338

13391339
expect(registrantFile, exists);
1340-
expect(registrantFile, isNot(contains('SomePlugin')));
1341-
},
1342-
overrides: <Type, Generator>{
1343-
FileSystem: () => fs,
1344-
ProcessManager: () => FakeProcessManager.any(),
1345-
Pub: ThrowingPub.new,
1346-
},
1347-
);
1348-
1349-
testUsingContext(
1350-
"pluginClass: none doesn't trigger registrant entry on macOS",
1351-
() async {
1352-
flutterProject.isModule = true;
1353-
// Create a plugin without a pluginClass.
1354-
final Directory pluginDirectory = createFakePlugin(fs);
1355-
pluginDirectory.childFile('pubspec.yaml').writeAsStringSync('''
1356-
flutter:
1357-
plugin:
1358-
platforms:
1359-
macos:
1360-
pluginClass: none
1361-
dartPluginClass: SomePlugin
1362-
''');
1363-
final dependencyManagement = FakeDarwinDependencyManagement();
1364-
await injectPlugins(
1365-
flutterProject,
1366-
releaseMode: false,
1367-
macOSPlatform: true,
1368-
darwinDependencyManagement: dependencyManagement,
1369-
);
1370-
1371-
final File registrantFile = macosProject.managedDirectory.childFile(
1372-
'GeneratedPluginRegistrant.swift',
1373-
);
1374-
1375-
expect(registrantFile, exists);
1376-
expect(registrantFile, isNot(contains('SomePlugin')));
1377-
expect(registrantFile, isNot(contains('none')));
1340+
expect(registrantFile.readAsStringSync(), isNot(contains('SomePlugin')));
13781341
},
13791342
overrides: <Type, Generator>{
13801343
FileSystem: () => fs,
@@ -1593,39 +1556,10 @@ flutter:
15931556
);
15941557

15951558
expect(registrantImpl, exists);
1596-
expect(registrantImpl, isNot(contains('SomePlugin')));
1597-
expect(registrantImpl, isNot(contains('some_plugin')));
1598-
},
1599-
overrides: <Type, Generator>{
1600-
FileSystem: () => fs,
1601-
ProcessManager: () => FakeProcessManager.any(),
1602-
Pub: ThrowingPub.new,
1603-
},
1604-
);
1605-
1606-
testUsingContext(
1607-
"pluginClass: none doesn't trigger registrant entry on Linux",
1608-
() async {
1609-
// Create a plugin without a pluginClass.
1610-
final Directory pluginDirectory = createFakePlugin(fs);
1611-
pluginDirectory.childFile('pubspec.yaml').writeAsStringSync('''
1612-
flutter:
1613-
plugin:
1614-
platforms:
1615-
linux:
1616-
pluginClass: none
1617-
dartPluginClass: SomePlugin
1618-
''');
1619-
1620-
await injectPlugins(flutterProject, releaseMode: false, linuxPlatform: true);
16211559

1622-
final File registrantImpl = linuxProject.managedDirectory.childFile(
1623-
'generated_plugin_registrant.cc',
1624-
);
1625-
1626-
expect(registrantImpl, exists);
1627-
expect(registrantImpl, isNot(contains('SomePlugin')));
1628-
expect(registrantImpl, isNot(contains('none')));
1560+
final String contents = registrantImpl.readAsStringSync();
1561+
expect(contents, isNot(contains('SomePlugin')));
1562+
expect(contents, isNot(contains('some_plugin')));
16291563
},
16301564
overrides: <Type, Generator>{
16311565
FileSystem: () => fs,
@@ -1741,38 +1675,7 @@ flutter:
17411675
);
17421676

17431677
expect(registrantImpl, exists);
1744-
expect(registrantImpl, isNot(contains('SomePlugin')));
1745-
},
1746-
overrides: <Type, Generator>{
1747-
FileSystem: () => fs,
1748-
ProcessManager: () => FakeProcessManager.any(),
1749-
Pub: ThrowingPub.new,
1750-
},
1751-
);
1752-
1753-
testUsingContext(
1754-
"pluginClass: none doesn't trigger registrant entry on Windows",
1755-
() async {
1756-
// Create a plugin without a pluginClass.
1757-
final Directory pluginDirectory = createFakePlugin(fs);
1758-
pluginDirectory.childFile('pubspec.yaml').writeAsStringSync('''
1759-
flutter:
1760-
plugin:
1761-
platforms:
1762-
windows:
1763-
pluginClass: none
1764-
dartPluginClass: SomePlugin
1765-
''');
1766-
1767-
await injectPlugins(flutterProject, releaseMode: false, windowsPlatform: true);
1768-
1769-
final File registrantImpl = windowsProject.managedDirectory.childFile(
1770-
'generated_plugin_registrant.cc',
1771-
);
1772-
1773-
expect(registrantImpl, exists);
1774-
expect(registrantImpl, isNot(contains('SomePlugin')));
1775-
expect(registrantImpl, isNot(contains('none')));
1678+
expect(registrantImpl.readAsStringSync(), isNot(contains('SomePlugin')));
17761679
},
17771680
overrides: <Type, Generator>{
17781681
FileSystem: () => fs,

0 commit comments

Comments
 (0)