def test_default_channel(self): comm.setUp() os.chdir(comm.XwalkPath) comm.clear("org.xwalk.test") os.mkdir("org.xwalk.test") os.chdir('org.xwalk.test') output = self.invokeCrosswalkPkg([ '--platforms=android', '--android=' + comm.ANDROID_MODE, '--targets=' + comm.BIT, comm.ConstPath + '/../testapp/create_package_basic/', ]) version = comm.check_crosswalk_version(self, "stable") apks = os.listdir(os.getcwd()) apkLength = 0 if comm.MODE != " --android-shared": for i in range(len(apks)): if apks[i].endswith(".apk") and "x86" in apks[i]: if comm.BIT == "64": self.assertIn("64", apks[i]) apkLength = apkLength + 1 if apks[i].endswith(".apk") and "arm" in apks[i]: if comm.BIT == "64": self.assertIn("64", apks[i]) apkLength = apkLength + 1 self.assertEquals(apkLength, 2) else: for i in range(len(apks)): if apks[i].endswith(".apk") and "shared" in apks[i]: apkLength = apkLength + 1 appVersion = apks[i].split('-')[1] self.assertEquals(apkLength, 1) comm.run(self) comm.clear("org.xwalk.test") self.assertIn(version, output)
def test_create_package_canary(self): comm.setUp() os.chdir(comm.XwalkPath) comm.clear("org.xwalk.test") os.mkdir("org.xwalk.test") os.chdir('org.xwalk.test') cmd = comm.HOST_PREFIX + comm.PackTools + \ "crosswalk-pkg --platforms=android --android=" + comm.ANDROID_MODE + ' --crosswalk=canary --targets="' + comm.BIT + '" ' + comm.ConstPath + "/../testapp/create_package_basic/" (return_code, output) = comm.getstatusoutput(cmd) version = comm.check_crosswalk_version(self, "canary") apks = os.listdir(os.getcwd()) apkLength = 0 if comm.MODE != " --android-shared": for i in range(len(apks)): if apks[i].endswith(".apk") and "x86" in apks[i]: if comm.BIT == "64": self.assertIn("64", apks[i]) apkLength = apkLength + 1 if apks[i].endswith(".apk") and "arm" in apks[i]: if comm.BIT == "64": self.assertIn("64", apks[i]) apkLength = apkLength + 1 self.assertEquals(apkLength, 2) else: for i in range(len(apks)): if apks[i].endswith(".apk") and "shared" in apks[i]: apkLength = apkLength + 1 appVersion = apks[i].split('-')[1] self.assertEquals(apkLength, 1) comm.run(self) comm.clear("org.xwalk.test") self.assertEquals(return_code, 0) self.assertIn(version, output[0])
def test_crosswalk_canary(self): comm.setUp() os.chdir(comm.XwalkPath) comm.clear("org.xwalk.test") os.mkdir("org.xwalk.test") os.chdir('org.xwalk.test') cmd = comm.HOST_PREFIX + comm.PackTools + \ "crosswalk-pkg --platforms=windows --crosswalk=canary " + comm.ConstPath + "/../testapp/create_package_basic/" (return_code, output) = comm.getstatusoutput(cmd) version = comm.check_crosswalk_version(self, "canary") crosswalk = 'crosswalk-{}.zip'.format(version) apks = os.listdir(os.getcwd()) apkLength = 0 for i in range(len(apks)): if apks[i].endswith(".msi"): apkLength = apkLength + 1 comm.clear("org.xwalk.test") if not comm.cachedir: namelist = os.listdir(os.getcwd()) else: newcachedir = os.environ.get('CROSSWALK_APP_TOOLS_CACHE_DIR') os.chdir(newcachedir) namelist = os.listdir(os.getcwd()) self.assertEquals(return_code, 0) self.assertIn("canary", output[0]) self.assertIn(version, output[0]) self.assertIn(crosswalk, namelist) self.assertEquals(apkLength, 1)
def test_create_package_c(self): comm.setUp() os.chdir(comm.XwalkPath) comm.clear("org.xwalk.test") os.mkdir("org.xwalk.test") os.chdir('org.xwalk.test') cmd = comm.HOST_PREFIX + comm.PackTools + \ "crosswalk-pkg --platforms=windows -c canary " + comm.ConstPath + "/../testapp/create_package_basic/" (return_code, output) = comm.getstatusoutput(cmd) version = comm.check_crosswalk_version(self, "canary") crosswalk = 'crosswalk-{}.zip'.format(version) crosswalk64 = 'crosswalk64-{}.zip'.format(version) apks = os.listdir(os.getcwd()) apkLength = 0 for i in range(len(apks)): if apks[i].endswith(".msi"): apkLength = apkLength + 1 if not comm.cachedir: namelist = os.listdir(os.getcwd()) else: newcachedir = os.environ.get('CROSSWALK_APP_TOOLS_CACHE_DIR') os.chdir(newcachedir) namelist = os.listdir(os.getcwd()) crosswalkexist = 1 if crosswalk not in namelist and crosswalk64 not in namelist: crosswalkexist = 0 comm.clear("org.xwalk.test") self.assertEquals(return_code, 0) self.assertIn("canary", output[0]) self.assertIn(version, output[0]) self.assertEquals(crosswalkexist, 1) self.assertEquals(apkLength, 1)
def test_normal_with_downloadCrosswalk(self): comm.setUp() comm.clear("org.xwalk.test") os.chdir(comm.XwalkPath) createcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app create org.xwalk.test" + comm.MODE + comm.ANDROID_TARGETS (return_code, output) = comm.getstatusoutput(createcmd) version = comm.check_crosswalk_version(self, "stable") comm.clear("org.xwalk.test") self.assertEquals(return_code, 0) self.assertIn(version, output[0])
def test_create_pkg_basic(self): comm.setUp() os.chdir(comm.XwalkPath) comm.clear("org.xwalk.test") os.mkdir("org.xwalk.test") os.chdir("org.xwalk.test") cmd = ( comm.HOST_PREFIX + comm.PackTools + "crosswalk-pkg -p android -a " + comm.ANDROID_MODE + ' -t "' + comm.BIT + '" ' + comm.ConstPath + "/../testapp/create_package_basic/" ) (return_code, output) = comm.getstatusoutput(cmd) version = comm.check_crosswalk_version(self, "stable") apks = os.listdir(os.getcwd()) apkLength = 0 if comm.MODE != " --android-shared": for i in range(len(apks)): if apks[i].endswith(".apk") and "x86" in apks[i]: if comm.BIT == "64": self.assertIn("64", apks[i]) apkLength = apkLength + 1 if apks[i].endswith(".apk") and "arm" in apks[i]: if comm.BIT == "64": self.assertIn("64", apks[i]) apkLength = apkLength + 1 self.assertEquals(apkLength, 2) else: for i in range(len(apks)): if apks[i].endswith(".apk") and "shared" in apks[i]: apkLength = apkLength + 1 appVersion = apks[i].split("-")[1] self.assertEquals(apkLength, 1) comm.run(self) comm.clear("org.xwalk.test") self.assertEquals(return_code, 0) self.assertIn("Loading 'android' platform backend", output[0]) self.assertNotIn("candle", output[0]) self.assertNotIn("light", output[0]) self.assertIn(version, output[0])
def test_create_x8632(self): comm.setUp() os.chdir(comm.XwalkPath) comm.clear("org.xwalk.test") cmd = comm.HOST_PREFIX + comm.PackTools + \ "crosswalk-app create org.xwalk.test" + comm.MODE + " --android-crosswalk=canary --android-targets=x86" (return_create_code, output) = comm.getstatusoutput(cmd) crosswalkVersion = comm.check_crosswalk_version(self, "canary") self.assertEquals(return_create_code, 0) self.assertIn('crosswalk-{}.zip'.format(crosswalkVersion), output[0]) self.assertNotIn('crosswalk-{}-64bit.zip'.format(crosswalkVersion), output[0]) os.chdir(comm.XwalkPath + 'org.xwalk.test') buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build" return_code = os.system(buildcmd) apks = os.listdir(os.getcwd()) x86Length = 0 x86_64Length = 0 armLength = 0 arm_64Length = 0 apkLength = 0 if comm.MODE != " --android-shared": for i in range(len(apks)): if apks[i].endswith(".apk") and "x86" in apks[i]: if "64" in apks[i]: x86_64Length = x86_64Length + 1 else: x86Length = x86Length + 1 if apks[i].endswith(".apk") and "arm" in apks[i]: if "64" in apks[i]: arm_64Length = arm_64Length + 1 else: armLength = armLength + 1 self.assertEquals(x86_64Length, 0) self.assertEquals(arm_64Length, 0) self.assertEquals(x86Length, 1) self.assertEquals(armLength, 1) else: for i in range(len(apks)): if apks[i].endswith(".apk") and "shared" in apks[i]: apkLength = apkLength + 1 self.assertEquals(apkLength, 1) comm.clear("org.xwalk.test") self.assertEquals(return_code, 0)
def test_create_arm64_x8664(self): comm.setUp() os.chdir(comm.XwalkPath) comm.clear("org.xwalk.test") cmd = comm.HOST_PREFIX + comm.PackTools + \ "crosswalk-app create org.xwalk.test" + comm.MODE + ' --android-crosswalk=canary --android-targets="arm64-v8a x86_64"' (return_create_code, output) = comm.getstatusoutput(cmd) crosswalkVersion = comm.check_crosswalk_version(self, "canary") self.assertEquals(return_create_code, 0) self.assertNotIn('crosswalk-{}.zip'.format(crosswalkVersion), output[0]) self.assertIn('crosswalk-{}-64bit.zip'.format(crosswalkVersion), output[0]) os.chdir(comm.XwalkPath + 'org.xwalk.test') buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build" return_code = os.system(buildcmd) apks = os.listdir(os.getcwd()) if comm.MODE != " --android-shared": for i in range(len(apks)): if apks[i].endswith(".apk") and "x86" in apks[i]: if "64" in apks[i]: x86_64Length = x86_64Length + 1 else: x86Length = x86Length + 1 if apks[i].endswith(".apk") and "arm" in apks[i]: if "64" in apks[i]: arm_64Length = arm_64Length + 1 else: armLength = armLength + 1 self.assertEquals(x86_64Length, 1) self.assertEquals(arm_64Length, 1) self.assertEquals(x86Length, 0) self.assertEquals(armLength, 0) else: for i in range(len(apks)): if apks[i].endswith(".apk") and "shared" in apks[i]: apkLength = apkLength + 1 self.assertEquals(apkLength, 1) comm.clear("org.xwalk.test") self.assertEquals(return_code, 0)