1#!/usr/bin/env python3 2# 3# Copyright 2019 - The Android Open Source Project 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 17from acts.test_utils.instrumentation.power import instrumentation_power_test 18from acts.test_utils.instrumentation.device.apps.dismiss_dialogs import \ 19 DialogDismissalUtil 20 21 22class ImageCaptureTest(instrumentation_power_test.InstrumentationPowerTest): 23 """ 24 Test class for running instrumentation test CameraTests#testImageCapture. 25 """ 26 27 def _prepare_device(self): 28 super()._prepare_device() 29 self.mode_airplane() 30 self.base_device_configuration() 31 self._dialog_util = DialogDismissalUtil( 32 self.ad_dut, 33 self.get_file_from_config('dismiss_dialogs_apk') 34 ) 35 self._dialog_util.dismiss_dialogs('GoogleCamera') 36 37 def _cleanup_device(self): 38 self._dialog_util.close() 39 super()._cleanup_device() 40 41 def test_capture_photos(self): 42 """Measures power during photo capture.""" 43 self.run_and_measure( 44 'com.google.android.platform.powertests.CameraTests', 45 'testImageCapture', req_params=['hdr_mode']) 46 self.validate_power_results() 47