| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| 11 #include "chromeos/dbus/bluetooth_media_client.h" | |
| 12 #include "chromeos/dbus/bluetooth_media_endpoint_service_provider.h" | |
| 13 #include "chromeos/dbus/bluetooth_media_transport_client.h" | |
| 14 #include "chromeos/dbus/dbus_thread_manager.h" | |
| 15 #include "chromeos/dbus/fake_bluetooth_media_client.h" | |
| 16 #include "chromeos/dbus/fake_bluetooth_media_endpoint_service_provider.h" | |
| 17 #include "chromeos/dbus/fake_bluetooth_media_transport_client.h" | |
| 18 #include "dbus/object_path.h" | 11 #include "dbus/object_path.h" |
| 19 #include "device/bluetooth/bluetooth_adapter.h" | 12 #include "device/bluetooth/bluetooth_adapter.h" |
| 20 #include "device/bluetooth/bluetooth_adapter_factory.h" | 13 #include "device/bluetooth/bluetooth_adapter_factory.h" |
| 21 #include "device/bluetooth/bluetooth_audio_sink.h" | 14 #include "device/bluetooth/bluetooth_audio_sink.h" |
| 22 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h" | 15 #include "device/bluetooth/bluetooth_audio_sink_chromeos.h" |
| 16 #include "device/bluetooth/dbus/bluetooth_media_client.h" |
| 17 #include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h" |
| 18 #include "device/bluetooth/dbus/bluetooth_media_transport_client.h" |
| 19 #include "device/bluetooth/dbus/bluez_dbus_manager.h" |
| 20 #include "device/bluetooth/dbus/fake_bluetooth_media_client.h" |
| 21 #include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h
" |
| 22 #include "device/bluetooth/dbus/fake_bluetooth_media_transport_client.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 | 24 |
| 25 using dbus::ObjectPath; | 25 using dbus::ObjectPath; |
| 26 using device::BluetoothAdapter; | 26 using device::BluetoothAdapter; |
| 27 using device::BluetoothAdapterFactory; | 27 using device::BluetoothAdapterFactory; |
| 28 using device::BluetoothAudioSink; | 28 using device::BluetoothAudioSink; |
| 29 | 29 |
| 30 namespace chromeos { | 30 namespace chromeos { |
| 31 | 31 |
| 32 class TestAudioSinkObserver : public BluetoothAudioSink::Observer { | 32 class TestAudioSinkObserver : public BluetoothAudioSink::Observer { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 uint16_t read_mtu_; | 74 uint16_t read_mtu_; |
| 75 BluetoothAudioSink::State state_; | 75 BluetoothAudioSink::State state_; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 scoped_refptr<BluetoothAudioSink> audio_sink_; | 78 scoped_refptr<BluetoothAudioSink> audio_sink_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 class BluetoothAudioSinkChromeOSTest : public testing::Test { | 81 class BluetoothAudioSinkChromeOSTest : public testing::Test { |
| 82 public: | 82 public: |
| 83 void SetUp() override { | 83 void SetUp() override { |
| 84 DBusThreadManager::Initialize(); | 84 bluez::BluezDBusManager::Initialize(); |
| 85 | 85 |
| 86 callback_count_ = 0; | 86 callback_count_ = 0; |
| 87 error_callback_count_ = 0; | 87 error_callback_count_ = 0; |
| 88 | 88 |
| 89 fake_media_ = static_cast<FakeBluetoothMediaClient*>( | 89 fake_media_ = static_cast<bluez::FakeBluetoothMediaClient*>( |
| 90 DBusThreadManager::Get()->GetBluetoothMediaClient()); | 90 bluez::BluezDBusManager::Get()->GetBluetoothMediaClient()); |
| 91 fake_transport_ = static_cast<FakeBluetoothMediaTransportClient*>( | 91 fake_transport_ = static_cast<bluez::FakeBluetoothMediaTransportClient*>( |
| 92 DBusThreadManager::Get()->GetBluetoothMediaTransportClient()); | 92 bluez::BluezDBusManager::Get()->GetBluetoothMediaTransportClient()); |
| 93 | 93 |
| 94 // Initiates Delegate::TransportProperties with default values. | 94 // Initiates Delegate::TransportProperties with default values. |
| 95 properties_.device = | 95 properties_.device = ObjectPath( |
| 96 ObjectPath(FakeBluetoothMediaTransportClient::kTransportDevicePath); | 96 bluez::FakeBluetoothMediaTransportClient::kTransportDevicePath); |
| 97 properties_.uuid = BluetoothMediaClient::kBluetoothAudioSinkUUID; | 97 properties_.uuid = bluez::BluetoothMediaClient::kBluetoothAudioSinkUUID; |
| 98 properties_.codec = FakeBluetoothMediaTransportClient::kTransportCodec; | 98 properties_.codec = |
| 99 bluez::FakeBluetoothMediaTransportClient::kTransportCodec; |
| 99 properties_.configuration = | 100 properties_.configuration = |
| 100 FakeBluetoothMediaTransportClient::kTransportConfiguration; | 101 bluez::FakeBluetoothMediaTransportClient::kTransportConfiguration; |
| 101 properties_.state = BluetoothMediaTransportClient::kStateIdle; | 102 properties_.state = bluez::BluetoothMediaTransportClient::kStateIdle; |
| 102 properties_.delay.reset( | 103 properties_.delay.reset(new uint16_t( |
| 103 new uint16_t(FakeBluetoothMediaTransportClient::kTransportDelay)); | 104 bluez::FakeBluetoothMediaTransportClient::kTransportDelay)); |
| 104 properties_.volume.reset( | 105 properties_.volume.reset(new uint16_t( |
| 105 new uint16_t(FakeBluetoothMediaTransportClient::kTransportVolume)); | 106 bluez::FakeBluetoothMediaTransportClient::kTransportVolume)); |
| 106 | 107 |
| 107 GetAdapter(); | 108 GetAdapter(); |
| 108 } | 109 } |
| 109 | 110 |
| 110 void TearDown() override { | 111 void TearDown() override { |
| 111 callback_count_ = 0; | 112 callback_count_ = 0; |
| 112 error_callback_count_ = 0; | 113 error_callback_count_ = 0; |
| 113 observer_.reset(); | 114 observer_.reset(); |
| 114 | 115 |
| 115 fake_media_->SetVisible(true); | 116 fake_media_->SetVisible(true); |
| 116 | 117 |
| 117 // The adapter should outlive audio sink. | 118 // The adapter should outlive audio sink. |
| 118 audio_sink_ = nullptr; | 119 audio_sink_ = nullptr; |
| 119 adapter_ = nullptr; | 120 adapter_ = nullptr; |
| 120 DBusThreadManager::Shutdown(); | 121 bluez::BluezDBusManager::Shutdown(); |
| 121 } | 122 } |
| 122 | 123 |
| 123 // Gets the existing Bluetooth adapter. | 124 // Gets the existing Bluetooth adapter. |
| 124 void GetAdapter() { | 125 void GetAdapter() { |
| 125 BluetoothAdapterFactory::GetAdapter( | 126 BluetoothAdapterFactory::GetAdapter( |
| 126 base::Bind(&BluetoothAudioSinkChromeOSTest::GetAdapterCallback, | 127 base::Bind(&BluetoothAudioSinkChromeOSTest::GetAdapterCallback, |
| 127 base::Unretained(this))); | 128 base::Unretained(this))); |
| 128 } | 129 } |
| 129 | 130 |
| 130 // Called whenever BluetoothAdapter is retrieved successfully. | 131 // Called whenever BluetoothAdapter is retrieved successfully. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 EXPECT_EQ(error_callback_count_, 0); | 172 EXPECT_EQ(error_callback_count_, 0); |
| 172 EXPECT_EQ(observer_->state_changed_count_, 0); | 173 EXPECT_EQ(observer_->state_changed_count_, 0); |
| 173 EXPECT_EQ(observer_->volume_changed_count_, 0); | 174 EXPECT_EQ(observer_->volume_changed_count_, 0); |
| 174 } | 175 } |
| 175 | 176 |
| 176 void GetFakeMediaEndpoint() { | 177 void GetFakeMediaEndpoint() { |
| 177 BluetoothAudioSinkChromeOS* audio_sink_chromeos = | 178 BluetoothAudioSinkChromeOS* audio_sink_chromeos = |
| 178 static_cast<BluetoothAudioSinkChromeOS*>(audio_sink_.get()); | 179 static_cast<BluetoothAudioSinkChromeOS*>(audio_sink_.get()); |
| 179 ASSERT_NE(audio_sink_chromeos, nullptr); | 180 ASSERT_NE(audio_sink_chromeos, nullptr); |
| 180 | 181 |
| 181 media_endpoint_ = static_cast<FakeBluetoothMediaEndpointServiceProvider*>( | 182 media_endpoint_ = |
| 182 audio_sink_chromeos->GetEndpointServiceProvider()); | 183 static_cast<bluez::FakeBluetoothMediaEndpointServiceProvider*>( |
| 184 audio_sink_chromeos->GetEndpointServiceProvider()); |
| 183 } | 185 } |
| 184 | 186 |
| 185 // Called whenever RegisterAudioSink is completed successfully. | 187 // Called whenever RegisterAudioSink is completed successfully. |
| 186 void RegisterCallback( | 188 void RegisterCallback( |
| 187 scoped_refptr<BluetoothAudioSink> audio_sink) { | 189 scoped_refptr<BluetoothAudioSink> audio_sink) { |
| 188 ++callback_count_; | 190 ++callback_count_; |
| 189 audio_sink_ = audio_sink; | 191 audio_sink_ = audio_sink; |
| 190 | 192 |
| 191 GetFakeMediaEndpoint(); | 193 GetFakeMediaEndpoint(); |
| 192 ASSERT_NE(media_endpoint_, nullptr); | 194 ASSERT_NE(media_endpoint_, nullptr); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 void ErrorCallback() { | 226 void ErrorCallback() { |
| 225 ++error_callback_count_; | 227 ++error_callback_count_; |
| 226 } | 228 } |
| 227 | 229 |
| 228 protected: | 230 protected: |
| 229 int callback_count_; | 231 int callback_count_; |
| 230 int error_callback_count_; | 232 int error_callback_count_; |
| 231 | 233 |
| 232 base::MessageLoopForIO message_loop_; | 234 base::MessageLoopForIO message_loop_; |
| 233 | 235 |
| 234 FakeBluetoothMediaClient* fake_media_; | 236 bluez::FakeBluetoothMediaClient* fake_media_; |
| 235 FakeBluetoothMediaTransportClient* fake_transport_; | 237 bluez::FakeBluetoothMediaTransportClient* fake_transport_; |
| 236 FakeBluetoothMediaEndpointServiceProvider* media_endpoint_; | 238 bluez::FakeBluetoothMediaEndpointServiceProvider* media_endpoint_; |
| 237 scoped_ptr<TestAudioSinkObserver> observer_; | 239 scoped_ptr<TestAudioSinkObserver> observer_; |
| 238 scoped_refptr<BluetoothAdapter> adapter_; | 240 scoped_refptr<BluetoothAdapter> adapter_; |
| 239 scoped_refptr<BluetoothAudioSink> audio_sink_; | 241 scoped_refptr<BluetoothAudioSink> audio_sink_; |
| 240 | 242 |
| 241 // The default property set used while calling SetConfiguration on a media | 243 // The default property set used while calling SetConfiguration on a media |
| 242 // endpoint object. | 244 // endpoint object. |
| 243 BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties | 245 bluez::BluetoothMediaEndpointServiceProvider::Delegate::TransportProperties |
| 244 properties_; | 246 properties_; |
| 245 }; | 247 }; |
| 246 | 248 |
| 247 TEST_F(BluetoothAudioSinkChromeOSTest, RegisterSucceeded) { | 249 TEST_F(BluetoothAudioSinkChromeOSTest, RegisterSucceeded) { |
| 248 GetAudioSink(); | 250 GetAudioSink(); |
| 249 } | 251 } |
| 250 | 252 |
| 251 TEST_F(BluetoothAudioSinkChromeOSTest, RegisterFailedWithInvalidOptions) { | 253 TEST_F(BluetoothAudioSinkChromeOSTest, RegisterFailedWithInvalidOptions) { |
| 252 // Sets options with an invalid codec and valid capabilities. | 254 // Sets options with an invalid codec and valid capabilities. |
| 253 BluetoothAudioSink::Options options; | 255 BluetoothAudioSink::Options options; |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 | 779 |
| 778 EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_IDLE); | 780 EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_IDLE); |
| 779 EXPECT_EQ(callback_count_, 2); | 781 EXPECT_EQ(callback_count_, 2); |
| 780 EXPECT_EQ(error_callback_count_, 0); | 782 EXPECT_EQ(error_callback_count_, 0); |
| 781 EXPECT_EQ(observer_->state_changed_count_, 1); | 783 EXPECT_EQ(observer_->state_changed_count_, 1); |
| 782 EXPECT_EQ(observer_->volume_changed_count_, 1); | 784 EXPECT_EQ(observer_->volume_changed_count_, 1); |
| 783 | 785 |
| 784 // |kTransportVolume| is the initial volume of the transport, and this | 786 // |kTransportVolume| is the initial volume of the transport, and this |
| 785 // value is propagated to the audio sink via SetConfiguration. | 787 // value is propagated to the audio sink via SetConfiguration. |
| 786 EXPECT_EQ(audio_sink_->GetVolume(), | 788 EXPECT_EQ(audio_sink_->GetVolume(), |
| 787 FakeBluetoothMediaTransportClient::kTransportVolume); | 789 bluez::FakeBluetoothMediaTransportClient::kTransportVolume); |
| 788 | 790 |
| 789 // Changes volume to a valid level. | 791 // Changes volume to a valid level. |
| 790 fake_transport_->SetVolume(media_endpoint_->object_path(), 100); | 792 fake_transport_->SetVolume(media_endpoint_->object_path(), 100); |
| 791 | 793 |
| 792 EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_IDLE); | 794 EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_IDLE); |
| 793 EXPECT_EQ(observer_->state_changed_count_, 1); | 795 EXPECT_EQ(observer_->state_changed_count_, 1); |
| 794 EXPECT_EQ(observer_->volume_changed_count_, 2); | 796 EXPECT_EQ(observer_->volume_changed_count_, 2); |
| 795 EXPECT_EQ(audio_sink_->GetVolume(), 100); | 797 EXPECT_EQ(audio_sink_->GetVolume(), 100); |
| 796 | 798 |
| 797 // Changes volume to an invalid level. | 799 // Changes volume to an invalid level. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 message_loop_.RunUntilIdle(); | 837 message_loop_.RunUntilIdle(); |
| 836 | 838 |
| 837 // Acquire is called when the state of |audio_sink_| becomes STATE_PENDING, | 839 // Acquire is called when the state of |audio_sink_| becomes STATE_PENDING, |
| 838 // and Acquire will trigger state change. Therefore, the state will be | 840 // and Acquire will trigger state change. Therefore, the state will be |
| 839 // STATE_ACTIVE right after STATE_PENDING. | 841 // STATE_ACTIVE right after STATE_PENDING. |
| 840 // State: STATE_IDLE -> STATE_PENDING -> STATE_ACTIVE | 842 // State: STATE_IDLE -> STATE_PENDING -> STATE_ACTIVE |
| 841 EXPECT_EQ(observer_->state_changed_count_, 3); | 843 EXPECT_EQ(observer_->state_changed_count_, 3); |
| 842 EXPECT_EQ(observer_->total_read_, data_one.size()); | 844 EXPECT_EQ(observer_->total_read_, data_one.size()); |
| 843 EXPECT_EQ(observer_->data_, data_one); | 845 EXPECT_EQ(observer_->data_, data_one); |
| 844 EXPECT_EQ(observer_->read_mtu_, | 846 EXPECT_EQ(observer_->read_mtu_, |
| 845 FakeBluetoothMediaTransportClient::kDefaultReadMtu); | 847 bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu); |
| 846 } | 848 } |
| 847 | 849 |
| 848 // Tests the case where the remote device pauses and resume audio streaming. | 850 // Tests the case where the remote device pauses and resume audio streaming. |
| 849 TEST_F(BluetoothAudioSinkChromeOSTest, PauseAndResume) { | 851 TEST_F(BluetoothAudioSinkChromeOSTest, PauseAndResume) { |
| 850 GetAudioSink(); | 852 GetAudioSink(); |
| 851 | 853 |
| 852 media_endpoint_->SelectConfiguration( | 854 media_endpoint_->SelectConfiguration( |
| 853 std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}), | 855 std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}), |
| 854 base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback, | 856 base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback, |
| 855 base::Unretained(this))); | 857 base::Unretained(this))); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 872 | 874 |
| 873 fake_transport_->SetState(media_endpoint_->object_path(), "pending"); | 875 fake_transport_->SetState(media_endpoint_->object_path(), "pending"); |
| 874 | 876 |
| 875 std::vector<char> data_one(16, 0x12); | 877 std::vector<char> data_one(16, 0x12); |
| 876 fake_transport_->WriteData(media_endpoint_->object_path(), data_one); | 878 fake_transport_->WriteData(media_endpoint_->object_path(), data_one); |
| 877 | 879 |
| 878 message_loop_.RunUntilIdle(); | 880 message_loop_.RunUntilIdle(); |
| 879 | 881 |
| 880 EXPECT_EQ(observer_->data_, data_one); | 882 EXPECT_EQ(observer_->data_, data_one); |
| 881 EXPECT_EQ(observer_->read_mtu_, | 883 EXPECT_EQ(observer_->read_mtu_, |
| 882 FakeBluetoothMediaTransportClient::kDefaultReadMtu); | 884 bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu); |
| 883 EXPECT_EQ(observer_->state_changed_count_, 3); | 885 EXPECT_EQ(observer_->state_changed_count_, 3); |
| 884 EXPECT_EQ(observer_->total_read_, data_one.size()); | 886 EXPECT_EQ(observer_->total_read_, data_one.size()); |
| 885 | 887 |
| 886 // Simulates the situation where the remote device pauses and resume audio | 888 // Simulates the situation where the remote device pauses and resume audio |
| 887 // streaming. | 889 // streaming. |
| 888 fake_transport_->SetState(media_endpoint_->object_path(), "idle"); | 890 fake_transport_->SetState(media_endpoint_->object_path(), "idle"); |
| 889 | 891 |
| 890 EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_IDLE); | 892 EXPECT_EQ(audio_sink_->GetState(), BluetoothAudioSink::STATE_IDLE); |
| 891 EXPECT_EQ(observer_->state_changed_count_, 4); | 893 EXPECT_EQ(observer_->state_changed_count_, 4); |
| 892 | 894 |
| 893 fake_transport_->SetState(media_endpoint_->object_path(), "pending"); | 895 fake_transport_->SetState(media_endpoint_->object_path(), "pending"); |
| 894 | 896 |
| 895 std::vector<char> data_two(8, 0x10); | 897 std::vector<char> data_two(8, 0x10); |
| 896 fake_transport_->WriteData(media_endpoint_->object_path(), data_two); | 898 fake_transport_->WriteData(media_endpoint_->object_path(), data_two); |
| 897 | 899 |
| 898 message_loop_.RunUntilIdle(); | 900 message_loop_.RunUntilIdle(); |
| 899 | 901 |
| 900 EXPECT_EQ(observer_->data_, data_two); | 902 EXPECT_EQ(observer_->data_, data_two); |
| 901 EXPECT_EQ(observer_->read_mtu_, | 903 EXPECT_EQ(observer_->read_mtu_, |
| 902 FakeBluetoothMediaTransportClient::kDefaultReadMtu); | 904 bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu); |
| 903 EXPECT_EQ(observer_->state_changed_count_, 6); | 905 EXPECT_EQ(observer_->state_changed_count_, 6); |
| 904 EXPECT_EQ(observer_->total_read_, data_two.size()); | 906 EXPECT_EQ(observer_->total_read_, data_two.size()); |
| 905 } | 907 } |
| 906 | 908 |
| 907 TEST_F(BluetoothAudioSinkChromeOSTest, ContinuouslyStreaming) { | 909 TEST_F(BluetoothAudioSinkChromeOSTest, ContinuouslyStreaming) { |
| 908 GetAudioSink(); | 910 GetAudioSink(); |
| 909 | 911 |
| 910 media_endpoint_->SelectConfiguration( | 912 media_endpoint_->SelectConfiguration( |
| 911 std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}), | 913 std::vector<uint8_t>({0x21, 0x15, 0x33, 0x2C}), |
| 912 base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback, | 914 base::Bind(&BluetoothAudioSinkChromeOSTest::SelectConfigurationCallback, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 930 | 932 |
| 931 fake_transport_->SetState(media_endpoint_->object_path(), "pending"); | 933 fake_transport_->SetState(media_endpoint_->object_path(), "pending"); |
| 932 | 934 |
| 933 std::vector<char> data_one(16, 0x12); | 935 std::vector<char> data_one(16, 0x12); |
| 934 fake_transport_->WriteData(media_endpoint_->object_path(), data_one); | 936 fake_transport_->WriteData(media_endpoint_->object_path(), data_one); |
| 935 | 937 |
| 936 message_loop_.RunUntilIdle(); | 938 message_loop_.RunUntilIdle(); |
| 937 | 939 |
| 938 EXPECT_EQ(observer_->data_, data_one); | 940 EXPECT_EQ(observer_->data_, data_one); |
| 939 EXPECT_EQ(observer_->read_mtu_, | 941 EXPECT_EQ(observer_->read_mtu_, |
| 940 FakeBluetoothMediaTransportClient::kDefaultReadMtu); | 942 bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu); |
| 941 EXPECT_EQ(observer_->state_changed_count_, 3); | 943 EXPECT_EQ(observer_->state_changed_count_, 3); |
| 942 EXPECT_EQ(observer_->total_read_, data_one.size()); | 944 EXPECT_EQ(observer_->total_read_, data_one.size()); |
| 943 | 945 |
| 944 std::vector<char> data_two(8, 0x10); | 946 std::vector<char> data_two(8, 0x10); |
| 945 fake_transport_->WriteData(media_endpoint_->object_path(), data_two); | 947 fake_transport_->WriteData(media_endpoint_->object_path(), data_two); |
| 946 | 948 |
| 947 message_loop_.RunUntilIdle(); | 949 message_loop_.RunUntilIdle(); |
| 948 | 950 |
| 949 EXPECT_EQ(observer_->data_, data_two); | 951 EXPECT_EQ(observer_->data_, data_two); |
| 950 EXPECT_EQ(observer_->read_mtu_, | 952 EXPECT_EQ(observer_->read_mtu_, |
| 951 FakeBluetoothMediaTransportClient::kDefaultReadMtu); | 953 bluez::FakeBluetoothMediaTransportClient::kDefaultReadMtu); |
| 952 EXPECT_EQ(observer_->state_changed_count_, 3); | 954 EXPECT_EQ(observer_->state_changed_count_, 3); |
| 953 EXPECT_EQ(observer_->total_read_, data_one.size() + data_two.size()); | 955 EXPECT_EQ(observer_->total_read_, data_one.size() + data_two.size()); |
| 954 } | 956 } |
| 955 | 957 |
| 956 } // namespace chromeos | 958 } // namespace chromeos |
| OLD | NEW |