def test_launch(self):
     comm.setUp()
     app_name = "Eh"
     pkg_name = "com.mmocny.eh.app"
     if not comm.check_app_installed(pkg_name, self):
         comm.app_install(app_name, pkg_name, self)
     comm.app_launch(app_name, pkg_name, self)
 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")
Example #3
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")
 def test_launch(self):
     comm.setUp()
     app_name = "helloworld"
     pkg_name = "com.example." + app_name.lower()
     if not comm.check_app_installed(pkg_name, self):
         comm.app_install(app_name, pkg_name, self)
     comm.app_launch(app_name, pkg_name, self)
 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_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_create_with_invalid_platform(self):
     comm.setUp()
     os.chdir(comm.TEMP_DATA_PATH)
     cmd = "crosswalk-app create " + comm.TEST_PROJECT_COMM + " --platforms=target"
     packstatus = commands.getstatusoutput(cmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(packstatus[0], 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_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_uninstall(self):
     comm.setUp()
     app_name = "spacedodge"
     pkg_name = "com.example." + app_name.lower()
     if not comm.check_app_installed(pkg_name, self):
         comm.app_install(app_name, pkg_name, self)
     comm.app_uninstall(pkg_name, self)
 def test_list_target_platforms(self):
     comm.setUp()
     os.chdir(comm.TEMP_DATA_PATH)
     cmd = "crosswalk-app platforms"
     status = os.popen(cmd).readlines()
     self.assertEquals("deb", status[0].strip(" *\n"))
     self.assertEquals("android", status[1].strip(" *\n"))
 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_uninstall(self):
     comm.setUp()
     app_name = "CIRC"
     pkg_name = "com.github.flackr.Circ"
     if not comm.check_app_installed(pkg_name, self):
         comm.app_install(app_name, pkg_name, self)
     comm.app_uninstall(pkg_name, self)
Example #14
0
 def test_check_host_without_platforms(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     cmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app check"
     (return_code, output) = comm.getstatusoutput(cmd)
     self.assertEquals(return_code, 0)
     self.assertNotIn("ERROR:", output[0].split('target windows')[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)
Example #16
0
 def test_check_host_android(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     cmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app check android"
     (return_code, output) = comm.getstatusoutput(cmd)
     self.assertEquals(return_code, 0)
     self.assertNotIn("ERROR:", output[0])
 def test_uninstall(self):
     comm.setUp()
     app_name = "privateNotes"
     pkg_name = "com.example." + app_name
     if not comm.check_app_installed(pkg_name, self):
         comm.app_install(app_name, pkg_name, self)
     comm.app_uninstall(pkg_name, self)
 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)
 def test_field_combination(self):
     comm.setUp()
     manifestPath = comm.ConstPath + "/../testapp/splashscreen_launchscreen_field_tests/manifest.json"
     cmd = "python %smake_apk.py --package=org.xwalk.example --arch=%s --mode=%s --manifest=%s" % \
           (comm.Pck_Tools, comm.ARCH, comm.MODE, manifestPath)
     packstatus = commands.getstatusoutput(cmd)
     self.assertEquals(0, packstatus[0])
     print "Generate APK ----------------> OK!"
     inststatus = commands.getstatusoutput("adb -s " + comm.device + " install -r Example*apk")
     self.assertEquals(0, inststatus[0])
     print "Install APK ----------------> OK"
     pmstatus = commands.getstatusoutput("adb -s " + comm.device + " shell pm list packages |grep org.xwalk.example")
     self.assertEquals(0, pmstatus[0])
     print "Find Package in device ---------------->O.K"
     launchstatus = commands.getstatusoutput("adb -s " + comm.device + " shell am start -n org.xwalk.example/.ExampleActivity")
     self.assertEquals(0, launchstatus[0])
     print "Launch APK ---------------->OK"
     stopstatus = commands.getstatusoutput("adb -s " + comm.device + " shell am force-stop org.xwalk.example")
     if stopstatus[0] == 0:
         print "Stop APK ---------------->O.K"
         unistatus = commands.getstatusoutput("adb -s " + comm.device + " uninstall org.xwalk.example")
         self.assertEquals(0, unistatus[0])
         print "Uninstall APK ---------------->O.K"
     else:
         print "Stop APK ---------------->Error"
         os.system("adb -s " + comm.device + " uninstall org.xwalk.example")
     os.system("rm -rf *.apk")
 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 tryRunApp(item, projectName):
    try:
        comm.setUp()
        flag = item[:10].strip()
        os.system("chmod 777 " + comm.TEMP_DATA_PATH)
        os.chdir(comm.TEMP_DATA_PATH)
        cmd = "crosswalk-app create " + projectName
        packstatus = commands.getstatusoutput(cmd)

        if 'negative' in flag:
            if 'ERROR' in packstatus[1]:
                result = 'PASS'
                print "%21s\tFAIL\tFAIL" % projectName
            else:
                result = 'FAIL'
                print "%21s\tFAIL\tPASS" % projectName
        elif 'positive' in flag:
            if packstatus[0] == 0:
                result = 'PASS'
                print "%21s\tPASS\tPASS" % projectName
            else:
                result = 'FAIL'
                print "%21s\tPASS\tFAIL" % projectName

        comm.cleanTempData(projectName)
        os.chdir(comm.SCRIPT_DIR_NAME)
        os.system("rm -R " + comm.TEMP_DATA_PATH)
        return result
    except Exception,e:
        print Exception,"Run pkgName.py error:",e
        sys.exit(1)
 def test_launch(self):
     comm.setUp()
     app_name = "mobilespec"
     pkg_name = "org.apache." + app_name.lower()
     if not comm.check_app_installed(pkg_name, self):
         comm.app_install(app_name, pkg_name, self)
     comm.app_launch(app_name, pkg_name, self)
Example #23
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_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_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_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_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_uninstall_withAppRunning(self):
        comm.setUp()
        app_name = "Hangonman"
        cmdfind = "adb -s " + comm.device + \
            " shell pm list packages |grep org.xwalk.%s" % (app_name.lower())
        # print "cmdfind: ", cmdfind
        pmstatus = commands.getstatusoutput(cmdfind)
        # print "pmstatus: ", pmstatus

        if pmstatus[0] != 0:
            print "Uninstall APK ----------------> %s App haven't installed, need to install it!" % app_name
            os.chdir(comm.const_path + "/../testapp/")
            apk_file = commands.getstatusoutput("ls | grep %s" % app_name)[1]
            cmdinst = "adb -s " + comm.device + " install -r " + apk_file
            comm.app_install(cmdinst, cmdfind, self)

        # Make sure the app is running
        cmd = "adb -s " + comm.device + " shell am start -n org.xwalk.%s/.%sActivity" % \
            (app_name.lower(), app_name)
        comm.app_launch(cmd, self)
        time.sleep(2)

        # Uninstall the app
        cmduninst = "adb -s " + comm.device + \
            " uninstall org.xwalk.%s" % (app_name.lower())
        comm.app_uninstall(cmduninst, self)
 def test_list_target_platforms(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     cmd = comm.PackTools + "crosswalk-app platforms"
     status = os.popen(cmd).readlines()
     self.assertEquals("ios", status[0].strip(" *\n"))
     self.assertEquals("android", status[1].strip(" *\n"))
 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_name_special_characters(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"] = "/n"
     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.clear("org.xwalk.test")
     self.assertEquals(buildstatus, 0)
Example #32
0
 def test_update_iconName(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.png"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     os.rename("app/icon.png", "app/.icon.png")
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build"
     return_code = os.system(buildcmd)
     comm.clear("org.xwalk.test")
     self.assertNotEquals(return_code, 0)
 def test_start_url_noexist(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["start_url"] = "http://www.noexist.com"
     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")
     self.assertEquals(buildstatus, 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')
     output = self.invokeCrosswalkPkg([
         '--platforms=android',
         '--android=' + comm.ANDROID_MODE,
         '--keep',
         '--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)
     project_dir = None
     for line in output.split('\n'):
         match = re.search(r'Keeping build tree in (.+)$', line)
         if match is not None:
             project_dir = match.group(1)
     comm.run(self)
     comm.clear("org.xwalk.test")
     self.assertTrue(os.path.isdir(project_dir))
     self.assertTrue(os.path.isdir(os.path.join(project_dir, "app")))
     self.assertTrue(os.path.isdir(os.path.join(project_dir, "prj")))
Example #35
0
def generate_cmd():
    comm.setUp()
    positive_data = [
        'org.xwalk.tests',
        'org.xwalk.t1234',
        'org.example.xwal_',
        'org.example.te_st',
        'or_g.example.xwalk',
        'org000.example.xwalk',
        'org.example123.xwalk']
    negative_data = [
        'org.xwalk',
        'test',
        'org.example.1234test',
        'org.example.1234',
        '123org.example.xwalk',
        'org.123example.xwalk',
        'org.example._xwalk',
        'org.xwalk.Tests',
        '_org.example.xwalk']
    flag = ''
    num = 0
    os.chdir(comm.ConstPath + '/../')
    if os.path.exists(comm.ConstPath + '/../report'):
        shutil.rmtree(comm.ConstPath + '/../report')
    os.mkdir('report')
    fp = open(comm.ConstPath + '/../report/cmd.txt', 'a+')
    for i in positive_data:
        num = num + 1
        flag = 'positive' + str(num)
        cmd = flag + '\tcrosswalk-app create ' + \
            i + ' --platforms=windows --windows-crosswalk=' + '\n'
        # print cmd
        fp.write(cmd)
    for j in negative_data:
        num = num + 1
        flag = 'negative' + str(num)
        cmd = flag + '\tcrosswalk-app create ' + \
            j + ' --platforms=windows --windows-crosswalk=' + '\n'

        # print cmd
        fp.write(cmd)
    fp.close()
 def test_webp_jpeg_size_invalid(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"] = "101"
     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"
     buildstatus = os.system(buildcmd)
     comm.clear("org.xwalk.test")
     self.assertNotEquals(buildstatus, 0)
 def test_uninstall(self):
     comm.setUp()
     comm.check_appname()
     cmdfind = "adb -s " + comm.device + \
         " shell pm list packages |grep org.crosswalkproject.sample"
     # print "cmdfind: ", cmdfind
     pmstatus = commands.getstatusoutput(cmdfind)
     # print "pmstatus: ", pmstatus
     if pmstatus[0] != 0:
         print "Uninstall APK ----------------> %s App haven't installed,"\
         " need to install it!" % comm.app_name
         os.chdir(comm.const_path + "/../testapp/")
         apk_file = commands.getstatusoutput("ls | grep %s" % \
             comm.app_name)[1]
         cmdinst = "adb -s " + comm.device + " install -r " + apk_file
         comm.app_install(cmdinst, cmdfind, self)
     cmduninst = "adb -s " + comm.device + \
         " uninstall org.crosswalkproject.sample"
     comm.app_uninstall(cmduninst, self)
 def test_update_stable(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     updatecmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app update stable"
     currentVersion = comm.update(self, updatecmd)
     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
     comm.clear("org.xwalk.test")
     self.assertEquals(currentVersion, version)
Example #39
0
 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")
     self.assertEquals(appVersion, "0.0.1")
Example #40
0
 def test_update_target_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 --platforms=windows --crosswalk=" + comm.XwalkPath + comm.windowsCrosswalk + " ../../testapp/manifest_xwalk_target_platforms/android_platform/"
     (return_code, output) = comm.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     msiLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".msi"):
             msiLength = msiLength + 1
     comm.clear("org.xwalk.test")
     self.assertEquals(return_code, 0)
     self.assertEquals(msiLength, 1)
     self.assertIn("Loading 'windows' platform backend", output[0])
     self.assertNotIn("Loading 'android' platform backend", output[0])
Example #41
0
 def test_update_target_platforms(self):
     comm.setUp()
     os.chdir(comm.TEMP_DATA_PATH)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     os.mkdir(comm.TEST_PROJECT_COMM)
     os.chdir(comm.TEST_PROJECT_COMM)
     cmd = 'crosswalk-pkg --platforms=deb ' + comm.SCRIPT_DIR_NAME + "/../testapp/manifest_xwalk_target_platforms/android_platform/"
     packstatus = commands.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     debLength = 0
     for i in range(len(apks)):
         if apks[i].endswith(".deb"):
             debLength = debLength + 1
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(debLength, 1)
     self.assertIn("target deb", packstatus[1])
     self.assertNotIn("Loading 'android' platform backend", packstatus[1])
 def test_manifest_version_versionCode(self):
     comm.setUp()
     comm.clear_versionCode()
     targetDir = comm.ConstPath + "/../testapp/example/"
     manfiestPath = targetDir + "manifest.json"
     os.chdir(targetDir)
     versionCode = ""
     versionCodeBase = ""
     cmd = "python %smake_apk.py --package=org.xwalk.example --arch=%s --mode=%s --manifest=%s --project-dir=test --app-version=1.0.0.0" % \
         (comm.Pck_Tools, comm.ARCH, comm.MODE, manfiestPath)
     packstatus = commands.getstatusoutput(cmd)
     errorinfo1 = "Error"
     errorinfo2 = "--app-versionCode"
     errorinfo3 = "--app-versionCodeBase"
     self.assertNotEquals(0, packstatus[0])
     self.assertIn(errorinfo1, packstatus[1])
     self.assertIn(errorinfo2, packstatus[1])
     self.assertIn(errorinfo3, packstatus[1])
     comm.clear_versionCode()
 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"
     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")
Example #44
0
 def test_stop(self):
     comm.setUp()
     app_name = "Spacedodgegame"
     # Find whether the app have launched
     cmdacti = "adb -s " + comm.device + \
         " shell dumpsys activity activities | grep org.xwalk.%s" % \
         app_name.lower()
     launched = commands.getstatusoutput(cmdacti)
     if launched[0] != 0:
         print "Stop APK ---------------->%s App haven't launched, "\
         "need to launch it!" % app_name
         cmdstart = "adb -s " + comm.device + " shell am start -n "\
         "org.xwalk.%s/.%sActivity" % \
         (app_name.lower(), app_name)
         comm.app_launch(cmdstart, self)
         time.sleep(1)
     cmdstop = "adb -s " + comm.device + \
         " shell am force-stop org.xwalk.%s" % app_name.lower()
     comm.app_stop(cmdstop, self)
Example #45
0
 def test_create_offline(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     for i in range(len(os.listdir(comm.XwalkPath))):
         if os.listdir(comm.XwalkPath)[i].endswith(".zip"):
             androidCrosswalk = os.listdir(comm.XwalkPath)[i]
     comm.clear("org.xwalk.test")
     cmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-app create org.xwalk.test" + comm.MODE + " --android-crosswalk=" + \
         androidCrosswalk
     (return_create_code, create_output) = comm.getstatusoutput(cmd)
     os.chdir('org.xwalk.test')
     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')
     self.assertNotIn("Looking for", create_output)
 def test_icon_jpg(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.jpg"
     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")
     self.assertEquals(buildstatus, 0)
 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')
     self.invokeCrosswalkPkg([
         '--platforms=android',
         '--android=' + comm.ANDROID_MODE,
         '--crosswalk=canary',
         '--targets=a x',
         comm.ConstPath + '/../testapp/create_package_basic/',
     ])
     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, 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")
 def test_setup_cache_dir(self):
     comm.setUp()
     os.chdir(comm.XwalkPath)
     if os.path.exists("cache"):
         shutil.rmtree("cache")
     os.mkdir("cache")
     comm.create(self)
     os.environ["CROSSWALK_APP_TOOLS_CACHE_DIR"] = comm.XwalkPath + "cache"
     os.chdir('org.xwalk.test')
     updatecmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app update 13.42.319.5"
     comm.update(self, updatecmd)
     namelist = os.listdir(os.getcwd())
     os.chdir(comm.XwalkPath + "cache")
     crosswalklist = os.listdir(os.getcwd())
     os.environ["CROSSWALK_APP_TOOLS_CACHE_DIR"] = comm.XwalkPath
     os.chdir(comm.XwalkPath)
     shutil.rmtree("cache")
     comm.clear("org.xwalk.test")
     self.assertNotIn("crosswalk-13.42.319.5.zip", namelist)
     self.assertIn("crosswalk-13.42.319.5.zip", crosswalklist)
Example #49
0
 def test_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')
     cmd = comm.PackTools + 'crosswalk-pkg --platforms=ios -m "{ """xwalk_package_id""": """org.xwalk.test""", """start_url""": """start.html""" }" ' + comm.ConstPath + "/../testapp/start_url/"
     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
     comm.clear("org.xwalk.test")
     os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(ipaLength, 1)
 def test_target_create(self):
     comm.setUp()
     comm.clear("org.xwalk.test")
     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)
     createcmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-app create org.xwalk.test" + comm.MODE + " --android-crosswalk=" + \
         comm.crosswalkVersion
     (return_create_code, output) = comm.getstatusoutput(createcmd)
     os.chdir(movepath + "../")
     os.system("mv new-platforms/ " + targetversionpath + "/platforms/")
     comm.clear("org.xwalk.test")
     self.assertNotEquals(return_create_code, 0)
     self.assertIn("android list targets", output[0])
Example #51
0
 def test_target_create(self):
     comm.setUp()
     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/")
     comm.clear("org.xwalk.test")
     os.chdir(comm.XwalkPath)
     createcmd = comm.HOST_PREFIX + comm.PackTools + \
         "crosswalk-app create org.xwalk.test" + comm.MODE + " --android-crosswalk=" + \
         comm.crosswalkzip
     (return_create_code, output) = comm.getstatusoutput(createcmd)
     os.rename(targetversionpath + "/backup/",
               targetversionpath + "/platforms/")
     comm.clear("org.xwalk.test")
     self.assertNotEquals(return_create_code, 0)
Example #52
0
 def test_projectdir_readOnly(self):
     comm.setUp()
     os.chdir(comm.Pck_Tools)
     manifestPath = comm.ConstPath + "/../testapp/example/manifest.json"
     if not os.path.exists(comm.Pck_Tools + "readOnly"):
         os.mkdir("readOnly")
     os.chmod("readOnly", stat.S_IREAD)
     cmd = "python make_apk.py --package=org.xwalk.example --arch=%s --mode=%s --manifest=%s --project-dir=readOnly" % \
           (comm.ARCH, comm.MODE, manifestPath)
     packstatus = commands.getstatusoutput(cmd)
     errormsg = "OSError: [Errno 13] Permission denied"
     self.assertNotEqual(packstatus[0], 0)
     self.assertIn(errormsg, packstatus[1])
     self.assertIn(comm.AppName, os.listdir(comm.Pck_Tools))
     try:
         shutil.rmtree(comm.Pck_Tools + "readOnly")
         os.remove(comm.Pck_Tools + comm.AppName)
     except Exception as e:
         os.system("rm -rf " + comm.Pck_Tools + "readOnly &>/dev/null")
         os.system("rm -rf " + comm.Pck_Tools + "*apk &>/dev/null")
 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)
     comm.clear("org.xwalk.test")
Example #54
0
 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))
Example #55
0
 def test_build_release_webp(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 80 100"
     json.dump(
         jsonDict,
         open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json",
              "w"))
     buildcmd = comm.HOST_PREFIX + comm.PackTools + "crosswalk-app build release"
     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_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("target android", output[0])
     self.assertEquals(apkLength, 1)
 def test_app_version_threedot(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     jsonfile = open(
         comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM +
         "/app/manifest.json", "r")
     jsons = jsonfile.read()
     jsonfile.close()
     jsonDict = json.loads(jsons)
     jsonDict["xwalk_app_version"] = "0.0.0.1"
     json.dump(
         jsonDict,
         open(
             comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM +
             "/app/manifest.json", "w"))
     buildcmd = "crosswalk-app build"
     return_code = os.system(buildcmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(return_code, 0)
 def test_versionCode_normal(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 + " " + 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")
     comm.clear("org.xwalk.test")
     preline = output[0].index('prePackage windows')
     pkgline = output[0].index('Package:')
     postline = output[0].index('postPackage windows')
     self.assertEquals(return_code, 0)
     self.assertIn("prePackage windows", output[0])
     self.assertIn("postPackage windows", output[0])
     self.assertTrue(postline > pkgline)
     self.assertTrue(pkgline > preline)
Example #59
0
 def test_versionCode_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir('org.xwalk.test')
     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(versionCode, versionCode_xml)
Example #60
0
 def test_multiple_apk_false(self):
     comm.setUp()
     app_name = "testMultipleApk"
     pkg_name = " com.example." + app_name.lower()
     content = "<a href='http://www.intel.com'>Intel</a>\n</body>"
     key = "</body>"
     replace_index_list = [key, content]
     comm.create(
         app_name,
         pkg_name,
         comm.MODE,
         None,
         replace_index_list,
         self, None, "false")
     comm.build(app_name, 0, self, True, False)
     comm.checkFileSize(os.path.join(comm.testapp_path, "%s.apk" % app_name), 20, 25, self)
     comm.app_install(app_name, pkg_name, self)
     comm.app_launch(app_name, pkg_name, self)
     comm.app_stop(pkg_name, self)
     comm.app_uninstall(pkg_name, self)