Ejemplo n.º 1
0
    def test_suspend_resume_50_times(self):
        cycles = 50
        self.bt = BTSetting()
        self.wifi = WifiSetting()
        self.camera = Camera()
        self.music = CleanMusic()
        self.camera.grant_permissions()
        self.music.install()
        self.music.grant_permissions()
        music_file = self.music.push_artifactory_resource(
            "long_music", "/mnt/sdcard/Music")

        alias = self.bt.get_host_alias()
        self.bt.host_setup()
        self.bt.switch_bt("ON")
        self.bt.bt_search(alias)
        self.bt.bt_pair(alias)
        self.wifi.connect_wifi_by_conf("wifisetting")
        assert self.wifi.check_wifi_connect()
        for i in range(1, 1 + cycles):
            print "Cycle: %s/%s" % (i, cycles)
            assert self.s0i3.suspend_resume(sleep_time=120,
                                            retry=1), "Not enter S0i3"
            time.sleep(100)
            assert self.bt.get_bt_status(), "BT is OFF"
            assert self.bt.get_paired_status(alias), "BT is not paired"
            assert self.wifi.check_wifi_connect(), "WiFi is not connected"
            if self.s0i3.get_product() == BXT_M:
                self.camera.launch()
                self.camera.click_shutter_button()
            self.music.play_audio("file://" + music_file)
            time.sleep(200)
Ejemplo n.º 2
0
 def test_get_location_after_resume(self):
     from testlib.em.settings import WifiSetting
     from testlib.em.apps import GeoLocation
     from testlib.em.settings import LocationSetting
     from testlib.em.tools import get_geo_location
     ls = LocationSetting()
     ls.switch_GPS("ON")
     ls.set_mode("High accuracy")
     actual_location = get_geo_location()
     geo = GeoLocation()
     geo.install()
     geo.grant_permissions()
     wifi = WifiSetting()
     wifi.connect_wifi_by_conf("wifisetting")
     assert wifi.check_wifi_connect()
     enter_s3 = self.s0i3.suspend_resume(retry = 2)
     assert enter_s3
     location = geo.get_latitude_longitude()
     if location:
         diff_lati = abs(actual_location[0] - location[0])
         diff_long = abs(actual_location[1] - location[1])
         assert diff_lati < 0.1
         assert diff_long < 0.1
     else:
         assert False, "Can not get location info"
Ejemplo n.º 3
0
 def test_system_resume_wifi_on(self):
     print "[RunTest]: %s" % self.__str__()
     from testlib.em.settings import WifiSetting
     wifi = WifiSetting()
     wifi.switch_wifi("ON")
     stat_inc = self.s0ix.suspend_resume()
     assert stat_inc > 0, "Not enter S3"
     assert wifi.get_wifi_status()
Ejemplo n.º 4
0
 def test_enter_s0i3_wifi_bt_gps_on(self):
     from testlib.em.settings import WifiSetting, BTSetting, LocationSetting
     wifi = WifiSetting()
     bt = BTSetting()
     gps = LocationSetting()
     wifi.switch_wifi("ON")
     bt.switch_bt("ON")
     gps.switch_GPS("ON")
     time.sleep(2)
     stat_inc = self.s0ix.suspend_resume()
     bt.switch_bt("OFF")
     gps.switch_GPS("OFF")
     assert stat_inc > 0, "Not enter S3"
Ejemplo n.º 5
0
 def set_mixedmode(self, status):
     from testlib.em.settings import AirplaneModeSetting, WifiSetting, \
         BTSetting, LocationSetting
     AirplaneModeSetting().switch_airplane(status)
     WifiSetting().switch_wifi(status)
     BTSetting().switch_bt(status)
     LocationSetting().switch_GPS(status)
Ejemplo n.º 6
0
 def test_power_off_downloadingfrombrowser(self):
     from testlib.em.apps import EMToolsDownload
     from testlib.em.tools import get_server_ip, get_config_value
     from testlib.em.settings import WifiSetting
     url = "http://" + get_server_ip() + get_config_value(
         "webpage", "big_file")
     # connect wifi
     wifi = WifiSetting()
     wifi.connect_wifi_by_conf("wifi_adb")
     em = EMToolsDownload()
     em.install()
     em.grant_permissions()
     em.download_file(url)
     time.sleep(5)
     assert em.get_download_file_status()
     self.common_reboot()
Ejemplo n.º 7
0
 def setUp(self):
     self._test_name = __name__
     print "[Setup]: %s" % self._test_name
     #self.relay = get_relay_obj()
     self.s0ix = get_s0ix_obj()
     self.serverip = get_server_ip()
     assert self.serverip != ""
     self.garage = GarageModeTest()
     self.garage.adb_root()
     self.garage.install()
     self.garage.clean_download_folder()
     self.garage.grant_permissions()
     self.wifi = WifiSetting()
     self.wifi.connect_wifi_by_conf("wifi_adb")
     assert self.wifi.check_wifi_connect()
     self.ds = DateSetting()
     self.ds.set_property()
     super(Garage, self).setUp()
Ejemplo n.º 8
0
 def test_thermal_30min_idle(self):
     """
     Thermal check Idle 30 minutes
     """
     print "[RunTest]: %s" % self.__str__()
     from testlib.em.settings import WifiSetting
     WifiSetting().switch_wifi("ON")
     time.sleep(1800)
     self.check_thermal()
Ejemplo n.º 9
0
 def check_s0i3_browser(self, url, data_type=None):
     #WifiSetting().connect_wifi_by_conf("wifi_adb")
     WifiSetting().switch_wifi("off")
     self.browser.open_url(url)
     #if data_type == "audio":
     #    self.browser.play_audio_browser()
     #elif data_type == "video":
     #    self.browser.play_video_browser()
     enter_s3 = S0i3().check_enter_s0i3_state()
     assert enter_s3, "Not enter S0i3 state"
Ejemplo n.º 10
0
    def test_ivi_thermal_video_streaming(self):
        print "[RunTest]: %s" % self.__str__()
        from testlib.em.apps import VideoPlayer
        from testlib.em.settings import WifiSetting
        WifiSetting().connect_wifi_by_conf("wifi_adb")
        self.player = VideoPlayer()
        self.ivi_capture_thermal_data()
        video_url = "http://" + get_server_ip() + get_config_value(
            "webpage", "video_streaming")

        self.player.play_http_video(video_url)
        self.verify_thermal_in_scenarial("Video_streaming")
Ejemplo n.º 11
0
 def connect_wifi(self):
     wifi = WifiSetting()
     wifi.connect_wifi_by_conf("wifi_adb")
     assert wifi.check_wifi_connect()
Ejemplo n.º 12
0
class Garage(UIATestBase):
    def setUp(self):
        self._test_name = __name__
        print "[Setup]: %s" % self._test_name
        #self.relay = get_relay_obj()
        self.s0ix = get_s0ix_obj()
        self.serverip = get_server_ip()
        assert self.serverip != ""
        self.garage = GarageModeTest()
        self.garage.adb_root()
        self.garage.install()
        self.garage.clean_download_folder()
        self.garage.grant_permissions()
        self.wifi = WifiSetting()
        self.wifi.connect_wifi_by_conf("wifi_adb")
        assert self.wifi.check_wifi_connect()
        self.ds = DateSetting()
        self.ds.set_property()
        super(Garage, self).setUp()

    def tearDown(self):
        print "[Teardown]: %s" % self._test_name
        #super(Garage, self).tearDown()

    def check_download_task_in_garage_mode(self,
                                           url,
                                           sleep_time,
                                           time_to_set="23:59"):
        self.ds.set_time(time_to_set)
        download_list = self.garage.schedule_job(20, url)
        self.s0ix.sleep(sleep_time)
        #assert enter_s3
        wake_time = self.garage.get_time()
        start_time = self.garage.get_job_event_time("start")
        if not start_time:
            assert False, "Job not started"
        print "Job started at %s:%s:%s" % start_time
        h, m, s = start_time
        assert h == 0 and m == 0, "Job start time error"

        finished_time = self.garage.get_job_event_time("finished")
        if not finished_time:
            assert False, "Job not finished"
        print "Job finished at %s:%s:%s" % finished_time
        h, m, s = finished_time
        wake_h, wake_m, wake_s = map(int, wake_time.split(":"))
        print "Wake up at %s:%s:%s" % (wake_h, wake_m, wake_s)
        finished_time_seconds = 3600 * h + 60 * m + s
        wake_up_time_seconds = 3600 * wake_h + 60 * wake_m + wake_s
        assert finished_time_seconds < wake_up_time_seconds, "Job finished time error"

    def test_enter_garage_mode_parked_for_more_than_3_minutes(self):
        url_single = get_config_value("garage", "url_single")
        url_single = "http://" + self.serverip + url_single
        self.check_download_task_in_garage_mode(url_single, 120)

    def test_enter_garage_mode_parked_for_one_night(self):
        url_single = get_config_value("garage", "url_single")
        url_single = "http://" + self.serverip + url_single
        sleep_time = 12 * 3600
        seconds = 24 * 3600 + 300 - sleep_time
        h = seconds / 3600
        m = (seconds % 3600) / 60
        time_to_set = "%02d:%02d" % (h, m)
        self.check_download_task_in_garage_mode(url_single, sleep_time,
                                                time_to_set)

    def test_enter_garage_mode_downloaded_batch_files(self):
        url_batch = get_config_value("garage", "url_batch")
        url_batch = "http://" + self.serverip + url_batch
        self.check_download_task_in_garage_mode(url_batch, 200)

    def test_system_in_deep_sleep_mode_two_times(self):
        self.ds.set_time("23:59")
        stat_inc = self.s0ix.suspend_resume(120)
        assert stat_inc == 2

    def test_offline_data_sync_corrected(self):
        url_single = get_config_value("garage", "url_single")
        download_file_path = os.path.join(self.garage.download_folder,
                                          os.path.basename(url_single))
        md5sum_conf = get_config_value("garage", "md5sum")
        url_single = "http://" + self.serverip + url_single
        self.check_download_task_in_garage_mode(url_single, 120)
        md5sum = self.garage.get_md5sum(download_file_path)
        assert md5sum_conf == md5sum, "Download file error"