1#!/usr/bin/env python3 2# Copyright (C) 2023 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 ShellTransitions(TestSuite): 23 24 def test_has_expected_transition_rows(self): 25 return DiffTestBlueprint( 26 trace=Path('shell_transitions.textproto'), 27 query=""" 28 SELECT 29 id, transition_id 30 FROM 31 window_manager_shell_transitions; 32 """, 33 out=Csv(""" 34 "id","transition_id" 35 0,7 36 1,10 37 2,11 38 3,8 39 4,9 40 5,12 41 """)) 42 43 def test_has_expected_transition_args(self): 44 return DiffTestBlueprint( 45 trace=Path('shell_transitions_simple_merge.textproto'), 46 query=""" 47 SELECT 48 args.key, args.display_value 49 FROM 50 window_manager_shell_transitions JOIN args ON window_manager_shell_transitions.arg_set_id = args.arg_set_id 51 WHERE window_manager_shell_transitions.transition_id = 15 52 ORDER BY args.key; 53 """, 54 out=Csv(""" 55 "key","display_value" 56 "create_time_ns","2187614568227" 57 "dispatch_time_ns","2187673373973" 58 "finish_time_ns","2188195968659" 59 "finish_transaction_id","5738076308938" 60 "flags","0" 61 "handler","2" 62 "id","15" 63 "send_time_ns","2187671767120" 64 "start_transaction_id","5738076308937" 65 "starting_window_remove_time_ns","2188652838898" 66 "targets[0].flags","0" 67 "targets[0].layer_id","244" 68 "targets[0].mode","1" 69 "targets[0].window_id","219481253" 70 "targets[1].flags","1" 71 "targets[1].layer_id","47" 72 "targets[1].mode","4" 73 "targets[1].window_id","54474511" 74 "type","1" 75 """)) 76 77 def test_has_shell_handlers(self): 78 return DiffTestBlueprint( 79 trace=Path('shell_handlers.textproto'), 80 query=""" 81 SELECT 82 handler_id, handler_name 83 FROM 84 window_manager_shell_transition_handlers; 85 """, 86 out=Csv(""" 87 "handler_id","handler_name" 88 1,"DefaultTransitionHandler" 89 2,"RecentsTransitionHandler" 90 3,"FreeformTaskTransitionHandler" 91 """)) 92