1#!/usr/bin/env python3.4
2#
3#   Copyright 2016 - 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 VT Data test
18"""
19from acts.test_utils.tel.TelephonyBaseTest import TelephonyBaseTest
20from acts.test_utils.tel.tel_defines import VT_STATE_BIDIRECTIONAL
21from acts.test_utils.tel.tel_test_utils import hangup_call
22from acts.test_utils.tel.tel_test_utils import multithread_func
23from acts.test_utils.tel.tel_test_utils import verify_http_connection
24from acts.test_utils.tel.tel_video_utils import \
25    is_phone_in_call_video_bidirectional
26from acts.test_utils.tel.tel_video_utils import phone_setup_video
27from acts.test_utils.tel.tel_video_utils import video_call_setup_teardown
28
29
30class TelLiveVideoDataTest(TelephonyBaseTest):
31    def setup_class(self):
32        super().setup_class()
33
34        self.stress_test_number = self.get_stress_test_number()
35        self.number_of_devices = 2
36
37    """ Tests Begin """
38
39    @TelephonyBaseTest.tel_test_wrap
40    def test_internet_access_during_video_call(self):
41        """ Test Internet access during VT<->VT call.
42
43        Make Sure PhoneA is in LTE mode (with Video Calling).
44        Make Sure PhoneB is in LTE mode (with Video Calling).
45        Call from PhoneA to PhoneB as Bi-Directional Video,
46        Accept on PhoneB as video call.
47        Verify PhoneA have Internet access.
48        Hang up on PhoneA.
49
50        Returns:
51            True if pass; False if fail.
52        """
53        ads = self.android_devices
54        tasks = [(phone_setup_video, (self.log, ads[0])), (phone_setup_video,
55                                                           (self.log, ads[1]))]
56        if not multithread_func(self.log, tasks):
57            self.log.error("Phone Failed to Set Up Properly.")
58            return False
59
60        self.log.info("Step1: Make MO VT call.")
61        if not video_call_setup_teardown(
62                self.log,
63                ads[0],
64                ads[1],
65                None,
66                video_state=VT_STATE_BIDIRECTIONAL,
67                verify_caller_func=is_phone_in_call_video_bidirectional,
68                verify_callee_func=is_phone_in_call_video_bidirectional):
69            self.log.error("Failed to setup+teardown a call")
70            return False
71
72        self.log.info("Step2: Verify Internet on PhoneA.")
73        if not verify_http_connection(self.log, ads[0]):
74            self.log.error("Verify Internet on PhoneA failed.")
75            return False
76
77        return hangup_call(self.log, ads[0])
78
79
80""" Tests End """
81