• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 InputMethodService(TestSuite):
23
24  def test_has_expected_rows(self):
25    return DiffTestBlueprint(
26        trace=Path('inputmethod_service.textproto'),
27        query="""
28        INCLUDE PERFETTO MODULE android.winscope.inputmethod;
29        SELECT
30          id, ts
31        FROM
32          android_inputmethod_service;
33        """,
34        out=Csv("""
35        "id","ts"
36        0,61829562285
37        1,61831101307
38        """))
39
40  def test_has_expected_args(self):
41    return DiffTestBlueprint(
42        trace=Path('inputmethod_service.textproto'),
43        query="""
44        INCLUDE PERFETTO MODULE android.winscope.inputmethod;
45        SELECT
46          args.key, args.display_value
47        FROM
48          android_inputmethod_service AS ims JOIN args ON ims.arg_set_id = args.arg_set_id
49        WHERE ims.id = 0
50        ORDER BY args.key;
51        """,
52        out=Csv("""
53        "key","display_value"
54        "input_method_service.candidates_visibility","4"
55        "input_method_service.configuration","{1.0 ?mcc0mnc [en_US] ldltr sw411dp w411dp h842dp 420dpi nrml long hdr widecg port night finger -keyb/v/h -nav/h winConfig={ mBounds=Rect(0, 0 - 1080, 2400) mAppBounds=Rect(0, 128 - 1080, 2337) mMaxBounds=Rect(0, 0 - 1080, 2400) mDisplayRotation=ROTATION_0 mWindowingMode=fullscreen mDisplayWindowingMode=fullscreen mActivityType=undefined mAlwaysOnTop=undefined mRotation=ROTATION_0} s.11 fontWeightAdjustment=0}"
56        "input_method_service.input_binding","InputBinding{android.os.BinderProxy@cbb5415 / uid 10254 / pid 2812}"
57        "input_method_service.input_editor_info.package_name","com.google.android.apps.nexuslauncher"
58        "input_method_service.input_started","true"
59        "input_method_service.last_computed_insets.content_top_insets","126"
60        "input_method_service.last_computed_insets.touchable_insets","2"
61        "input_method_service.last_computed_insets.touchable_region","SkRegion()"
62        "input_method_service.settings_observer","SettingsObserver{mShowImeWithHardKeyboard=1}"
63        "input_method_service.soft_input_window.window_state","2"
64        "input_method_service.token","android.os.BinderProxy@50043d1"
65        "where","InputMethodService#doFinishInput"
66        """))
67
68  def test_table_has_raw_protos(self):
69    return DiffTestBlueprint(
70        trace=Path('inputmethod_service.textproto'),
71        query="""
72        INCLUDE PERFETTO MODULE android.winscope.inputmethod;
73        SELECT COUNT(*) FROM __intrinsic_inputmethod_service
74        WHERE base64_proto_id IS NOT NULL
75        """,
76        out=Csv("""
77        "COUNT(*)"
78        2
79        """))
80