Example #1
0
 def test_update_version(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     updatecmd =  comm.PackTools + "crosswalk-app update 13.42.319.7"
     comm.update(self, updatecmd)
     comm.clear("org.xwalk.test")
 def test_init_manifest_packageid(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     cmd = (
         comm.HOST_PREFIX
         + comm.PackTools
         + "crosswalk-app manifest "
         + comm.XwalkPath
         + "org.xwalk.test --platforms=android --package-id=org.xwalk.test"
     )
     os.system(cmd)
     with open(comm.ConstPath + "/../tools/org.xwalk.test/manifest.json") as json_file:
         data = json.load(json_file)
     updatecmd = (
         comm.HOST_PREFIX
         + comm.PackTools
         + "crosswalk-app manifest "
         + comm.XwalkPath
         + "org.xwalk.test --platforms=android --package-id=org.test.foo"
     )
     os.system(updatecmd)
     with open(comm.ConstPath + "/../tools/org.xwalk.test/manifest.json") as json_file_update:
         updatedata = json.load(json_file_update)
     comm.clear("org.xwalk.test")
     self.assertEquals(data["xwalk_package_id"].strip(os.linesep), "org.xwalk.test")
     self.assertEquals(updatedata["xwalk_package_id"].strip(os.linesep), "org.test.foo")
 def test_without_platforms(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 ../../testapp/create_package_basic/"
     (return_code, output) = comm.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     msiLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".apk") and "x86" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".apk") and "arm" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".msi"):
             msiLength = msiLength + 1
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
     self.assertEquals(apkLength, 2)
     self.assertEquals(msiLength, 0)
     self.assertNotIn("Loading 'windows' platform backend", output[0])
     self.assertIn("Loading 'android' platform backend", output[0])
Example #4
0
 def test_build_missing_both_so_file(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     cmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-app create org.xwalk.test --android-crosswalk=" + \
         comm.crosswalkzip
     os.system(cmd)
     os.chdir('org.xwalk.test')
     shutil.rmtree(
         os.getcwd() +
         '/prj/android/xwalk_core_library/libs/armeabi-v7a/')
     shutil.rmtree(
         os.getcwd() +
         '/prj/android/xwalk_core_library/libs/x86/')
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     pkgs = os.listdir(os.getcwd())
     armLength = 0
     x86Length = 0
     for i in range(len(pkgs)):
         if pkgs[i].endswith(".apk") and "x86" in pkgs[i]:
             x86Length = x86Length + 1
         if pkgs[i].endswith(".apk") and "arm" in pkgs[i]:
             armLength = armLength + 1
     comm.clear("org.xwalk.test")
     self.assertEquals(buildstatus, 0)
     self.assertEquals(x86Length, 0)
     self.assertEquals(armLength, 0)
 def test_crosswalk_release(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=" + comm.crosswalkzip + " " + comm.ConstPath + "/../testapp/create_package_basic/"
     return_code = os.system(cmd)
     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)
 def test_update_app_version_twodot(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_app_version"] = "0.0.1"
     json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
     with open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json") as json_file:
         data = json.load(json_file)
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     buildstatus = os.popen(buildcmd).readlines()
     index = 0
     for x in range(len(buildstatus),0,-1):
         index = x -1
         if buildstatus[index].find("Using android:versionCode") != -1:
             break
     versionCode = buildstatus[index].strip(" *\nUsing android:versionCode")[1:-1]
     root = ElementTree.parse(comm.ConstPath + "/../tools/org.xwalk.test/prj/android/AndroidManifest.xml").getroot()
     attributes = root.attrib
     for x in attributes.keys():
         if x.find("versionCode") != -1:
             versionCode_xml = attributes[x]
             break
     comm.clear("org.xwalk.test")
     self.assertEquals(data['xwalk_app_version'].strip(os.linesep), "0.0.1")
     self.assertEquals(versionCode, versionCode_xml)
 def test_normal_with_downloadCrosswalk(self):
     comm.setUp()
     comm.clear("org.xwalk.test")
     os.chdir(comm.XwalkPath)
     createcmd = comm.PackTools + "crosswalk-app create org.xwalk.test"
     packstatus = commands.getstatusoutput(createcmd)
     crosswalklist = urllib2.urlopen(
         'https://download.01.org/crosswalk/releases/crosswalk/android/stable/').read()
     fp = open('test', 'w')
     fp.write(crosswalklist)
     fp.close()
     line = commands.getstatusoutput(
         "cat test|sed -n  '/src\=\"\/icons\/folder.gif\"/=' |sed -n '$p'")[1].strip()
     cmd = "cat test |sed -n '%dp' |awk -F 'href=' '{print $2}' |awk -F '\"|/' '{print $2}'" % int(
         line)
     version = commands.getstatusoutput(cmd)[1]
     if not '.' in version:
         line = commands.getstatusoutput(
             "tac test|sed -n  '/src\=\"\/icons\/folder.gif\"/=' |sed -n '2p'")[1].strip()
         cmd = "tac test |sed -n '%dp' |awk -F 'href=' '{print $2}' |awk -F '\"|/' '{print $2}'" % int(
             line)
         version = commands.getstatusoutput(cmd)[1]
     commands.getstatusoutput("rm -rf test")
     crosswalk = 'crosswalk-{}.zip'.format(version)
     namelist = os.listdir(os.getcwd())
     self.assertIn(crosswalk, namelist)
     comm.clear("org.xwalk.test")
     self.assertEquals(packstatus[0], 0)
 def test_create_with_platform_windows(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     cmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app create org.xwalk.test --platforms=windows"
     packstatus = os.system(cmd)
     comm.clear("org.xwalk.test")
     self.assertEquals(packstatus, 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)
Example #10
0
 def test_check_log(self):
     comm.setUp()
     comm.clear("org.xwalk.test")
     os.chdir(comm.XwalkPath)
     createcmd = comm.PackTools + "crosswalk-app create org.xwalk.test"
     createstatus = commands.getstatusoutput(createcmd)
     create_common = open(
         comm.ConstPath +
         "/../tools/org.xwalk.test/log/common.log",
         'r')
     create_android = open(
         comm.ConstPath +
         "/../tools/org.xwalk.test/log/ios.log",
         'r')
     create_common_log = create_common.read().strip("\n\t")
     create_android_log = create_android.read().strip("\n\t")
     os.chdir('org.xwalk.test')
     buildcmd = comm.PackTools + "crosswalk-app build"
     buildstatus = commands.getstatusoutput(buildcmd)
     build_common = open(
         comm.ConstPath +
         "/../tools/org.xwalk.test/log/common.log",
         'r')
     build_android = open(
         comm.ConstPath +
         "/../tools/org.xwalk.test/log/ios.log",
         'r')
     build_common_log = build_common.read().strip("\n\t")
     build_android_log = build_android.read().strip("\n\t")
     comm.clear("org.xwalk.test")
     self.assertIn(createstatus[1].split('\n')[0], create_common_log)
     self.assertIn("Created package directory", create_android_log)
     self.assertIn(buildstatus[1].split('\n')[0], build_common_log)
     self.assertIn("build", build_android_log)
 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_extensions_without_jsFile(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     os.chdir('org.xwalk.test')
     shutil.copytree(comm.ConstPath + "/../testapp/extension_permission/", comm.XwalkPath + "/org.xwalk.test/extension_permission/")
     os.remove(comm.XwalkPath + "/org.xwalk.test/extension_permission/contactextension/contactextension.js")
     cmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-pkg --platforms=android --android=" + comm.ANDROID_MODE + " --crosswalk=" + comm.crosswalkzip + " " + comm.XwalkPath + "/org.xwalk.test/extension_permission/"
     return_code = os.system(cmd)
     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)
 def test_keep_project(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 + " --keep --crosswalk=" + comm.crosswalkzip + " " + comm.ConstPath + "/../testapp/create_package_basic/"
     (return_code, output) = comm.getstatusoutput(cmd)
     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)
     projectDir = output[0].split(" * " + os.linesep)[-1].split(' ')[-1].strip(os.linesep)
     comm.run(self)
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
     self.assertIn("app", os.listdir(projectDir))
     self.assertIn("prj", os.listdir(projectDir))
 def test_target_a_x(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 + ' --targets="a x" -c canary ' + comm.ConstPath + "/../testapp/create_package_basic/"
     return_code = os.system(cmd)
     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, 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
                 appVersion = apks[i].split('-')[1]
         self.assertEquals(apkLength, 1)
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
 def test_setting_value(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=" + comm.crosswalkzip + " ../../testapp/manifest_xwalk_target_platforms/windows_platform/"
     (return_code, output) = comm.getstatusoutput(cmd)
     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("Loading 'windows' platform backend", output[0])
 def test_create_with_invalid_platform(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     cmd = comm.PackTools + "crosswalk-app create org.xwalk.test --platforms=target"
     packstatus = commands.getstatusoutput(cmd)
     comm.clear("org.xwalk.test")
     self.assertNotEquals(packstatus[0], 0)
 def test_create_package_stable(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 --crosswalk=stable "
         + comm.ConstPath
         + "/../testapp/create_package_missing_icon_startUrl/"
     )
     return_code = os.system(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".apk") and "x86" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".apk") and "arm" in apks[i]:
             apkLength = apkLength + 1
     self.assertEquals(apkLength, 2)
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system("adb start-server")
     self.assertEquals(return_code, 0)
 def test_build_release_provison(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     buildcmd = comm.PackTools + 'crosswalk-app build release --ios-provison "ios"'
     comm.build(self, buildcmd)
     comm.clear("org.xwalk.test")
 def test_file_exist(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     os.chdir("org.xwalk.test")
     shutil.copyfile(
         comm.ConstPath + "/../testapp/manifest_hooks/XWalkExtensionHooks.js",
         comm.ConstPath + "/../testapp/xwalk_echo_extension/extension/echo_extension/XWalkExtensionHooks.js",
     )
     cmd = (
         comm.HOST_PREFIX
         + comm.PackTools
         + "crosswalk-pkg --platforms=windows --crosswalk="
         + comm.XwalkPath
         + comm.windowsCrosswalk
         + " --keep "
         + comm.ConstPath
         + "/../testapp/xwalk_echo_extension/"
     )
     (return_code, output) = comm.getstatusoutput(cmd)
     os.remove(comm.ConstPath + "/../testapp/xwalk_echo_extension/extension/echo_extension/XWalkExtensionHooks.js")
     projectDir = output[0].split(" * " + os.linesep)[-1].split(" ")[-1].strip(os.linesep)
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
     self.assertIn("org.xwalk.test-0.1.0.0.wxs", os.listdir(projectDir))
Example #20
0
 def test_update_canary(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     updatecmd = comm.PackTools + "crosswalk-app update canary"
     currentVersion = comm.update(self, updatecmd)
     crosswalklist = urllib2.urlopen(
         'https://download.01.org/crosswalk/releases/crosswalk/android/canary/').read()
     fp = open('test', 'w')
     fp.write(crosswalklist)
     fp.close()
     line = commands.getstatusoutput(
         "cat test|sed -n  '/src\=\"\/icons\/folder.gif\"/=' |sed -n '$p'")[1].strip()
     cmd = "cat test |sed -n '%dp' |awk -F 'href=' '{print $2}' |awk -F '\"|/' '{print $2}'" % int(
         line)
     version = commands.getstatusoutput(cmd)[1]
     if not '.' in version:
         line = commands.getstatusoutput(
             "tac test|sed -n  '/src\=\"\/icons\/folder.gif\"/=' |sed -n '2p'")[1].strip()
         cmd = "tac test |sed -n '%dp' |awk -F 'href=' '{print $2}' |awk -F '\"|/' '{print $2}'" % int(
             line)
         version = commands.getstatusoutput(cmd)[1]
     commands.getstatusoutput("rm -rf test")
     comm.clear("org.xwalk.test")
     self.assertEquals(currentVersion, version)
 def test_create_channel_stable(self):
     comm.setUp()
     comm.clear("org.xwalk.test")
     os.chdir(comm.XwalkPath)
     channel = "stable"
     old_list = os.listdir(os.getcwd())
     comm.channel(self, old_list, channel)
 def test_create_with_invalid_platform(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     cmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app create org.xwalk.test" + comm.MODE + " --platforms=target"
     packstatus = os.system(cmd)
     comm.clear("org.xwalk.test")
     self.assertNotEquals(packstatus, 0)
Example #23
0
 def test_build_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     comm.build(self, buildcmd)
     comm.clear("org.xwalk.test")
Example #24
0
 def test_build_missing_so_file(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     if comm.ARCH == "x86":
         os.remove(
             os.getcwd() +
             '/prj/android/xwalk_core_library/libs/armeabi-v7a/libxwalkcore.so')
         buildcmd = comm.PackTools + "crosswalk-app build"
         buildstatus = commands.getstatusoutput(buildcmd)
         self.assertEquals(buildstatus[0], 0)
         os.chdir('pkg')
         pkgs = os.listdir(os.getcwd())
         self.assertNotIn("test-debug.armeabi-v7a.apk", pkgs)
     else:
         os.remove(
             os.getcwd() +
             '/prj/android/xwalk_core_library/libs/x86/libxwalkcore.so')
         buildcmd = comm.PackTools + "crosswalk-app build"
         buildstatus = commands.getstatusoutput(buildcmd)
         self.assertEquals(buildstatus[0], 0)
         os.chdir('pkg')
         pkgs = os.listdir(os.getcwd())
         self.assertNotIn("test-debug.x86.apk", pkgs)
     comm.run(self)
     comm.clear("org.xwalk.test")
 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_target_bit_crosswalkdir(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     crosswalkdir = zipfile.ZipFile(comm.crosswalkzip, "r")
     for file in crosswalkdir.namelist():
         crosswalkdir.extract(file, r".")
     crosswalkdir.close()
     os.chdir("org.xwalk.test")
     cmd = (
         comm.HOST_PREFIX
         + comm.PackTools
         + "crosswalk-pkg --platforms=android --android="
         + comm.ANDROID_MODE
         + " --crosswalk="
         + comm.crosswalkzip[: comm.crosswalkzip.index(".zip")]
         + ' --targets="32 64" '
         + comm.ConstPath
         + "/../testapp/create_package_basic/"
     )
     return_code = os.system(cmd)
     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
         if comm.BIT == "64":
             self.assertEquals(x86_64Length, 1)
             self.assertEquals(arm_64Length, 1)
             self.assertEquals(x86Length, 0)
             self.assertEquals(armLength, 0)
         else:
             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
                 appVersion = apks[i].split("-")[1]
         self.assertEquals(apkLength, 1)
     comm.run(self)
     comm.clear("org.xwalk.test")
     shutil.rmtree(comm.crosswalkzip[: comm.crosswalkzip.index(".zip")])
     self.assertEquals(return_code, 0)
 def test_build_release_sdk(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     buildcmd = comm.PackTools + "crosswalk-app build release --ios-sdk iphoneos"
     comm.build(self, buildcmd)
     comm.clear("org.xwalk.test")
 def test_update_name(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["name"] = "org.example.test"
     json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     comm.build(self, buildcmd)
     root = ElementTree.parse(comm.ConstPath + "/../tools/org.xwalk.test/prj/android/AndroidManifest.xml").getroot()
     application_attributes = root.find('application').attrib
     for x in application_attributes.keys():
         if x.find("label") != -1:
             application_xml = application_attributes[x]
             break
     activity_attributes = root.find('application').find('activity').attrib
     for y in activity_attributes.keys():
         if y.find("label") != -1:
             activity_xml = activity_attributes[y]
             break
     comm.clear("org.xwalk.test")
     self.assertEquals(application_xml, "org.example.test")
     self.assertEquals(activity_xml, "org.example.test")
 def test_build_release_sign(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     buildcmd = comm.PackTools + 'crosswalk-app build release --ios-sign "iPhone Developer: M VINCENT DAUBRY (J9TS3TJRYX)"'
     comm.build(self, buildcmd)
     comm.clear("org.xwalk.test")
 def test_update_app_version(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_app_version"] = "0.0.1"
     json.dump(jsonDict, open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "w"))
     with open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json") as json_file:
         data = json.load(json_file)
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     root = ElementTree.parse(comm.ConstPath + "/../tools/org.xwalk.test/prj/android/AndroidManifest.xml").getroot()
     attributes = root.attrib
     for x in attributes.keys():
         if x.find("versionName") != -1:
             versionName_xml = attributes[x]
             break
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
     self.assertEquals(data['xwalk_app_version'].strip("\n\t"), "0.0.1")
     self.assertEquals(buildstatus, 0)
     self.assertEquals(data['xwalk_app_version'].strip("\n\t"), versionName_xml)
 def test_manifest_packageId(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     if os.path.exists(comm.ConstPath +
                       "/../testapp/start_url/manifest.json"):
         os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     os.chdir('org.xwalk.test')
     self.invokeCrosswalkPkg([
         '--platforms=android', '--android=' + comm.ANDROID_MODE,
         '--crosswalk=' + comm.crosswalkzip, '--manifest=org.xwalk.test',
         '--targets=' + comm.BIT, comm.ConstPath + '/../testapp/start_url/'
     ])
     with open(comm.ConstPath +
               "/../testapp/start_url/manifest.json") as json_file:
         data = json.load(json_file)
     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")
     os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     self.assertEquals(data['xwalk_package_id'].strip(os.linesep),
                       "org.xwalk.test")
Example #32
0
 def test_create_package_reading_manifest(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     if os.path.exists(comm.ConstPath + "/../testapp/start_url/manifest.json"):
         os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     os.chdir('org.xwalk.test')
     if comm.SHELL_FLAG == "False":
         cmd = comm.HOST_PREFIX + comm.PackTools + \
             "crosswalk-pkg --platforms=android --android=" + comm.ANDROID_MODE + " --crosswalk=" + comm.crosswalkzip + ' --manifest "{ """xwalk_package_id""": """org.xwalk.test""", """start_url""": """start.html""" }" ' + comm.ConstPath + "/../testapp/start_url/"
     else:
         cmd = comm.HOST_PREFIX + comm.PackTools + \
             "crosswalk-pkg --platforms=android --android=" + comm.ANDROID_MODE + " --crosswalk=" + comm.crosswalkzip + " --manifest '{ \"xwalk_package_id\": \"org.xwalk.test\", \"start_url\": \"start.html\" }' " + comm.ConstPath + "/../testapp/start_url/"
     return_code = os.system(cmd)
     with open(comm.ConstPath + "/../testapp/start_url/manifest.json") as json_file:
         data = json.load(json_file)
     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")
     os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     self.assertEquals(return_code, 0)
     self.assertEquals(data['xwalk_package_id'].strip(os.linesep), "org.xwalk.test")
Example #33
0
 def test_create_package_target_bit_crosswalkzip(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=" + comm.crosswalkzip + ' --targets="32 64" ' + comm.ConstPath + "/../testapp/create_package_basic/"
     return_code = os.system(cmd)
     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
         if comm.BIT == "64":
             self.assertEquals(x86_64Length, 1)
             self.assertEquals(arm_64Length, 1)
             self.assertEquals(x86Length, 0)
             self.assertEquals(armLength, 0)
         else:
             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
                 appVersion = apks[i].split('-')[1]
         self.assertEquals(apkLength, 1)
     comm.run(self)
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
 def test_update_app_version_twodot(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(
         comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_app_version"] = "0.0.1"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     with open(comm.ConstPath +
               "/../tools/org.xwalk.test/app/manifest.json") as json_file:
         data = json.load(json_file)
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     buildstatus = os.popen(buildcmd).readlines()
     index = 0
     for x in range(len(buildstatus), 0, -1):
         index = x - 1
         if buildstatus[index].find("Using android:versionCode") != -1:
             break
     versionCode = buildstatus[index].strip(
         " *\nUsing android:versionCode")[1:-1]
     root = ElementTree.parse(
         comm.ConstPath +
         "/../tools/org.xwalk.test/prj/android/AndroidManifest.xml"
     ).getroot()
     attributes = root.attrib
     for x in attributes.keys():
         if x.find("versionCode") != -1:
             versionCode_xml = attributes[x]
             break
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
     self.assertEquals(data['xwalk_app_version'].strip(os.linesep), "0.0.1")
     self.assertEquals(versionCode, versionCode_xml)
Example #35
0
 def test_create_package_p(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 windows --crosswalk=" + comm.XwalkPath + comm.windowsCrosswalk + " " + comm.ConstPath + "/../testapp/create_package_basic/"
     (return_code, output) = comm.getstatusoutput(cmd)
     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")
     self.assertEquals(return_code, 0)
     self.assertIn("candle", output[0])
     self.assertIn("light", output[0])
     self.assertNotIn("Loading 'android' platform backend", output[0])
     self.assertNotIn("armeabi-v7a,x86", output[0])
     self.assertEquals(apkLength, 1)
Example #36
0
 def test_target_build(self):
     comm.setUp()
     comm.clear("org.xwalk.test")
     os.chdir(comm.XwalkPath)
     comm.create(self)
     if comm.SHELL_FLAG == "False":
         cmd = "where android"
     else:
         cmd = "which android"
     (return_code, androidpath) = comm.getstatusoutput(cmd)
     targetversionpath = os.path.dirname(os.path.dirname(androidpath[0]))
     os.rename(targetversionpath + "/platforms/",
               targetversionpath + "/backup/")
     os.chdir(comm.XwalkPath + "org.xwalk.test")
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     (return_build_code, buildstatus) = comm.getstatusoutput(buildcmd)
     os.rename(targetversionpath + "/backup/",
               targetversionpath + "/platforms/")
     comm.clear("org.xwalk.test")
     self.assertNotEquals(return_build_code, 0)
     self.assertIn("project target", buildstatus[0])
 def test_versionName_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     with open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json") as json_file:
         data = json.load(json_file)
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     root = ElementTree.parse(comm.ConstPath + "/../tools/org.xwalk.test/prj/android/AndroidManifest.xml").getroot()
     attributes = root.attrib
     for x in attributes.keys():
         if x.find("versionName") != -1:
             versionName_xml = attributes[x]
             break
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
     self.assertEquals(buildstatus, 0)
     self.assertEquals(data['xwalk_app_version'].strip("\n\t"), "0.1")
     self.assertEquals(data['xwalk_app_version'].strip("\n\t"), versionName_xml)
 def test_update_app_version(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(
         comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_app_version"] = "0.0.1"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     appVersion = comm.build(self, buildcmd)
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
     self.assertEquals(appVersion, "0.0.1")
 def test_target_build(self):
     comm.setUp()
     comm.clear("org.xwalk.test")
     os.chdir(comm.XwalkPath)
     comm.create(self)
     cmd = "which android"
     (return_code, androidpath) = comm.getstatusoutput(cmd)
     targetversionpath = os.path.dirname(os.path.dirname(androidpath[0]))
     os.chdir(targetversionpath)
     movepath = os.path.dirname(
         os.path.dirname(targetversionpath)) + "/new-platforms/"
     os.system("mv platforms/ " + movepath)
     os.chdir(comm.XwalkPath)
     os.chdir('org.xwalk.test')
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     (return_build_code, buildstatus) = comm.getstatusoutput(buildcmd)
     os.chdir(movepath + "../")
     os.system("mv new-platforms/ " + targetversionpath + "/platforms/")
     comm.clear("org.xwalk.test")
     self.assertNotEquals(return_build_code, 0)
     self.assertIn("project target", buildstatus[0])
Example #40
0
 def test_keep_project_k(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     os.chdir('org.xwalk.test')
     cmd = comm.PackTools + "crosswalk-pkg --platforms=ios -k " + comm.ConstPath + "/../testapp/create_package_basic/"
     packstatus = commands.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     ipaLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".ipa"):
             ipaLength = ipaLength + 1
     projectDir = packstatus[1].split(" * " +
                                      os.linesep)[-1].split(' ')[-1].strip(
                                          os.linesep)
     comm.clear("org.xwalk.test")
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(ipaLength, 1)
     self.assertIn("app", os.listdir(projectDir))
     self.assertIn("prj", os.listdir(projectDir))
Example #41
0
 def test_main_activity(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test/prj/android')
     fp = open(os.getcwd() + '/AndroidManifest.xml')
     lines = fp.readlines()
     for i in range(len(lines)):
         line = lines[i].strip(' ').strip('\n\t')
         findLine = "<activity"
         if i <= len(lines):
             if findLine in line:
                 print "Find"
                 start = line.index("name")
                 self.assertIn('MainActivity', line[start:])
                 break
             else:
                 print "Continue find"
         else:
             self.assertIn(findLine, line)
     fp.close()
     comm.clear("org.xwalk.test")
Example #42
0
 def test_icon_gif(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(
         comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["icons"][0]["src"] = "../../../icon/icon.gif"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
     self.assertEquals(buildstatus, 0)
 def test_create_package_release_without_argument_check_locale(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     os.chdir('org.xwalk.test')
     comm.unzip_dir(comm.XwalkPath + comm.windowsCrosswalk, comm.XwalkPath)
     cmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-pkg --platforms=windows --crosswalk=" + comm.XwalkPath + comm.windowsCrosswalk.replace('.zip', '') + " -r " + comm.ConstPath + "/../testapp/create_package_basic/"
     (return_code, output) = comm.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".msi"):
             apkLength = apkLength + 1
     self.assertEquals(return_code, 0)
     self.assertEquals(apkLength, 1)
     cmd = "msiexec /a %s TARGETDIR=%s" % (
         apks[0], os.path.join(os.path.abspath(comm.XwalkPath), "test-app"))
     (return_code, output) = comm.getstatusoutput(cmd)
     self.assertEquals(return_code, 0)
     self.assertTrue(
         os.path.isdir(
             os.path.join(os.path.abspath(comm.XwalkPath), "test-app",
                          "org.xwalk.test", "locales")))
     comm.clear("org.xwalk.test")
     comm.clear("test-app")
 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)
Example #45
0
 def test_multiple_backends(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     os.chdir('org.xwalk.test')
     cmd = comm.PackTools + 'crosswalk-pkg --platforms="ios android" ' + comm.ConstPath + "/../testapp/create_package_basic/"
     packstatus = commands.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     ipaLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".apk") and "x86" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".apk") and "arm" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".ipa"):
             ipaLength = ipaLength + 1
     comm.clear("org.xwalk.test")
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(apkLength, 2)
     self.assertEquals(ipaLength, 1)
 def test_multiple_backends_crosswalkversion(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 android" --crosswalk=19.48.495.0 ' + comm.ConstPath + "/../testapp/create_package_basic/"
     os.system(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     msiLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".apk") and "x86" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".apk") and "arm" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".msi"):
             msiLength = msiLength + 1
     comm.clear("org.xwalk.test")
     self.assertEquals(apkLength, 2)
     self.assertEquals(msiLength, 1)
Example #47
0
 def test_webp_jpeg_size_valid(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(
         comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_android_webp"] = "80"
     jsonDict["icons"][0]["src"] = "icon.jpeg"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     os.rename("app/icon.png", "app/icon.jpeg")
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     comm.build(self, buildcmd)
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
 def test_create_package_k(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=" + comm.XwalkPath + comm.windowsCrosswalk + " -k " + comm.ConstPath + "/../testapp/create_package_basic/"
     (return_code, output) = comm.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".msi"):
             apkLength = apkLength + 1
     projectDir = output[0].split(" * " +
                                  os.linesep)[-1].split(' ')[-1].strip(
                                      os.linesep)
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
     self.assertEquals(apkLength, 1)
     self.assertIn("app", os.listdir(projectDir))
     self.assertIn("prj", os.listdir(projectDir))
 def test_crosswalk_build(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     crosswalkdir = zipfile.ZipFile(comm.crosswalkzip, 'r')
     for file in crosswalkdir.namelist():
         crosswalkdir.extract(file, r'.')
     crosswalkdir.close()
     os.chdir('org.xwalk.test')
     self.invokeCrosswalkPkg([
         '--platforms=android',
         '--android=' + comm.ANDROID_MODE,
         '--crosswalk=' + comm.crosswalkzip[:-4] + '/',
         '--targets=' + comm.BIT,
         comm.ConstPath + '/../testapp/create_package_basic/',
     ])
     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")
     shutil.rmtree(comm.crosswalkzip[:-4])
 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
     return_code = os.system(createcmd)
     htmlDoc = urllib2.urlopen(
         'https://download.01.org/crosswalk/releases/crosswalk/android/stable/'
     ).read()
     soup = BeautifulSoup(htmlDoc)
     alist = soup.find_all('a')
     version = ''
     for index in range(-1, -len(alist) - 1, -1):
         aEle = alist[index]
         version = aEle['href'].strip('/')
         if re.search('[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*', version):
             break
     crosswalk = 'crosswalk-{}.zip'.format(version)
     namelist = os.listdir(os.getcwd())
     comm.clear("org.xwalk.test")
     self.assertIn(crosswalk, namelist)
     self.assertEquals(return_code, 0)
 def test_permission_name(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 + " --keep --crosswalk=" + comm.crosswalkzip + " " + comm.ConstPath + "/../testapp/camera_permissions_enable/"
     (return_code, output) = comm.getstatusoutput(cmd)
     projectDir = output[0].split(" * " +
                                  os.linesep)[-1].split(' ')[-1].strip(
                                      os.linesep)
     root = ElementTree.parse(projectDir +
                              "/prj/android/AndroidManifest.xml").getroot()
     permission_attributes = root.findall('uses-permission')
     name = []
     for x in permission_attributes:
         name.append(x.attrib.items()[0][1])
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
     self.assertEquals(len(permission_attributes), 4)
     self.assertIn("android.permission.CAMERA", name)
 def test_update_app_version_out_of_range(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     jsonfile = open(
         comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_app_version"] = "1000"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     with open(comm.ConstPath +
               "/../tools/org.xwalk.test/app/manifest.json") as json_file:
         data = json.load(json_file)
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     return_code = os.system(buildcmd)
     comm.clear("org.xwalk.test")
     self.assertEquals(data['xwalk_app_version'].strip(os.linesep), "1000")
     self.assertNotEquals(return_code, 0)
 def test_create_package_stable(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 --crosswalk=stable " + comm.ConstPath + "/../testapp/create_package_missing_icon_startUrl/"
     return_code = os.system(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".apk") and "x86" in apks[i]:
             apkLength = apkLength + 1
         if apks[i].endswith(".apk") and "arm" in apks[i]:
             apkLength = apkLength + 1
     self.assertEquals(apkLength, 2)
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
     self.assertEquals(return_code, 0)
Example #54
0
 def test_build_missing_so_file(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     if comm.ARCH == "x86":
         os.remove(os.getcwd() + '/prj/android/xwalk_core_library/libs/armeabi-v7a/libxwalkcore.so')
         buildcmd =  comm.PackTools + "crosswalk-app build"
         buildstatus = commands.getstatusoutput(buildcmd)
         self.assertEquals(buildstatus[0], 0)
         os.chdir('pkg')
         pkgs = os.listdir(os.getcwd())
         self.assertNotIn("test-debug.armeabi-v7a.apk", pkgs)
     else:
         os.remove(os.getcwd() + '/prj/android/xwalk_core_library/libs/x86/libxwalkcore.so')
         buildcmd =  comm.PackTools + "crosswalk-app build"
         buildstatus = commands.getstatusoutput(buildcmd)
         self.assertEquals(buildstatus[0], 0)
         os.chdir('pkg')
         pkgs = os.listdir(os.getcwd())
         self.assertNotIn("test-debug.x86.apk", pkgs)
     comm.run(self)
     comm.clear("org.xwalk.test")
 def test_name_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     comm.build(self, buildcmd)
     root = ElementTree.parse(
         comm.ConstPath +
         "/../tools/org.xwalk.test/prj/android/AndroidManifest.xml"
     ).getroot()
     application_attributes = root.find('application').attrib
     for x in application_attributes.keys():
         if x.find("label") != -1:
             application_xml = application_attributes[x]
             break
     activity_attributes = root.find('application').find('activity').attrib
     for y in activity_attributes.keys():
         if y.find("label") != -1:
             activity_xml = activity_attributes[y]
             break
     comm.clear("org.xwalk.test")
     self.assertEquals(application_xml, "org.xwalk.test")
     self.assertEquals(activity_xml, "org.xwalk.test")
Example #56
0
 def test_create_package_m(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     comm.clear("org.xwalk.test")
     os.mkdir("org.xwalk.test")
     if os.path.exists(comm.ConstPath + "/../testapp/start_url/manifest.json"):
         os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     os.chdir('org.xwalk.test')
     cmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-pkg --platforms=windows --crosswalk=" + comm.XwalkPath + comm.windowsCrosswalk + " -m org.xwalk.test " + comm.ConstPath + "/../testapp/start_url/"
     return_code = os.system(cmd)
     with open(comm.ConstPath + "/../testapp/start_url/manifest.json") as json_file:
         data = json.load(json_file)
     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")
     os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     self.assertEquals(return_code, 0)
     self.assertEquals(data['xwalk_package_id'].strip(os.linesep), "org.xwalk.test")
     self.assertEquals(apkLength, 1)
Example #57
0
 def test_no_sdk(self):
     comm.setUp()
     comm.clear("org.xwalk.test")
     android_home = os.getenv('ANDROID_HOME')
     android_home2 = android_home + "/sdkk"
     allpath = os.getenv('PATH')
     paths = allpath.split(os.linesep)
     new_path = ""
     for i in range(len(paths)):
         print paths[i]
         if android_home in paths[i]:
             paths[i] = paths[i].replace(android_home, android_home2)
             new_path = os.linesep.join(paths).strip()
     os.environ['PATH'] = new_path
     os.chdir(comm.XwalkPath)
     cmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-app create org.xwalk.test" + comm.MODE + " --android-crosswalk=" + \
         comm.crosswalkVersion
     (return_create_code, packstatus) = comm.getstatusoutput(cmd)
     os.environ['ANDROID_HOME'] = android_home
     os.environ['PATH'] = allpath
     comm.clear("org.xwalk.test")
     self.assertIn("ERROR", packstatus[0])
 def test_build_debug_path_webp(self):
     comm.setUp()
     comm.create(self)
     jsonfile = open(
         comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_android_webp"] = "80 80 100"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     if os.path.exists("pkg"):
         shutil.rmtree("pkg")
     os.mkdir("pkg")
     os.chdir('pkg')
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build " + comm.XwalkPath + "org.xwalk.test"
     comm.build(self, buildcmd)
     comm.run(self)
     os.chdir('../')
     shutil.rmtree("pkg")
     comm.clear("org.xwalk.test")
 def test_build_missing_so_file(self):
     comm.setUp()
     cmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-app create org.xwalk.test --android-crosswalk=" + \
         comm.crosswalkVersion
     os.system(cmd)
     os.chdir('org.xwalk.test')
     if comm.ARCH == "x86":
         os.remove(
             os.getcwd() +
             '/prj/android/xwalk_core_library/libs/armeabi-v7a/libxwalkcore.so')
         buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
         buildstatus = os.system(buildcmd)
         self.assertEquals(buildstatus, 0)
         pkgs = os.listdir(os.getcwd())
         armLength = 0
         for i in range(len(pkgs)):
             if pkgs[i].endswith(".apk") and "arm" in pkgs[i]:
                 armLength = armLength + 1
         self.assertEquals(armLength, 0)
     else:
         os.remove(
             os.getcwd() +
             '/prj/android/xwalk_core_library/libs/x86/libxwalkcore.so')
         buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
         buildstatus = os.system(buildcmd)
         self.assertEquals(buildstatus, 0)
         pkgs = os.listdir(os.getcwd())
         x86Length = 0
         for i in range(len(pkgs)):
             if pkgs[i].endswith(".apk") and "x86" in pkgs[i]:
                 x86Length = x86Length + 1
         self.assertEquals(x86Length, 0)
     comm.run(self)
     comm.clear("org.xwalk.test")
     if comm.SHELL_FLAG == "False":
         os.system('adb start-server')
 def test_path_absolute(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,
         '--crosswalk=' + comm.crosswalkzip,
         '--targets=' + comm.BIT,
         comm.ConstPath + '/../testapp/create_package_basic/',
     ])
     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("Loading 'android' platform backend", output)
     self.assertNotIn("candle", output)
     self.assertNotIn("light", output)