• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3.4
2#
3#   Copyright 2018 - Google
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16"""
17    Test Script for ViWiFi live call test
18"""
19
20from acts.test_decorators import test_tracker_info
21from acts.libs.utils.multithread import multithread_func
22from acts_contrib.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
23from acts_contrib.test_utils.tel.tel_defines import VT_STATE_BIDIRECTIONAL
24from acts_contrib.test_utils.tel.tel_defines import WFC_MODE_WIFI_PREFERRED
25from acts_contrib.test_utils.tel.tel_phone_setup_utils import phone_setup_iwlan
26from acts_contrib.test_utils.tel.tel_video_utils import is_phone_in_call_viwifi_bidirectional
27from acts_contrib.test_utils.tel.tel_video_utils import video_call_setup_teardown
28
29DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION = 1 * 60 * 60  # default 1 hour
30
31
32class TelWifiVideoTest(TelephonyBaseTest):
33    def setup_class(self):
34        super().setup_class()
35
36        self.stress_test_number = self.get_stress_test_number()
37
38        self.long_duration_call_total_duration = self.user_params.get(
39            "long_duration_call_total_duration",
40            DEFAULT_LONG_DURATION_CALL_TOTAL_DURATION)
41
42    """ Tests Begin """
43
44    @test_tracker_info(uuid="375e9b88-8d8e-45fe-8502-e4da4147682d")
45    @TelephonyBaseTest.tel_test_wrap
46    def test_call_video_to_video_wifi_preferred(self):
47        """ Test ViWifi<->ViWifi call functionality.
48
49        Make Sure PhoneA is in iWLAN mode (with Video Calling).
50        Make Sure PhoneB is in iWLAN mode (with Video Calling).
51        Connect to Wifi
52        Call from PhoneA to PhoneB as Bi-Directional Video,
53        Accept on PhoneB as video call, hang up on PhoneA.
54
55        Returns:
56            True if pass; False if fail.
57        """
58        ads = self.android_devices
59        tasks = [
60            (phone_setup_iwlan,
61             (self.log, ads[0], False, WFC_MODE_WIFI_PREFERRED,
62              self.wifi_network_ssid, self.wifi_network_pass)),
63            (phone_setup_iwlan,
64             (self.log, ads[1], False, WFC_MODE_WIFI_PREFERRED,
65              self.wifi_network_ssid, self.wifi_network_pass)),
66        ]
67        if not multithread_func(self.log, tasks):
68            self.log.error("Phone Failed to Set Up Properly.")
69            return False
70
71        if not video_call_setup_teardown(
72                self.log,
73                ads[0],
74                ads[1],
75                ads[0],
76                video_state=VT_STATE_BIDIRECTIONAL,
77                verify_caller_func=is_phone_in_call_viwifi_bidirectional,
78                verify_callee_func=is_phone_in_call_viwifi_bidirectional):
79            self.log.error("Failed to setup+teardown a call")
80            return False
81
82        return True
83
84    @test_tracker_info(uuid="0c6782b4-fa81-4c18-a7bf-9f0f5cc05d6d")
85    @TelephonyBaseTest.tel_test_wrap
86    def test_call_video_to_video_wifi_preferred_apm(self):
87        """ Test ViWifi<->ViWifi call functionality in APM Mode.
88
89        Make Sure PhoneA is in iWLAN mode (with Video Calling).
90        Make Sure PhoneB is in iWLAN mode (with Video Calling).
91        Turn on APM Mode
92        Connect to Wifi
93        Call from PhoneA to PhoneB as Bi-Directional Video,
94        Accept on PhoneB as video call, hang up on PhoneA.
95
96        Returns:
97            True if pass; False if fail.
98        """
99        ads = self.android_devices
100        tasks = [
101            (phone_setup_iwlan,
102             (self.log, ads[0], True, WFC_MODE_WIFI_PREFERRED,
103              self.wifi_network_ssid, self.wifi_network_pass)),
104            (phone_setup_iwlan,
105             (self.log, ads[1], True, WFC_MODE_WIFI_PREFERRED,
106              self.wifi_network_ssid, self.wifi_network_pass)),
107        ]
108        if not multithread_func(self.log, tasks):
109            self.log.error("Phone Failed to Set Up Properly.")
110            return False
111
112        if not video_call_setup_teardown(
113                self.log,
114                ads[0],
115                ads[1],
116                ads[0],
117                video_state=VT_STATE_BIDIRECTIONAL,
118                verify_caller_func=is_phone_in_call_viwifi_bidirectional,
119                verify_callee_func=is_phone_in_call_viwifi_bidirectional):
120            self.log.error("Failed to setup+teardown a call")
121            return False
122
123        return True
124
125
126""" Tests End """
127