Use std::string for test expresslog std::map
In ag/29575518, we wrapped expresslog Counter calls with an std::function to help with testing. In the tests, we used a map, with the key being the Counter key as a char*, and the value being the aggregated count. This approach caused test failures when we try to enable the flag in trunk_staging. After investigation, we realized that this is caused because the key of the std::map is the literal pointer (char*), meaning that the same string literals may be counted as different std::map keys in the test map. To mitigate this, we're now using std::string as the test map key type instead. Because the hash/equality of std::string depend on the string's content (instead of the pointer), the test issues are expected to resolve. Bug: 370353565 Test: atest RotaryEncoderInputMapperTest Flag: com.android.input.flags.rotary_input_telemetry Change-Id: Ibc89aeaf96e4627876929b76fe40b4a4a535b3df
Loading
Please register or sign in to comment