def test_pack(self):
     comm.setUp()
     comm.check_appname()
     sample_src = "extensions-android"
     app_root = comm.sample_src_pref + sample_src
     xmlpath = app_root + '/xwalk-echo-extension-src/build.xml'
     init(xmlpath)
     cmd = "%s/build.sh" % app_root
     target_apk_path = comm.const_path + "/../testapp/"
     os.chdir(target_apk_path)
     print "Generate APK %s ----------------> START" % comm.app_name
     packstatus = commands.getstatusoutput(cmd)
     self.assertEquals(0, packstatus[0])
     self.assertIn("build successful", packstatus[1].lower())
     print "\nGenerate APK %s ----------------> OK\n" % comm.app_name
     apk_path = app_root + "/xwalk-echo-extension-src/lib/"
     for index, name in enumerate(os.listdir(apk_path)):
         if os.path.isdir(apk_path + "/" + name):
             apk_path += name
             for apk_index, apkname in enumerate(os.listdir(apk_path)):
                 if apk_index <= len(os.listdir(apk_path)) and \
                 apkname.endswith(".apk"):
                     os.chdir(apk_path)
                     self.assertTrue(apkname.startswith(comm.app_name))
                     print 'Found apk %s' % apkname
                     shutil.move(apkname, target_apk_path)
                 elif apkname.find(".apk") != -1:
                     print 'Continue'
         elif index > len(os.listdir(apk_path)) and \
         os.path.isdir(apk_path + "/" + name) == False:
             print 'Not found Crosswalk Runtime Binary'
             self.assertFalse('Not found Crosswalk Runtime Binary')
    def test_pack(self):
        comm.setUp()
        comm.check_appname()
        sample_src = "extensions-android"
        app_root = comm.sample_src_pref + sample_src
        xmlpath = app_root + '/xwalk-echo-extension-src/build.xml'
        init(xmlpath)
        cmd = "%s/build.sh -v %s -a %s - m %s" % (app_root, comm.xwalk_version, comm.ARCH, comm.MODE)
        target_apk_path = comm.const_path + "/../testapp/"
        os.chdir(target_apk_path)
        print "Generate APK %s ----------------> START" % comm.app_name
        packstatus = commands.getstatusoutput(cmd)
        self.assertEquals(0, packstatus[0])
        self.assertIn("build successful", packstatus[1].lower())
        print "\nGenerate APK %s ----------------> OK\n" % comm.app_name

        apk_build_flag = False
        apks = glob.glob(os.path.join(app_root, "*.apk"))
        if len(apks) > 0:
            apk_build_flag = True
            for apk in apks:
               shutil.move(apk, target_apk_path)
        else:
            print 'Not found apk'

        self.assertTrue(apk_build_flag)
    def test_uninstall_withAppRunning(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 | grep %s" % \
                (comm.app_name.lower(), comm.ARCH))[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.crosswalkproject.sample/.%sActivity" % comm.app_name
        comm.app_launch(cmd, self)
        time.sleep(2)

        # Uninstall the app
        cmduninst = "adb -s " + comm.device + \
            " uninstall org.crosswalkproject.sample"
        comm.app_uninstall(cmduninst, self)
 def test_launch(self):
     comm.setUp()
     comm.check_appname()
     cmd = "adb -s " + comm.device + " shell am start -n "\
     "org.crosswalkproject.sample/.%sActivity" % comm.app_name
     print cmd
     comm.app_launch(cmd, self)
    def test_pack(self):
        comm.setUp()
        comm.check_appname()
        sample_src = "extensions-android"
        app_root = comm.sample_src_pref + sample_src
        xmlpath = app_root + '/xwalk-echo-extension-src/build.xml'
        init(xmlpath)
        cmd = "%s/build.sh %s %s" % (app_root, comm.MODE, comm.ARCH)
        target_apk_path = comm.const_path + "/../testapp/"
        os.chdir(target_apk_path)
        print "Generate APK %s ----------------> START" % comm.app_name
        packstatus = commands.getstatusoutput(cmd)
        self.assertEquals(0, packstatus[0])
        self.assertIn("build successful", packstatus[1].lower())
        print "\nGenerate APK %s ----------------> OK\n" % comm.app_name

        apk_path = app_root + "/xwalk-echo-extension-src/lib/"
        apk_build_flag = False
        for index, name in enumerate(os.listdir(apk_path)):
            if os.path.isdir(apk_path + "/" + name):
                apk_path += name
                for apk_index, apkname in enumerate(os.listdir(apk_path)):
                    if apk_index <= len(os.listdir(apk_path)) and \
                    apkname.endswith(".apk") and apkname.startswith(comm.app_name):
                        print 'Found apk %s' % apkname
                        apk_build_flag = True
                        os.chdir(apk_path)
                        shutil.move(apkname, target_apk_path)
                    elif apkname.find(".apk") != -1:
                        print 'Continue'
            elif index > len(os.listdir(apk_path)) and \
            os.path.isdir(apk_path + "/" + name) == False:
                print 'Not found Crosswalk Runtime Binary'

        self.assertTrue(apk_build_flag)
 def test_install(self):
     comm.setUp()
     comm.check_appname()
     os.chdir(comm.const_path + "/../testapp/")
     apk_file = commands.getstatusoutput("ls | grep %s | grep %s" % \
         (comm.app_name, comm.ARCH))[1]
     cmd = "adb -s " + comm.device + " install -r " + apk_file
     print cmd
     cmdfind = "adb -s " + comm.device + \
         " shell pm list packages |grep org.crosswalkproject.sample"
     comm.app_install(cmd, cmdfind, self)
 def test_install(self):
     comm.setUp()
     comm.check_appname()
     os.chdir(comm.const_path + "/../testapp/")
     apk_file = commands.getstatusoutput("ls | grep %s | grep %s" % \
         (comm.app_name, comm.ARCH))[1]
     cmd = "adb -s " + comm.device + " install -r " + apk_file
     print cmd
     cmdfind = "adb -s " + comm.device + \
         " shell pm list packages |grep org.crosswalkproject.sample"
     comm.app_install(cmd, cmdfind, self)
Beispiel #8
0
 def test_stop(self):
     comm.setUp()
     comm.check_appname()
     # Find whether the app have launched
     cmdacti = "adb -s " + comm.device + \
         " shell dumpsys activity activities | grep "\
         "org.crosswalkproject.sample"
     launched = commands.getstatusoutput(cmdacti)
     if launched[0] != 0:
         print "Stop APK ---------------->%s App haven't launched,"\
         " need to launch it!" % comm.app_name
         cmdstart = "adb -s " + comm.device + " shell am start -n "\
         "org.crosswalkproject.sample/.%sActivity" % comm.app_name
         comm.app_launch(cmdstart, self)
         time.sleep(1)
     cmdstop = "adb -s " + comm.device + \
         " shell am force-stop org.crosswalkproject.sample"
 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_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_launch(self):
     comm.setUp()
     comm.check_appname()
     cmd = "adb -s " + comm.device + " shell am start -n " "org.crosswalkproject.sample/.%sActivity" % comm.app_name
     print cmd
     comm.app_launch(cmd, self)