Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2cd768b8
Unverified
Commit
2cd768b8
authored
Apr 14, 2023
by
Andrew Kolos
Committed by
GitHub
Apr 14, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Reorganize android_studio_test.dart (#124834)
[flutter_tools] Reorganize android_studio_test.dart
parent
fd7d2d27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
262 additions
and
264 deletions
+262
-264
android_studio_test.dart
...tools/test/general.shard/android/android_studio_test.dart
+262
-264
No files found.
packages/flutter_tools/test/general.shard/android/android_studio_test.dart
View file @
2cd768b8
...
...
@@ -15,10 +15,12 @@ import '../../src/common.dart';
import
'../../src/context.dart'
;
import
'../../src/fake_process_manager.dart'
;
const
String
homeLinux
=
'/home/me'
;
const
String
homeMac
=
'/Users/me'
;
void
main
(
)
{
group
(
'installation detection on MacOS'
,
()
{
const
String
homeMac
=
'/Users/me'
;
const
Map
<
String
,
Object
>
macStudioInfoPlist
=
<
String
,
Object
>{
const
Map
<
String
,
Object
>
macStudioInfoPlist3_3
=
<
String
,
Object
>{
'CFBundleGetInfoString'
:
'Android Studio 3.3, build AI-182.5107.16.33.5199772. Copyright JetBrains s.r.o., (c) 2000-2018'
,
'CFBundleShortVersionString'
:
'3.3'
,
'CFBundleVersion'
:
'AI-182.5107.16.33.5199772'
,
...
...
@@ -28,9 +30,9 @@ const Map<String, Object> macStudioInfoPlist = <String, Object>{
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
};
const
Map
<
String
,
Object
>
macStudioInfoPlist4_1
=
<
String
,
Object
>{
const
Map
<
String
,
Object
>
macStudioInfoPlist4_1
=
<
String
,
Object
>{
'CFBundleGetInfoString'
:
'Android Studio 4.1, build AI-201.8743.12.41.6858069. Copyright JetBrains s.r.o., (c) 2000-2020'
,
'CFBundleShortVersionString'
:
'4.1'
,
'CFBundleVersion'
:
'AI-201.8743.12.41.6858069'
,
...
...
@@ -41,9 +43,9 @@ const Map<String, Object> macStudioInfoPlist4_1 = <String, Object>{
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
};
const
Map
<
String
,
Object
>
macStudioInfoPlist2020_3
=
<
String
,
Object
>{
const
Map
<
String
,
Object
>
macStudioInfoPlist2020_3
=
<
String
,
Object
>{
'CFBundleGetInfoString'
:
'Android Studio 2020.3, build AI-203.7717.56.2031.7583922. Copyright JetBrains s.r.o., (c) 2000-2021'
,
'CFBundleShortVersionString'
:
'2020.3'
,
'CFBundleVersion'
:
'AI-203.7717.56.2031.7583922'
,
...
...
@@ -54,9 +56,9 @@ const Map<String, Object> macStudioInfoPlist2020_3 = <String, Object>{
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
};
const
Map
<
String
,
Object
>
macStudioInfoPlist2022_1
=
<
String
,
Object
>{
const
Map
<
String
,
Object
>
macStudioInfoPlist2022_1
=
<
String
,
Object
>{
'CFBundleGetInfoString'
:
'Android Studio 2022.1, build AI-221.6008.13.2211.9477386. Copyright JetBrains s.r.o., (c) 2000-2023'
,
'CFBundleShortVersionString'
:
'2022.1'
,
'CFBundleVersion'
:
'AI-221.6008.13.2211.9477386'
,
...
...
@@ -67,9 +69,9 @@ const Map<String, Object> macStudioInfoPlist2022_1 = <String, Object>{
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
};
const
Map
<
String
,
Object
>
macStudioInfoPlistEAP
=
<
String
,
Object
>{
const
Map
<
String
,
Object
>
macStudioInfoPlistEAP
=
<
String
,
Object
>{
'CFBundleGetInfoString'
:
'Android Studio EAP AI-212.5712.43.2112.8233820, build AI-212.5712.43.2112.8233820. Copyright JetBrains s.r.o., (c) 2000-2022'
,
'CFBundleShortVersionString'
:
'EAP AI-212.5712.43.2112.8233820'
,
'CFBundleVersion'
:
'AI-212.5712.43.2112.8233820'
,
...
...
@@ -80,67 +82,21 @@ const Map<String, Object> macStudioInfoPlistEAP = <String, Object>{
'idea.platform.prefix'
:
'AndroidStudio'
,
},
},
};
final
Platform
linuxPlatform
=
FakePlatform
(
environment:
<
String
,
String
>{
'HOME'
:
homeLinux
},
);
final
Platform
windowsPlatform
=
FakePlatform
(
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{
'LOCALAPPDATA'
:
r'C:\Users\Dash\AppData\Local'
,
}
);
Platform
macPlatform
(
)
{
return
FakePlatform
(
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{
'HOME'
:
homeMac
},
);
}
};
void
main
(
)
{
late
FileSystem
fileSystem
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
});
testUsingContext
(
'pluginsPath on Linux extracts custom paths from home dir'
,
()
{
const
String
installPath
=
'/opt/android-studio-with-cheese-5.0'
;
const
String
studioHome
=
'
$homeLinux
/.AndroidStudioWithCheese5.0'
;
const
String
homeFile
=
'
$studioHome
/system/.home'
;
globals
.
fs
.
directory
(
installPath
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
homeFile
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
homeFile
).
writeAsStringSync
(
installPath
);
final
AndroidStudio
studio
=
AndroidStudio
.
fromHomeDot
(
globals
.
fs
.
directory
(
studioHome
))!;
expect
(
studio
,
isNotNull
);
expect
(
studio
.
pluginsPath
,
equals
(
'/home/me/.AndroidStudioWithCheese5.0/config/plugins'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
// Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here.
Platform:
()
=>
linuxPlatform
,
FileSystemUtils:
()
=>
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
linuxPlatform
,
),
});
group
(
'pluginsPath on Mac'
,
()
{
late
FileSystemUtils
fsUtils
;
late
Platform
platform
;
late
FakePlistUtils
plistUtils
;
late
FakeProcessManager
processManager
;
setUp
(()
{
fileSystem
=
MemoryFileSystem
.
test
();
plistUtils
=
FakePlistUtils
();
platform
=
macPlatform
();
platform
=
FakePlatform
(
operatingSystem:
'macos'
,
environment:
<
String
,
String
>{
'HOME'
:
homeMac
},
);
fsUtils
=
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
platform
,
...
...
@@ -148,7 +104,7 @@ void main() {
processManager
=
FakeProcessManager
.
empty
();
});
testUsingContext
(
'
Can discover Android Studio >=4.1 location on Mac
'
,
()
{
testUsingContext
(
'
discovers Android Studio >=4.1 location
'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
...
...
@@ -190,7 +146,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'
Can discover Android Studio >=2020.3 location on Mac
'
,
()
{
testUsingContext
(
'
discovers Android Studio >=2020.3 location
'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
...
...
@@ -232,7 +188,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'
Can discover Android Studio <4.1 location on Mac
'
,
()
{
testUsingContext
(
'
discovers Android Studio <4.1 location
'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
...
...
@@ -242,7 +198,7 @@ void main() {
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
).
createSync
(
recursive:
true
);
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist
;
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist
3_3
;
processManager
.
addCommand
(
FakeCommand
(
command:
<
String
>[
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'jre'
,
'jdk'
,
'Contents'
,
'Home'
,
'bin'
,
'java'
),
...
...
@@ -273,7 +229,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'
Can discover Android Studio EAP location on Mac
'
,
()
{
testUsingContext
(
'
discovers Android Studio EAP location
'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
...
...
@@ -314,7 +270,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'
D
oes not discover Android Studio with JetBrainsToolboxApp wrapper'
,
()
{
testUsingContext
(
'
d
oes not discover Android Studio with JetBrainsToolboxApp wrapper'
,
()
{
final
String
applicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Applications'
,
...
...
@@ -351,7 +307,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'
Can discover
installation from Spotlight query'
,
()
{
testUsingContext
(
'
discovers
installation from Spotlight query'
,
()
{
// One in expected location.
final
String
studioInApplication
=
fileSystem
.
path
.
join
(
'/'
,
...
...
@@ -446,7 +402,7 @@ void main() {
globals
.
fs
.
directory
(
applicationPlistFolder
).
createSync
(
recursive:
true
);
final
String
applicationsPlistFilePath
=
globals
.
fs
.
path
.
join
(
applicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
applicationsPlistFilePath
]
=
macStudioInfoPlist
;
plistUtils
.
fileContents
[
applicationsPlistFilePath
]
=
macStudioInfoPlist
3_3
;
final
String
homeDirectoryPlistFolder
=
globals
.
fs
.
path
.
join
(
globals
.
fsUtils
.
homeDirPath
!,
...
...
@@ -469,7 +425,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'extracts custom paths for directly downloaded Android Studio
on Mac
'
,
()
{
testUsingContext
(
'extracts custom paths for directly downloaded Android Studio'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
...
...
@@ -479,7 +435,7 @@ void main() {
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
).
createSync
(
recursive:
true
);
final
String
plistFilePath
=
globals
.
fs
.
path
.
join
(
studioInApplicationPlistFolder
,
'Info.plist'
);
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist
;
plistUtils
.
fileContents
[
plistFilePath
]
=
macStudioInfoPlist
3_3
;
final
AndroidStudio
studio
=
AndroidStudio
.
fromMacOSBundle
(
globals
.
fs
.
directory
(
studioInApplicationPlistFolder
).
parent
.
path
,
)!;
...
...
@@ -500,7 +456,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'
Can find Android Studio 2020.3 bundled Java version on Mac
'
,
()
{
testUsingContext
(
'
finds Android Studio 2020.3 bundled Java version
'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
...
...
@@ -539,7 +495,7 @@ void main() {
PlistParser:
()
=>
plistUtils
,
});
testUsingContext
(
'
Can find Android Studio 2022.1 bundled Java version on Mac
'
,
()
{
testUsingContext
(
'
finds Android Studio 2022.1 bundled Java version
'
,
()
{
final
String
studioInApplicationPlistFolder
=
globals
.
fs
.
path
.
join
(
'/'
,
'Application'
,
...
...
@@ -579,17 +535,25 @@ void main() {
});
});
late
FileSystem
windowsFileSystem
;
group
(
'installation detection on Windows'
,
()
{
late
Platform
platform
;
late
FileSystem
fileSystem
;
setUp
(()
{
windowsFileSystem
=
MemoryFileSystem
.
test
(
style:
FileSystemStyle
.
windows
);
platform
=
FakePlatform
(
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{
'LOCALAPPDATA'
:
r'C:\Users\Dash\AppData\Local'
,
}
);
fileSystem
=
MemoryFileSystem
.
test
(
style:
FileSystemStyle
.
windows
);
});
testUsingContext
(
'Can discover Android Studio 4.1 location on Windows
'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home'
)
testUsingContext
(
'discovers Android Studio 4.1 location
'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
...
...
@@ -597,16 +561,16 @@ void main() {
expect
(
studio
.
version
,
Version
(
4
,
1
,
0
));
expect
(
studio
.
studioAppName
,
'Android Studio'
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsP
latform
,
FileSystem:
()
=>
windowsF
ileSystem
,
Platform:
()
=>
p
latform
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Can discover Android Studio 4.2 location on Windows
'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home'
)
testUsingContext
(
'discovers Android Studio 4.2 location
'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
...
...
@@ -614,16 +578,16 @@ void main() {
expect
(
studio
.
version
,
Version
(
4
,
2
,
0
));
expect
(
studio
.
studioAppName
,
'Android Studio'
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsP
latform
,
FileSystem:
()
=>
windowsF
ileSystem
,
Platform:
()
=>
p
latform
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Can discover Android Studio 2020.3 location on Windows
'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home'
)
testUsingContext
(
'discovers Android Studio 2020.3 location
'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
...
...
@@ -631,16 +595,16 @@ void main() {
expect
(
studio
.
version
,
Version
(
2020
,
3
,
0
));
expect
(
studio
.
studioAppName
,
'Android Studio'
);
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsP
latform
,
FileSystem:
()
=>
windowsF
ileSystem
,
Platform:
()
=>
p
latform
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not discover Android Studio 4.1 location on Windows
if LOCALAPPDATA is null'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home'
)
testUsingContext
(
'does not discover Android Studio 4.1 location
if LOCALAPPDATA is null'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
expect
(
AndroidStudio
.
allInstalled
(),
isEmpty
);
...
...
@@ -649,15 +613,15 @@ void main() {
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{},
// Does not include LOCALAPPDATA
),
FileSystem:
()
=>
windowsF
ileSystem
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not discover Android Studio 4.2 location on Windows
if LOCALAPPDATA is null'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home'
)
testUsingContext
(
'does not discover Android Studio 4.2 location
if LOCALAPPDATA is null'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.2\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
expect
(
AndroidStudio
.
allInstalled
(),
isEmpty
);
...
...
@@ -666,15 +630,15 @@ void main() {
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{},
// Does not include LOCALAPPDATA
),
FileSystem:
()
=>
windowsF
ileSystem
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Does not discover Android Studio 2020.3 location on Windows
if LOCALAPPDATA is null'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home'
)
testUsingContext
(
'does not discover Android Studio 2020.3 location
if LOCALAPPDATA is null'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
expect
(
AndroidStudio
.
allInstalled
(),
isEmpty
);
...
...
@@ -683,53 +647,62 @@ void main() {
operatingSystem:
'windows'
,
environment:
<
String
,
String
>{},
// Does not include LOCALAPPDATA
),
FileSystem:
()
=>
windowsF
ileSystem
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Can find Android Studio 2020.3 bundled Java version on Windows
'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home'
)
testUsingContext
(
'finds Android Studio 2020.3 bundled Java version
'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2020.3\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
expect
(
studio
.
javaPath
,
equals
(
r'C:\Program Files\AndroidStudio\jre'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsP
latform
,
FileSystem:
()
=>
windowsF
ileSystem
,
Platform:
()
=>
p
latform
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'Can find Android Studio 2022.1 bundled Java version on Windows
'
,
()
{
windowsF
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2022.1\.home'
)
testUsingContext
(
'finds Android Studio 2022.1 bundled Java version
'
,
()
{
f
ileSystem
.
file
(
r'C:\Users\Dash\AppData\Local\Google\AndroidStudio2022.1\.home'
)
..
createSync
(
recursive:
true
)
..
writeAsStringSync
(
r'C:\Program Files\AndroidStudio'
);
windowsF
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
f
ileSystem
.
directory
(
r'C:\Program Files\AndroidStudio'
)
.
createSync
(
recursive:
true
);
final
AndroidStudio
studio
=
AndroidStudio
.
allInstalled
().
single
;
expect
(
studio
.
javaPath
,
equals
(
r'C:\Program Files\AndroidStudio\jbr'
));
},
overrides:
<
Type
,
Generator
>{
Platform:
()
=>
windowsP
latform
,
FileSystem:
()
=>
windowsF
ileSystem
,
Platform:
()
=>
p
latform
,
FileSystem:
()
=>
f
ileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
});
group
(
'Installation detection on Linux'
,
()
{
group
(
'installation detection on Linux'
,
()
{
const
String
homeLinux
=
'/home/me'
;
late
FileSystem
fileSystem
;
late
FileSystemUtils
fsUtils
;
late
Platform
platform
;
setUp
(()
{
platform
=
FakePlatform
(
environment:
<
String
,
String
>{
'HOME'
:
homeLinux
},
);
fileSystem
=
MemoryFileSystem
.
test
();
fsUtils
=
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
linuxP
latform
,
platform:
p
latform
,
);
});
testUsingContext
(
'
Discover
Android Studio <4.1'
,
()
{
testUsingContext
(
'
discovers
Android Studio <4.1'
,
()
{
const
String
studioHomeFilePath
=
'
$homeLinux
/.AndroidStudio4.0/system/.home'
;
const
String
studioInstallPath
=
'
$homeLinux
/AndroidStudio'
;
...
...
@@ -751,11 +724,11 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
Platform:
()
=>
linuxP
latform
,
Platform:
()
=>
p
latform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'
Discover
Android Studio >=4.1'
,
()
{
testUsingContext
(
'
discovers
Android Studio >=4.1'
,
()
{
const
String
studioHomeFilePath
=
'
$homeLinux
/.cache/Google/AndroidStudio4.1/.home'
;
const
String
studioInstallPath
=
'
$homeLinux
/AndroidStudio'
;
...
...
@@ -777,11 +750,11 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
Platform:
()
=>
linuxP
latform
,
Platform:
()
=>
p
latform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'
Discover
when installed with Toolbox'
,
()
{
testUsingContext
(
'
discovers
when installed with Toolbox'
,
()
{
const
String
studioHomeFilePath
=
'
$homeLinux
/.cache/Google/AndroidStudio4.1/.home'
;
const
String
studioInstallPath
=
...
...
@@ -806,11 +779,11 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
Platform:
()
=>
linuxP
latform
,
Platform:
()
=>
p
latform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'
Can find Android Studio 2020.3 bundled Java version on Linux
'
,
()
{
testUsingContext
(
'
finds Android Studio 2020.3 bundled Java version
'
,
()
{
const
String
studioHomeFilePath
=
'
$homeLinux
/.cache/Google/AndroidStudio2020.3/.home'
;
const
String
studioInstallPath
=
'
$homeLinux
/AndroidStudio'
;
...
...
@@ -826,11 +799,11 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
Platform:
()
=>
linuxP
latform
,
Platform:
()
=>
p
latform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'
Can find Android Studio 2022.1 bundled Java version on Linux
'
,
()
{
testUsingContext
(
'
finds Android Studio 2022.1 bundled Java version
'
,
()
{
const
String
studioHomeFilePath
=
'
$homeLinux
/.cache/Google/AndroidStudio2022.1/.home'
;
const
String
studioInstallPath
=
'
$homeLinux
/AndroidStudio'
;
...
...
@@ -847,9 +820,34 @@ void main() {
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
FileSystemUtils:
()
=>
fsUtils
,
Platform:
()
=>
linuxP
latform
,
Platform:
()
=>
p
latform
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
});
testUsingContext
(
'pluginsPath extracts custom paths from home dir'
,
()
{
const
String
installPath
=
'/opt/android-studio-with-cheese-5.0'
;
const
String
studioHome
=
'
$homeLinux
/.AndroidStudioWithCheese5.0'
;
const
String
homeFile
=
'
$studioHome
/system/.home'
;
globals
.
fs
.
directory
(
installPath
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
homeFile
).
createSync
(
recursive:
true
);
globals
.
fs
.
file
(
homeFile
).
writeAsStringSync
(
installPath
);
final
AndroidStudio
studio
=
AndroidStudio
.
fromHomeDot
(
globals
.
fs
.
directory
(
studioHome
))!;
expect
(
studio
,
isNotNull
);
expect
(
studio
.
pluginsPath
,
equals
(
'/home/me/.AndroidStudioWithCheese5.0/config/plugins'
));
},
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fileSystem
,
ProcessManager:
()
=>
FakeProcessManager
.
any
(),
// Custom home paths are not supported on macOS nor Windows yet,
// so we force the platform to fake Linux here.
Platform:
()
=>
platform
,
FileSystemUtils:
()
=>
FileSystemUtils
(
fileSystem:
fileSystem
,
platform:
platform
,
),
});
});
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment