Loading system/profile/avrcp/device.cc +3 −2 Original line number Diff line number Diff line Loading @@ -414,8 +414,9 @@ void Device::SetVolume(int8_t volume) { // TODO (apanicke): Implement logic for Multi-AVRCP DEVICE_VLOG(1) << __func__ << ": volume=" << (int)volume; if (volume == volume_) { DEVICE_VLOG(3) << __func__ << ": Ignoring volume change same as current volume level"; DEVICE_LOG(WARNING) << __func__ << ": Ignoring volume change same as current volume level"; return; } auto request = SetAbsoluteVolumeRequestBuilder::MakeBuilder(volume); Loading system/profile/avrcp/tests/avrcp_device_test.cc +13 −0 Original line number Diff line number Diff line Loading @@ -1351,6 +1351,19 @@ TEST_F(AvrcpDeviceTest, volumeRejectedTest) { EXPECT_CALL(response_cb, Call(_, _, _)).Times(0); } TEST_F(AvrcpDeviceTest, setVolumeOnceTest) { int vol = 0x48; auto set_abs_vol = SetAbsoluteVolumeRequestBuilder::MakeBuilder(vol); // Ensure that SetVolume only been call once. EXPECT_CALL(response_cb, Call(_, false, matchPacket(std::move(set_abs_vol)))) .Times(1); test_device->SetVolume(vol); test_device->SetVolume(vol); } TEST_F(AvrcpDeviceTest, playPushedActiveDeviceTest) { MockMediaInterface interface; NiceMock<MockA2dpInterface> a2dp_interface; Loading Loading
system/profile/avrcp/device.cc +3 −2 Original line number Diff line number Diff line Loading @@ -414,8 +414,9 @@ void Device::SetVolume(int8_t volume) { // TODO (apanicke): Implement logic for Multi-AVRCP DEVICE_VLOG(1) << __func__ << ": volume=" << (int)volume; if (volume == volume_) { DEVICE_VLOG(3) << __func__ << ": Ignoring volume change same as current volume level"; DEVICE_LOG(WARNING) << __func__ << ": Ignoring volume change same as current volume level"; return; } auto request = SetAbsoluteVolumeRequestBuilder::MakeBuilder(volume); Loading
system/profile/avrcp/tests/avrcp_device_test.cc +13 −0 Original line number Diff line number Diff line Loading @@ -1351,6 +1351,19 @@ TEST_F(AvrcpDeviceTest, volumeRejectedTest) { EXPECT_CALL(response_cb, Call(_, _, _)).Times(0); } TEST_F(AvrcpDeviceTest, setVolumeOnceTest) { int vol = 0x48; auto set_abs_vol = SetAbsoluteVolumeRequestBuilder::MakeBuilder(vol); // Ensure that SetVolume only been call once. EXPECT_CALL(response_cb, Call(_, false, matchPacket(std::move(set_abs_vol)))) .Times(1); test_device->SetVolume(vol); test_device->SetVolume(vol); } TEST_F(AvrcpDeviceTest, playPushedActiveDeviceTest) { MockMediaInterface interface; NiceMock<MockA2dpInterface> a2dp_interface; Loading