OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/metrics/chromeos_metrics_provider.h" | 5 #include "chrome/browser/metrics/chromeos_metrics_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" | 10 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 using chromeos::FakeBluetoothGattServiceClient; | 47 using chromeos::FakeBluetoothGattServiceClient; |
48 using chromeos::FakeBluetoothInputClient; | 48 using chromeos::FakeBluetoothInputClient; |
49 using chromeos::PowerManagerClient; | 49 using chromeos::PowerManagerClient; |
50 using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION; | 50 using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION; |
51 | 51 |
52 class ChromeOSMetricsProviderTest : public testing::Test { | 52 class ChromeOSMetricsProviderTest : public testing::Test { |
53 public: | 53 public: |
54 ChromeOSMetricsProviderTest() {} | 54 ChromeOSMetricsProviderTest() {} |
55 | 55 |
56 protected: | 56 protected: |
57 virtual void SetUp() OVERRIDE { | 57 virtual void SetUp() override { |
58 #if defined(USE_X11) | 58 #if defined(USE_X11) |
59 ui::DeviceDataManagerX11::CreateInstance(); | 59 ui::DeviceDataManagerX11::CreateInstance(); |
60 #endif | 60 #endif |
61 | 61 |
62 // Set up the fake Bluetooth environment, | 62 // Set up the fake Bluetooth environment, |
63 scoped_ptr<DBusThreadManagerSetter> dbus_setter = | 63 scoped_ptr<DBusThreadManagerSetter> dbus_setter = |
64 DBusThreadManager::GetSetterForTesting(); | 64 DBusThreadManager::GetSetterForTesting(); |
65 dbus_setter->SetBluetoothAdapterClient( | 65 dbus_setter->SetBluetoothAdapterClient( |
66 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); | 66 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); |
67 dbus_setter->SetBluetoothDeviceClient( | 67 dbus_setter->SetBluetoothDeviceClient( |
(...skipping 22 matching lines...) Expand all Loading... |
90 fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>( | 90 fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>( |
91 DBusThreadManager::Get()->GetBluetoothAdapterClient()); | 91 DBusThreadManager::Get()->GetBluetoothAdapterClient()); |
92 fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>( | 92 fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>( |
93 DBusThreadManager::Get()->GetBluetoothDeviceClient()); | 93 DBusThreadManager::Get()->GetBluetoothDeviceClient()); |
94 | 94 |
95 // Initialize the login state trackers. | 95 // Initialize the login state trackers. |
96 if (!chromeos::LoginState::IsInitialized()) | 96 if (!chromeos::LoginState::IsInitialized()) |
97 chromeos::LoginState::Initialize(); | 97 chromeos::LoginState::Initialize(); |
98 } | 98 } |
99 | 99 |
100 virtual void TearDown() OVERRIDE { | 100 virtual void TearDown() override { |
101 // Destroy the login state tracker if it was initialized. | 101 // Destroy the login state tracker if it was initialized. |
102 chromeos::LoginState::Shutdown(); | 102 chromeos::LoginState::Shutdown(); |
103 | 103 |
104 DBusThreadManager::Shutdown(); | 104 DBusThreadManager::Shutdown(); |
105 } | 105 } |
106 | 106 |
107 protected: | 107 protected: |
108 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_; | 108 FakeBluetoothAdapterClient* fake_bluetooth_adapter_client_; |
109 FakeBluetoothDeviceClient* fake_bluetooth_device_client_; | 109 FakeBluetoothDeviceClient* fake_bluetooth_device_client_; |
110 | 110 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Second device should match the Confirm Passkey object, this has | 240 // Second device should match the Confirm Passkey object, this has |
241 // no Device ID information. | 241 // no Device ID information. |
242 PairedDevice device2 = system_profile.hardware().bluetooth().paired_device(1); | 242 PairedDevice device2 = system_profile.hardware().bluetooth().paired_device(1); |
243 | 243 |
244 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, | 244 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, |
245 device2.bluetooth_class()); | 245 device2.bluetooth_class()); |
246 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); | 246 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); |
247 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); | 247 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); |
248 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); | 248 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); |
249 } | 249 } |
OLD | NEW |