1#!/usr/bin/env python3 2# Copyright (C) 2024 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License a 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16from python.generators.diff_tests.testing import Path 17from python.generators.diff_tests.testing import Csv 18from python.generators.diff_tests.testing import DiffTestBlueprint 19from python.generators.diff_tests.testing import TestSuite 20 21 22class InputMethodManagerService(TestSuite): 23 24 def test_has_expected_rows(self): 25 return DiffTestBlueprint( 26 trace=Path('inputmethod_manager_service.textproto'), 27 query=""" 28 INCLUDE PERFETTO MODULE android.winscope.inputmethod; 29 SELECT 30 id, ts 31 FROM 32 android_inputmethod_manager_service; 33 """, 34 out=Csv(""" 35 "id","ts" 36 0,39998329771 37 1,40003054136 38 """)) 39 40 def test_has_expected_args(self): 41 return DiffTestBlueprint( 42 trace=Path('inputmethod_manager_service.textproto'), 43 query=""" 44 INCLUDE PERFETTO MODULE android.winscope.inputmethod; 45 SELECT 46 args.key, args.display_value 47 FROM 48 android_inputmethod_manager_service AS imms JOIN args ON imms.arg_set_id = args.arg_set_id 49 WHERE imms.id = 0 50 ORDER BY args.key; 51 """, 52 out=Csv(""" 53 "key","display_value" 54 "input_method_manager_service.bound_to_method","true" 55 "input_method_manager_service.cur_attribute.package_name","com.google.android.apps.nexuslauncher" 56 "input_method_manager_service.cur_client","ClientState{6c16bdd mUid=10254 mPid=2790 mSelfReportedDisplayId=0}" 57 "input_method_manager_service.cur_focused_window_name","a74954b com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity" 58 "input_method_manager_service.cur_focused_window_soft_input_mode","STATE_UNSPECIFIED|ADJUST_NOTHING|IS_FORWARD_NAVIGATION" 59 "input_method_manager_service.cur_id","com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME" 60 "input_method_manager_service.cur_method_id","com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME" 61 "input_method_manager_service.cur_seq","1" 62 "input_method_manager_service.cur_token","android.os.Binder@3abdbc4" 63 "input_method_manager_service.have_connection","true" 64 "input_method_manager_service.is_interactive","true" 65 "input_method_manager_service.last_ime_target_window_name","a74954b com.google.android.apps.nexuslauncher/com.google.android.apps.nexuslauncher.NexusLauncherActivity" 66 "input_method_manager_service.system_ready","true" 67 "where","InputMethodManagerService#startInputOrWindowGainedFocus" 68 """)) 69 70 def test_table_has_raw_protos(self): 71 return DiffTestBlueprint( 72 trace=Path('inputmethod_manager_service.textproto'), 73 query=""" 74 INCLUDE PERFETTO MODULE android.winscope.inputmethod; 75 SELECT COUNT(*) FROM __intrinsic_inputmethod_manager_service 76 WHERE base64_proto_id IS NOT NULL 77 """, 78 out=Csv(""" 79 "COUNT(*)" 80 2 81 """)) 82