Ejemplo n.º 1
0
    def test_lte_only_http_dl(self):
        """Test for 1GB file download on WiFi Only

        Steps:
        1. Set WiFi atten to MIN and Cellular to MAX
        2. Start downloading 1GB file from net
        3. Verify is the download is successfull

        Expected Results:
        1. File should download over WiFi

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False
        self._atten_setup_lte_only()
        if (not wait_for_cell_data_connection(self.log, ad, True)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on LTE")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        ad.on_mobile_data = True
        if not active_file_download_test(self.log, ad, "512MB"):
            ad.log.error("HTTP file download failed on LTE")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        return True
Ejemplo n.º 2
0
    def test_wifi_cell_irat_stress_ping(self):
        """Test for data switch between WiFi and Cell. DUT go in and out WiFi
        coverage for multiple times.

        Steps:
        1. Set WiFi and Cellular signal to good (attenuation value to MIN).
        2. Make sure DUT get Cell data coverage (LTE) and WiFi connected.
        3. Set WiFi RSSI to MAX (WiFi attenuator value to MIN).
        4. Verify DUT report WiFi connected and Internet access OK.
        5. Set WiFi RSSI to MIN (WiFi attenuator value to MAX).
        6. Verify DUT report Cellular Data connected and Internet access OK.
        7. Repeat Step 3~6 for stress number.

        Expected Results:
        4. DUT report WiFi connected and Internet access OK.
        6. DUT report Cellular Data connected and Internet access OK.
        7. Stress test should pass.

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False

        total_iteration = self.stress_test_number
        self.log.info("Stress test. Total iteration = %d.", total_iteration)
        current_iteration = 1
        while (current_iteration <= total_iteration):
            self.log.info(">----Current iteration = %d/%d----<",
                          current_iteration, total_iteration)

            self._atten_setup_wifi_cell()
            if (not wait_for_wifi_data_connection(self.log, ad, True)
                    or not verify_internet_connection(self.log, ad)):
                ad.log.error("Data not on WiFi")
                get_telephony_signal_strength(ad)
                get_wifi_signal_strength(ad)
                break

            self._atten_setup_cell_only()
            if (not wait_for_cell_data_connection(self.log, ad, True)
                    or not verify_internet_connection(self.log, ad)):
                ad.log.error("Data not on Cell")
                get_telephony_signal_strength(ad)
                get_wifi_signal_strength(ad)
                break

            self.log.info(">----Iteration : %d/%d succeed.----<",
                          current_iteration, total_iteration)
            current_iteration += 1
        if current_iteration <= total_iteration:
            self.log.info(">----Iteration : %d/%d failed.----<",
                          current_iteration, total_iteration)
            return False
        else:
            return True
    def test_lte_oos_lte_camping(self):
        """Test for Out Of Service Scenarios

        Steps:
        1. Set WiFi and Cell available
        2. Setup Attenuator as No Service Scenario
        3. Verify there is no LTE or WiFi Signal
        4. Wait for 2 mins
        5. Setup Attenuator as Cellular only service
        6. Verify Data Connection

        Expected Results:
        1. Device should camp back on LTE after OOS
        2. Data should be in working state

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        if not self._basic_connectivity_check():
            self.log.error("Basic Connectivity Check Failed")
            return False
        self._atten_setup_no_service()
        ad.log.info("Waiting for 1 min")
        time.sleep(60)
        if (wait_for_cell_data_connection(self.log, ad, True) or
                wait_for_wifi_data_connection(self.log, ad, True)):
            ad.log.error("Data is available, Expecting no Cellular/WiFi Signal")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        ad.log.info("Waiting for 2 mins")
        time.sleep(120)
        self._atten_setup_lte_only()
        ad.on_mobile_data = True
        if (not wait_for_cell_data_connection(self.log, ad, True)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on LTE")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        return True
Ejemplo n.º 4
0
    def _wifi_cell_irat_task(self, ad, irat_wait_time=60):
        """
        Atten only WiFi to MIN and MAX
        WiFi --> Cellular
        """
        self._atten_setup_wifi_cell()
        if (not wait_for_wifi_data_connection(self.log, ad, True,
                                              irat_wait_time)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on WiFi")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False

        ad.log.info("Triggering WiFi to Cellular IRAT")
        self._atten_setup_cell_only()
        if (not wait_for_cell_data_connection(self.log, ad, True,
                                              irat_wait_time)
                or not verify_internet_connection(self.log, ad)):
            ad.log.error("Data not on Cell")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        return True
Ejemplo n.º 5
0
    def test_modem_power_poor_coverage(self):
        """Connectivity Monitor reports Poor Coverage to User

        Steps:
        1. Set WiFi, Cellular atten to MAX
        2. Wait for X amount of time
        3. Verify if the user gets a notification on UI

        Expected Results:
        1. User gets notification "Cellular battery issue: Poor coverage"

        Returns:
        True if Pass. False if fail.
        """
        ad = self.android_devices[0]
        # Ensure apk is installed
        monitor_apk = None
        for apk in ("com.google.telephonymonitor",
                    "com.google.android.connectivitymonitor"):
            if ad.is_apk_installed(apk):
                ad.log.info("apk %s is installed", apk)
                monitor_apk = apk
                break
        if not monitor_apk:
            ad.log.info(
                "ConnectivityMonitor|TelephonyMonitor is not installed")
            return False

        # Ensure apk is running
        ad.adb.shell("am start -n com.android.settings/.DevelopmentSettings",
                     ignore_status=True)
        for cmd in ("setprop persist.radio.enable_tel_mon user_enabled",
                    "setprop persist.radio.con_mon_hbeat 15000"):
            ad.log.info(cmd)
            ad.adb.shell(cmd)
        ad.log.info("reboot to bring up %s", monitor_apk)
        reboot_device(ad)
        for i in range(30):
            if ad.is_apk_running(monitor_apk):
                ad.log.info("%s is running after reboot", monitor_apk)
                break
            elif i == 19:
                ad.log.error("%s is not running after reboot", monitor_apk)
                return False
            else:
                ad.log.info(
                    "%s is not running after reboot. Wait and check again",
                    monitor_apk)
                time.sleep(30)

        # Setup all Notify Poor Coverage params
        for cmd in (
                "am broadcast -a "
                "com.google.gservices.intent.action.GSERVICES_OVERRIDE "
                "-e \"ce.cm.bi.c.notify_poor_coverage\" \"true\"",
                "am broadcast -a "
                "com.google.gservices.intent.action.GSERVICES_OVERRIDE "
                "-e \"ce.cm.bi.c.max_time_lowest_signal_strength_level_ms\" \"1\"",
                "am broadcast -a "
                "com.google.gservices.intent.action.GSERVICES_OVERRIDE "
                "-e \"ce.cm.bi.c.max_temperature_c\" \"1\"",
                "dumpsys battery set usb 0"):
            time.sleep(1)
            ad.log.info(cmd)
            ad.adb.shell(cmd)

        # Make Chamber ready for test
        self._atten_setup_no_service()
        ad.log.info("Waiting 1 min for attens to settle")
        time.sleep(60)
        if (wait_for_cell_data_connection(self.log, ad, True)
                or wait_for_wifi_data_connection(self.log, ad, True)):
            ad.log.error(
                "Data is available, Expecting no Cellular/WiFi Signal")
            get_telephony_signal_strength(ad)
            get_wifi_signal_strength(ad)
            return False
        ad.log.info("Wait time for 2 CM Heart Beats")
        time.sleep(60)
        ad.log.info("dumpsys battery set usb 1")
        ad.adb.shell("dumpsys battery set usb 1")
        if ad.search_logcat(
                "Bugreport notification title Cellular battery drain"):
            ad.log.info("User got Poor coverage notification")
        else:
            ad.log.error("User didn't get Poor coverage notification")
            result = False
        return True