blob: 1f68b281a103a3c972581058ee97896af9e891e5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <string>
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_adapter_win.h"
#include "device/bluetooth/bluetooth_task_manager_win.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
const char kAdapterAddress[] = "Bluetooth Adapter Address";
const char kAdapterName[] = "Bluetooth Adapter Name";
} // namespace
namespace device {
class BluetoothAdapterWinTest : public testing::Test {
public:
BluetoothAdapterWinTest()
: adapter_(new BluetoothAdapterWin()),
adapter_win_(static_cast<BluetoothAdapterWin*>(adapter_.get())) {
}
protected:
scoped_refptr<BluetoothAdapter> adapter_;
BluetoothAdapterWin* adapter_win_;
};
TEST_F(BluetoothAdapterWinTest, AdapterNotPresent) {
BluetoothTaskManagerWin::AdapterState state;
adapter_win_->AdapterStateChanged(state);
EXPECT_FALSE(adapter_win_->IsPresent());
}
TEST_F(BluetoothAdapterWinTest, AdapterPresent) {
BluetoothTaskManagerWin::AdapterState state;
state.address = kAdapterAddress;
state.name = kAdapterName;
adapter_win_->AdapterStateChanged(state);
EXPECT_TRUE(adapter_win_->IsPresent());
}
} // namespace device
|