Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: device/bluetooth/bluez/bluetooth_audio_sink_bluez_unittest.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "device/bluetooth/bluez/bluetooth_audio_sink_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_audio_sink_bluez.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/message_loop/message_loop.h" 16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h"
17 #include "dbus/object_path.h" 18 #include "dbus/object_path.h"
18 #include "device/bluetooth/bluetooth_adapter.h" 19 #include "device/bluetooth/bluetooth_adapter.h"
19 #include "device/bluetooth/bluetooth_adapter_factory.h" 20 #include "device/bluetooth/bluetooth_adapter_factory.h"
20 #include "device/bluetooth/bluetooth_audio_sink.h" 21 #include "device/bluetooth/bluetooth_audio_sink.h"
21 #include "device/bluetooth/dbus/bluetooth_media_client.h" 22 #include "device/bluetooth/dbus/bluetooth_media_client.h"
22 #include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h" 23 #include "device/bluetooth/dbus/bluetooth_media_endpoint_service_provider.h"
23 #include "device/bluetooth/dbus/bluetooth_media_transport_client.h" 24 #include "device/bluetooth/dbus/bluetooth_media_transport_client.h"
24 #include "device/bluetooth/dbus/bluez_dbus_manager.h" 25 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
25 #include "device/bluetooth/dbus/fake_bluetooth_media_client.h" 26 #include "device/bluetooth/dbus/fake_bluetooth_media_client.h"
26 #include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h " 27 #include "device/bluetooth/dbus/fake_bluetooth_media_endpoint_service_provider.h "
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 audio_sink_ = nullptr; 128 audio_sink_ = nullptr;
128 adapter_ = nullptr; 129 adapter_ = nullptr;
129 bluez::BluezDBusManager::Shutdown(); 130 bluez::BluezDBusManager::Shutdown();
130 } 131 }
131 132
132 // Gets the existing Bluetooth adapter. 133 // Gets the existing Bluetooth adapter.
133 void GetAdapter() { 134 void GetAdapter() {
134 BluetoothAdapterFactory::GetAdapter( 135 BluetoothAdapterFactory::GetAdapter(
135 base::Bind(&BluetoothAudioSinkBlueZTest::GetAdapterCallback, 136 base::Bind(&BluetoothAudioSinkBlueZTest::GetAdapterCallback,
136 base::Unretained(this))); 137 base::Unretained(this)));
137 base::MessageLoop::current()->Run(); 138 base::RunLoop().Run();
138 } 139 }
139 140
140 // Called whenever BluetoothAdapter is retrieved successfully. 141 // Called whenever BluetoothAdapter is retrieved successfully.
141 void GetAdapterCallback(scoped_refptr<BluetoothAdapter> adapter) { 142 void GetAdapterCallback(scoped_refptr<BluetoothAdapter> adapter) {
142 adapter_ = adapter; 143 adapter_ = adapter;
143 144
144 ASSERT_NE(adapter_.get(), nullptr); 145 ASSERT_NE(adapter_.get(), nullptr);
145 ASSERT_TRUE(adapter_->IsInitialized()); 146 ASSERT_TRUE(adapter_->IsInitialized());
146 adapter_->SetPowered(true, 147 adapter_->SetPowered(true,
147 base::Bind(&BluetoothAudioSinkBlueZTest::Callback, 148 base::Bind(&BluetoothAudioSinkBlueZTest::Callback,
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 message_loop_.RunUntilIdle(); 949 message_loop_.RunUntilIdle();
949 950
950 EXPECT_EQ(observer_->data_, data_two); 951 EXPECT_EQ(observer_->data_, data_two);
951 EXPECT_EQ(observer_->read_mtu_, 952 EXPECT_EQ(observer_->read_mtu_,
952 FakeBluetoothMediaTransportClient::kDefaultReadMtu); 953 FakeBluetoothMediaTransportClient::kDefaultReadMtu);
953 EXPECT_EQ(observer_->state_changed_count_, 3); 954 EXPECT_EQ(observer_->state_changed_count_, 3);
954 EXPECT_EQ(observer_->total_read_, data_one.size() + data_two.size()); 955 EXPECT_EQ(observer_->total_read_, data_one.size() + data_two.size());
955 } 956 }
956 957
957 } // namespace bluez 958 } // namespace bluez
OLDNEW
« no previous file with comments | « device/bluetooth/bluez/bluetooth_advertisement_bluez_unittest.cc ('k') | device/bluetooth/bluez/bluetooth_bluez_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698