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

Unified Diff: device/bluetooth/bluetooth_adapter_win_unittest.cc

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turned adapter_callbacks to a lazy instance. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/bluetooth/bluetooth_adapter_win.cc ('k') | device/bluetooth/bluetooth_includes_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_win_unittest.cc
diff --git a/device/bluetooth/bluetooth_adapter_win_unittest.cc b/device/bluetooth/bluetooth_adapter_win_unittest.cc
index 1f68b281a103a3c972581058ee97896af9e891e5..afd85b69691ae250153c41f1f0ba384214f9e698 100644
--- a/device/bluetooth/bluetooth_adapter_win_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_win_unittest.cc
@@ -23,13 +23,21 @@ namespace device {
class BluetoothAdapterWinTest : public testing::Test {
public:
BluetoothAdapterWinTest()
- : adapter_(new BluetoothAdapterWin()),
- adapter_win_(static_cast<BluetoothAdapterWin*>(adapter_.get())) {
+ : adapter_(new BluetoothAdapterWin(
+ base::Bind(&BluetoothAdapterWinTest::RunInitCallback,
+ base::Unretained(this)))),
+ adapter_win_(static_cast<BluetoothAdapterWin*>(adapter_.get())),
+ init_callback_called_(false) {
+ }
+
+ void RunInitCallback() {
+ init_callback_called_ = true;
}
protected:
scoped_refptr<BluetoothAdapter> adapter_;
BluetoothAdapterWin* adapter_win_;
+ bool init_callback_called_;
};
TEST_F(BluetoothAdapterWinTest, AdapterNotPresent) {
@@ -46,5 +54,13 @@ TEST_F(BluetoothAdapterWinTest, AdapterPresent) {
EXPECT_TRUE(adapter_win_->IsPresent());
}
+TEST_F(BluetoothAdapterWinTest, AdapterInitialized) {
+ EXPECT_FALSE(adapter_win_->IsInitialized());
+ EXPECT_FALSE(init_callback_called_);
+ BluetoothTaskManagerWin::AdapterState state;
+ adapter_win_->AdapterStateChanged(state);
+ EXPECT_TRUE(adapter_win_->IsInitialized());
+ EXPECT_TRUE(init_callback_called_);
+}
} // namespace device
« no previous file with comments | « device/bluetooth/bluetooth_adapter_win.cc ('k') | device/bluetooth/bluetooth_includes_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698