@@ -851,7 +851,8 @@ describe('utils/adb', () => {
851
851
sinon . assert . calledWithMatch (
852
852
adb . fakeADBClient . startActivity , 'device1' , {
853
853
action : 'android.activity.MAIN' ,
854
- component : 'org.mozilla.geckoview_example/.GeckoViewActivity' ,
854
+ component : 'org.mozilla.geckoview_example' +
855
+ '/org.mozilla.geckoview_example.GeckoViewActivity' ,
855
856
extras : [ {
856
857
key : 'args' ,
857
858
value : '-profile /fake/custom/profile/path' ,
@@ -895,6 +896,147 @@ describe('utils/adb', () => {
895
896
}
896
897
) ;
897
898
} ) ;
899
+
900
+ it ( 'starts a given APK component on fenix.nightly' , async ( ) => {
901
+ const adb = getFakeADBKit ( {
902
+ adbClient : {
903
+ startActivity : sinon . spy ( ( ) => Promise . resolve ( ) ) ,
904
+ } ,
905
+ adbkitUtil : {
906
+ readAll : sinon . spy ( ( ) => Promise . resolve ( Buffer . from ( '\n' ) ) ) ,
907
+ } ,
908
+ } ) ;
909
+ const adbUtils = new ADBUtils ( { adb} ) ;
910
+
911
+ const promise = adbUtils . startFirefoxAPK (
912
+ 'device1' ,
913
+ 'org.mozilla.fenix.nightly' ,
914
+ 'HomeActivity' , // firefoxApkComponent
915
+ '/fake/custom/profile/path' ,
916
+ ) ;
917
+
918
+ await assert . isFulfilled ( promise ) ;
919
+
920
+ sinon . assert . calledOnce ( adb . fakeADBClient . startActivity ) ;
921
+ sinon . assert . calledWithMatch (
922
+ adb . fakeADBClient . startActivity , 'device1' , {
923
+ action : 'android.activity.MAIN' ,
924
+ component : 'org.mozilla.fenix.nightly/' +
925
+ 'org.mozilla.fenix.HomeActivity' ,
926
+ extras : [ {
927
+ key : 'args' ,
928
+ value : '-profile /fake/custom/profile/path' ,
929
+ } ] ,
930
+ wait : true ,
931
+ }
932
+ ) ;
933
+ } ) ;
934
+
935
+ it ( 'starts without specifying an APK component' , async ( ) => {
936
+ const adb = getFakeADBKit ( {
937
+ adbClient : {
938
+ startActivity : sinon . spy ( ( ) => Promise . resolve ( ) ) ,
939
+ } ,
940
+ adbkitUtil : {
941
+ readAll : sinon . spy ( ( ) => Promise . resolve ( Buffer . from ( '\n' ) ) ) ,
942
+ } ,
943
+ } ) ;
944
+ const adbUtils = new ADBUtils ( { adb} ) ;
945
+
946
+ const promise = adbUtils . startFirefoxAPK (
947
+ 'device1' ,
948
+ 'org.mozilla.geckoview_example' ,
949
+ undefined , // firefoxApkComponent
950
+ '/fake/custom/profile/path' ,
951
+ ) ;
952
+
953
+ await assert . isFulfilled ( promise ) ;
954
+
955
+ sinon . assert . calledOnce ( adb . fakeADBClient . startActivity ) ;
956
+ sinon . assert . calledWithMatch (
957
+ adb . fakeADBClient . startActivity , 'device1' , {
958
+ action : 'android.activity.MAIN' ,
959
+ component : 'org.mozilla.geckoview_example/' +
960
+ 'org.mozilla.geckoview_example.App' ,
961
+ extras : [ {
962
+ key : 'args' ,
963
+ value : '-profile /fake/custom/profile/path' ,
964
+ } ] ,
965
+ wait : true ,
966
+ }
967
+ ) ;
968
+ } ) ;
969
+
970
+ it ( 'starts a fully-qualified APK component on the build-variant: ' +
971
+ 'fenix.nightly' , async ( ) => {
972
+ const adb = getFakeADBKit ( {
973
+ adbClient : {
974
+ startActivity : sinon . spy ( ( ) => Promise . resolve ( ) ) ,
975
+ } ,
976
+ adbkitUtil : {
977
+ readAll : sinon . spy ( ( ) => Promise . resolve ( Buffer . from ( '\n' ) ) ) ,
978
+ } ,
979
+ } ) ;
980
+ const adbUtils = new ADBUtils ( { adb} ) ;
981
+
982
+ const promise = adbUtils . startFirefoxAPK (
983
+ 'device1' ,
984
+ 'org.mozilla.fenix.nightly' ,
985
+ 'org.mozilla.fenix.HomeActivity' , // firefoxApkComponent
986
+ '/fake/custom/profile/path' ,
987
+ ) ;
988
+
989
+ await assert . isFulfilled ( promise ) ;
990
+
991
+ sinon . assert . calledOnce ( adb . fakeADBClient . startActivity ) ;
992
+ sinon . assert . calledWithMatch (
993
+ adb . fakeADBClient . startActivity , 'device1' , {
994
+ action : 'android.activity.MAIN' ,
995
+ component : 'org.mozilla.fenix.nightly/' +
996
+ 'org.mozilla.fenix.HomeActivity' ,
997
+ extras : [ {
998
+ key : 'args' ,
999
+ value : '-profile /fake/custom/profile/path' ,
1000
+ } ] ,
1001
+ wait : true ,
1002
+ }
1003
+ ) ;
1004
+ } ) ;
1005
+
1006
+ it ( 'starts a given APK component that begins with a period' , async ( ) => {
1007
+ const adb = getFakeADBKit ( {
1008
+ adbClient : {
1009
+ startActivity : sinon . spy ( ( ) => Promise . resolve ( ) ) ,
1010
+ } ,
1011
+ adbkitUtil : {
1012
+ readAll : sinon . spy ( ( ) => Promise . resolve ( Buffer . from ( '\n' ) ) ) ,
1013
+ } ,
1014
+ } ) ;
1015
+ const adbUtils = new ADBUtils ( { adb} ) ;
1016
+
1017
+ const promise = adbUtils . startFirefoxAPK (
1018
+ 'device1' ,
1019
+ 'org.mozilla.fenix.nightly' ,
1020
+ '.HomeActivity' , // firefoxApkComponent
1021
+ '/fake/custom/profile/path' ,
1022
+ ) ;
1023
+
1024
+ await assert . isFulfilled ( promise ) ;
1025
+
1026
+ sinon . assert . calledOnce ( adb . fakeADBClient . startActivity ) ;
1027
+ sinon . assert . calledWithMatch (
1028
+ adb . fakeADBClient . startActivity , 'device1' , {
1029
+ action : 'android.activity.MAIN' ,
1030
+ component : 'org.mozilla.fenix.nightly/' +
1031
+ 'org.mozilla.fenix.HomeActivity' ,
1032
+ extras : [ {
1033
+ key : 'args' ,
1034
+ value : '-profile /fake/custom/profile/path' ,
1035
+ } ] ,
1036
+ wait : true ,
1037
+ }
1038
+ ) ;
1039
+ } ) ;
898
1040
} ) ;
899
1041
900
1042
describe ( 'discoverRDPUnixSocket' , ( ) => {
0 commit comments