コード例 #1
0
 def test_without_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 ' + comm.SCRIPT_DIR_NAME + "/../testapp/create_package_basic/"
     packstatus = commands.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     debLength = 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(".deb"):
             debLength = debLength + 1
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(apkLength, 2)
     self.assertEquals(debLength, 0)
     self.assertNotIn("target deb", packstatus[1])
     self.assertIn("target android", packstatus[1])
コード例 #2
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)
コード例 #3
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)
コード例 #4
0
 def test_without_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 ' + comm.SCRIPT_DIR_NAME + "/../testapp/create_package_basic/"
     packstatus = commands.getstatusoutput(cmd)
     apks = os.listdir(os.getcwd())
     apkLength = 0
     debLength = 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(".deb"):
             debLength = debLength + 1
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(apkLength, 2)
     self.assertEquals(debLength, 0)
     self.assertNotIn("target deb", packstatus[1])
     self.assertIn("Loading 'android' platform backend", packstatus[1])
コード例 #5
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\tFILE\tFILE" % projectName
            else:
                result = 'FILE'
                print "%21s\tFILE\tPASS" % projectName
        elif 'positive' in flag:
            if packstatus[0] == 0:
                result = 'PASS'
                print "%21s\tPASS\tPASS" % projectName
            else:
                result = 'FILE'
                print "%21s\tPASS\tFILE" % 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)
コード例 #6
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)
コード例 #7
0
 def test_packageID(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     with open(comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM + "/app/manifest.json") as json_file:
         data = json.load(json_file)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(data["xwalk_package_id"].strip(os.linesep), comm.TEST_PROJECT_COMM)
コード例 #8
0
 def test_build_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     buildcmd = "crosswalk-app build"
     comm.build(self, buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     comm.delete()
コード例 #9
0
 def test_build_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     buildcmd = "crosswalk-app build"
     comm.build(self, buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     comm.delete()
コード例 #10
0
 def test_filepath_relative(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 ../../testapp/create_package_basic/manifest.json"
     packstatus = commands.getstatusoutput(cmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(packstatus[0], 0)
コード例 #11
0
 def test_missing_manifest_path_relative(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 ../../testapp/start_url/"
     packstatus = commands.getstatusoutput(cmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(packstatus[0], 0)
コード例 #12
0
 def test_non_exist_path_absolute(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/non_exist_path/"
     packstatus = commands.getstatusoutput(cmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(packstatus[0], 0)
コード例 #13
0
 def test_non_exist_path_absolute(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/non_exist_path/"
     packstatus = commands.getstatusoutput(cmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(packstatus[0], 0)
コード例 #14
0
 def test_create_with_platform_android(self):
     comm.setUp()
     os.chdir(comm.TEMP_DATA_PATH)
     cmd = "crosswalk-app create " + comm.TEST_PROJECT_COMM + " --platforms=android"
     packstatus = commands.getstatusoutput(cmd)
     os.chdir(comm.TEST_PROJECT_COMM)
     buildcmd = "crosswalk-app build"
     comm.build(self, buildcmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(packstatus[0], 0)
コード例 #15
0
 def test_name_chinese(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     shutil.copyfile(comm.TEMP_DATA_PATH + "/../testapp/manifest_name_chinese/manifest.json", comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM + "/app/manifest.json")
     buildcmd = "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(buildstatus, 0)
コード例 #16
0
 def test_filepath_relative(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 ../../testapp/create_package_basic/manifest.json"
     packstatus = commands.getstatusoutput(cmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(packstatus[0], 0)
コード例 #17
0
 def test_packageID(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     with open(comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM +
               "/app/manifest.json") as json_file:
         data = json.load(json_file)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(data['xwalk_package_id'].strip(os.linesep),
                       comm.TEST_PROJECT_COMM)
コード例 #18
0
 def test_missing_manifest_path_relative(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 ../../testapp/start_url/"
     packstatus = commands.getstatusoutput(cmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(packstatus[0], 0)
コード例 #19
0
 def test_app_version_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     with open(comm.ConstPath + "/../tools/org.xwalk.test/app/manifest.json") as json_file:
         data = json.load(json_file)
     buildcmd = "crosswalk-app build"
     appVersion = comm.build(self, buildcmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(data['xwalk_app_version'].strip(os.linesep), "0.1")
     self.assertEquals(data['xwalk_app_version'].strip(os.linesep), appVersion)
コード例 #20
0
 def test_app_version_normal(self):
     comm.setUp()
     comm.create(self)
     os.chdir(comm.TEST_PROJECT_COMM)
     with open(comm.ConstPath +
               "/../tools/org.xwalk.test/app/manifest.json") as json_file:
         data = json.load(json_file)
     buildcmd = "crosswalk-app build"
     appVersion = comm.build(self, buildcmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(data['xwalk_app_version'].strip(os.linesep), "0.1")
     self.assertEquals(data['xwalk_app_version'].strip(os.linesep),
                       appVersion)
コード例 #21
0
 def test_display_invalid(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["display"] = "invalid"
     json.dump(jsonDict, open(comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM + "/app/manifest.json", "w"))
     buildcmd = "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertNotEquals(buildstatus, 0)
コード例 #22
0
 def test_build_path_normal(self):
     comm.setUp()
     comm.create(self)
     if os.path.exists("pkg"):
         shutil.rmtree("pkg")
     os.mkdir("pkg")
     os.chdir('pkg')
     buildcmd = "crosswalk-app build " + comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM
     comm.build(self, buildcmd)
     comm.run(self)
     os.chdir('../')
     shutil.rmtree("pkg")
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     comm.delete()
コード例 #23
0
 def test_app_version_out_of_range(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"] = "1000"
     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)
コード例 #24
0
 def test_no_packageID(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.pop("xwalk_package_id")
     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)
コード例 #25
0
 def test_build_path_normal(self):
     comm.setUp()
     comm.create(self)
     if os.path.exists("pkg"):
         shutil.rmtree("pkg")
     os.mkdir("pkg")
     os.chdir('pkg')
     buildcmd = "crosswalk-app build " + comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM
     comm.build(self, buildcmd)
     comm.run(self)
     os.chdir('../')
     shutil.rmtree("pkg")
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     comm.delete()
コード例 #26
0
 def test_name_special_characters(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["name"] = "/n"
     json.dump(jsonDict, open(comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM + "/app/manifest.json", "w"))
     buildcmd = "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(buildstatus, 0)
コード例 #27
0
 def test_start_url_noexist(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["start_url"] = "http://www.noexist.com"
     json.dump(jsonDict, open(comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM + "/app/manifest.json", "w"))
     buildcmd = "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(buildstatus, 0)
コード例 #28
0
 def test_dir_exist(self):
     try:
         comm.setUp()
         os.chdir(comm.TEMP_DATA_PATH)
         os.mkdir(comm.TEST_PROJECT_COMM)
         cmd = "crosswalk-app create " + comm.TEST_PROJECT_COMM
         packstatus = commands.getstatusoutput(cmd)
         '''
         2048 return from packstatus, is directory already exist
         '''
         self.assertEquals(packstatus[0], 2048)
         comm.cleanTempData(comm.TEST_PROJECT_COMM)
     except Exception,e:
         print Exception,"Create org.xwalk.testlinux error:",e
         sys.exit(1)
コード例 #29
0
 def test_dir_exist(self):
     try:
         comm.setUp()
         os.chdir(comm.TEMP_DATA_PATH)
         os.mkdir(comm.TEST_PROJECT_COMM)
         cmd = "crosswalk-app create " + comm.TEST_PROJECT_COMM
         packstatus = commands.getstatusoutput(cmd)
         '''
         2048 return from packstatus, is directory already exist
         '''
         self.assertNotEquals(packstatus[0], 0)
         comm.cleanTempData(comm.TEST_PROJECT_COMM)
     except Exception as e:
         print Exception, "Create org.xwalk.testlinux error:", e
         sys.exit(1)
コード例 #30
0
 def test_app_version_twodot(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.1"
     json.dump(jsonDict, open(comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM + "/app/manifest.json", "w"))
     buildcmd = "crosswalk-app build"
     appVersion = comm.build(self, buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals("0.0.1", appVersion)
コード例 #31
0
 def test_path_relative(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 ../../testapp/create_package_basic/"
     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)
コード例 #32
0
 def test_missing_icon_startUrl(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 -p deb " + comm.SCRIPT_DIR_NAME + "/../testapp/create_package_missing_icon_startUrl/"
     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)
コード例 #33
0
 def test_path_relative(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 ../../testapp/create_package_basic/"
     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)
コード例 #34
0
 def test_missing_icon_startUrl(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 -p deb " + comm.SCRIPT_DIR_NAME + "/../testapp/create_package_missing_icon_startUrl/"
     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)
コード例 #35
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_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("target android", packstatus[1])
コード例 #37
0
 def test_check_log(self):
     comm.setUp()
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     os.chdir(comm.TEMP_DATA_PATH)
     createcmd = "crosswalk-app create " + comm.TEST_PROJECT_COMM
     createstatus = commands.getstatusoutput(createcmd)
     create_common = open(
         comm.TEMP_DATA_PATH +
         "/../tools/" +
         comm.TEST_PROJECT_COMM +
         "/log/common.log",
         'r')
     create_android = open(
         comm.TEMP_DATA_PATH +
         "/../tools/" +
         comm.TEST_PROJECT_COMM +
         "/log/deb.log",
         'r')
     create_common_log = create_common.read().strip("\n\t")
     create_android_log = create_android.read().strip("\n\t")
     os.chdir(comm.TEST_PROJECT_COMM)
     buildcmd = "crosswalk-app build"
     buildstatus = commands.getstatusoutput(buildcmd)
     build_common = open(
         comm.TEMP_DATA_PATH +
         "/../tools/" +
         comm.TEST_PROJECT_COMM +
         "/log/common.log",
         'r')
     build_android = open(
         comm.TEMP_DATA_PATH +
         "/../tools/" +
         comm.TEST_PROJECT_COMM +
         "/log/deb.log",
         'r')
     build_common_log = build_common.read().strip("\n\t")
     build_android_log = build_android.read().strip("\n\t")
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertIn(createstatus[1].split('\n')[0], create_common_log)
     self.assertIn("Created project directory", create_android_log)
     self.assertIn(buildstatus[1].split('\n')[0], build_common_log)
     self.assertIn("build", build_android_log)
コード例 #38
0
 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)
コード例 #39
0
 def test_keep_project_k(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 -k " + comm.SCRIPT_DIR_NAME + "/../testapp/create_package_basic/"
     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)
     projectDir = packstatus[1].split(" * " + os.linesep)[-1].split(' ')[-1].strip(os.linesep)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(debLength, 1)
     self.assertIn("app", os.listdir(projectDir))
     self.assertIn("prj", os.listdir(projectDir))
コード例 #40
0
 def test_reading_manifest(self):
     comm.setUp()
     os.chdir(comm.TEMP_DATA_PATH)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     os.mkdir(comm.TEST_PROJECT_COMM)
     if os.path.exists(comm.ConstPath + "/../testapp/start_url/manifest.json"):
         os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     os.chdir(comm.TEST_PROJECT_COMM)
     cmd = 'crosswalk-pkg --platforms=deb -m "{ """xwalk_package_id""": """org.xwalk.test""", """start_url""": """start.html""" }" ' + comm.SCRIPT_DIR_NAME + "/../testapp/start_url/"
     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)
     os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(debLength, 1)
コード例 #41
0
 def test_reading_manifest(self):
     comm.setUp()
     os.chdir(comm.TEMP_DATA_PATH)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     os.mkdir(comm.TEST_PROJECT_COMM)
     if os.path.exists(comm.ConstPath +
                       "/../testapp/start_url/manifest.json"):
         os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     os.chdir(comm.TEST_PROJECT_COMM)
     cmd = 'crosswalk-pkg --platforms=deb -m "{ """xwalk_package_id""": """org.xwalk.test""", """start_url""": """start.html""" }" ' + comm.SCRIPT_DIR_NAME + "/../testapp/start_url/"
     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)
     os.remove(comm.ConstPath + "/../testapp/start_url/manifest.json")
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(debLength, 1)
コード例 #42
0
 def test_app_version_twodot(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.1"
     json.dump(
         jsonDict,
         open(
             comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM +
             "/app/manifest.json", "w"))
     buildcmd = "crosswalk-app build"
     appVersion = comm.build(self, buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals("0.0.1", appVersion)
コード例 #43
0
 def test_start_url_noexist(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["start_url"] = "http://www.noexist.com"
     json.dump(
         jsonDict,
         open(
             comm.TEMP_DATA_PATH + comm.TEST_PROJECT_COMM +
             "/app/manifest.json", "w"))
     buildcmd = "crosswalk-app build"
     buildstatus = os.system(buildcmd)
     comm.run(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(buildstatus, 0)
コード例 #44
0
 def test_keep_project_k(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 -k " + comm.SCRIPT_DIR_NAME + "/../testapp/create_package_basic/"
     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)
     projectDir = packstatus[1].split(" * " +
                                      os.linesep)[-1].split(' ')[-1].strip(
                                          os.linesep)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
     self.assertEquals(packstatus[0], 0)
     self.assertEquals(debLength, 1)
     self.assertIn("app", os.listdir(projectDir))
     self.assertIn("prj", os.listdir(projectDir))
コード例 #45
0
 def test_normal(self):
     comm.create(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)
コード例 #46
0
 def test_normal(self):
     comm.create(self)
     comm.cleanTempData(comm.TEST_PROJECT_COMM)