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

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

Issue 2606193002: Use TaskScheduler instead of WorkerPool in fake_bluetooth_device_client.cc. (Closed)
Patch Set: rebase Created 3 years, 11 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_socket_bluez.h" 5 #include "device/bluetooth/bluez/bluetooth_socket_bluez.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/test/scoped_async_task_scheduler.h"
13 #include "device/bluetooth/bluetooth_adapter.h" 14 #include "device/bluetooth/bluetooth_adapter.h"
14 #include "device/bluetooth/bluetooth_adapter_factory.h" 15 #include "device/bluetooth/bluetooth_adapter_factory.h"
15 #include "device/bluetooth/bluetooth_device.h" 16 #include "device/bluetooth/bluetooth_device.h"
16 #include "device/bluetooth/bluetooth_socket.h" 17 #include "device/bluetooth/bluetooth_socket.h"
17 #include "device/bluetooth/bluetooth_socket_thread.h" 18 #include "device/bluetooth/bluetooth_socket_thread.h"
18 #include "device/bluetooth/bluetooth_uuid.h" 19 #include "device/bluetooth/bluetooth_uuid.h"
19 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h" 20 #include "device/bluetooth/bluez/bluetooth_adapter_bluez.h"
20 #include "device/bluetooth/bluez/bluetooth_device_bluez.h" 21 #include "device/bluetooth/bluez/bluetooth_device_bluez.h"
21 #include "device/bluetooth/dbus/bluez_dbus_manager.h" 22 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
22 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h" 23 #include "device/bluetooth/dbus/fake_bluetooth_adapter_client.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 last_device_ = device; 169 last_device_ = device;
169 last_socket_ = socket; 170 last_socket_ = socket;
170 171
171 message_loop_.QuitWhenIdle(); 172 message_loop_.QuitWhenIdle();
172 } 173 }
173 174
174 void ImmediateSuccessCallback() { ++success_callback_count_; } 175 void ImmediateSuccessCallback() { ++success_callback_count_; }
175 176
176 protected: 177 protected:
177 base::MessageLoop message_loop_; 178 base::MessageLoop message_loop_;
179 base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler_;
178 180
179 scoped_refptr<BluetoothAdapter> adapter_; 181 scoped_refptr<BluetoothAdapter> adapter_;
180 182
181 unsigned int success_callback_count_; 183 unsigned int success_callback_count_;
182 unsigned int error_callback_count_; 184 unsigned int error_callback_count_;
183 185
184 std::string last_message_; 186 std::string last_message_;
185 scoped_refptr<BluetoothSocket> last_socket_; 187 scoped_refptr<BluetoothSocket> last_socket_;
186 int last_bytes_sent_; 188 int last_bytes_sent_;
187 int last_bytes_received_; 189 int last_bytes_received_;
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 629
628 server_socket = nullptr; 630 server_socket = nullptr;
629 631
630 base::RunLoop().RunUntilIdle(); 632 base::RunLoop().RunUntilIdle();
631 633
632 EXPECT_EQ(2U, success_callback_count_); 634 EXPECT_EQ(2U, success_callback_count_);
633 EXPECT_EQ(2U, error_callback_count_); 635 EXPECT_EQ(2U, error_callback_count_);
634 } 636 }
635 637
636 } // namespace bluez 638 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698