| 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/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 public: | 57 public: |
| 58 ChromeOSMetricsProviderTest() {} | 58 ChromeOSMetricsProviderTest() {} |
| 59 | 59 |
| 60 protected: | 60 protected: |
| 61 void SetUp() override { | 61 void SetUp() override { |
| 62 #if defined(USE_X11) | 62 #if defined(USE_X11) |
| 63 ui::DeviceDataManagerX11::CreateInstance(); | 63 ui::DeviceDataManagerX11::CreateInstance(); |
| 64 #endif | 64 #endif |
| 65 | 65 |
| 66 // Set up the fake Bluetooth environment, | 66 // Set up the fake Bluetooth environment, |
| 67 scoped_ptr<BluezDBusManagerSetter> bluez_dbus_setter = | 67 std::unique_ptr<BluezDBusManagerSetter> bluez_dbus_setter = |
| 68 BluezDBusManager::GetSetterForTesting(); | 68 BluezDBusManager::GetSetterForTesting(); |
| 69 bluez_dbus_setter->SetBluetoothAdapterClient( | 69 bluez_dbus_setter->SetBluetoothAdapterClient( |
| 70 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); | 70 std::unique_ptr<BluetoothAdapterClient>( |
| 71 new FakeBluetoothAdapterClient)); |
| 71 bluez_dbus_setter->SetBluetoothDeviceClient( | 72 bluez_dbus_setter->SetBluetoothDeviceClient( |
| 72 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); | 73 std::unique_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); |
| 73 bluez_dbus_setter->SetBluetoothGattCharacteristicClient( | 74 bluez_dbus_setter->SetBluetoothGattCharacteristicClient( |
| 74 scoped_ptr<BluetoothGattCharacteristicClient>( | 75 std::unique_ptr<BluetoothGattCharacteristicClient>( |
| 75 new FakeBluetoothGattCharacteristicClient)); | 76 new FakeBluetoothGattCharacteristicClient)); |
| 76 bluez_dbus_setter->SetBluetoothGattDescriptorClient( | 77 bluez_dbus_setter->SetBluetoothGattDescriptorClient( |
| 77 scoped_ptr<BluetoothGattDescriptorClient>( | 78 std::unique_ptr<BluetoothGattDescriptorClient>( |
| 78 new FakeBluetoothGattDescriptorClient)); | 79 new FakeBluetoothGattDescriptorClient)); |
| 79 bluez_dbus_setter->SetBluetoothGattServiceClient( | 80 bluez_dbus_setter->SetBluetoothGattServiceClient( |
| 80 scoped_ptr<BluetoothGattServiceClient>( | 81 std::unique_ptr<BluetoothGattServiceClient>( |
| 81 new FakeBluetoothGattServiceClient)); | 82 new FakeBluetoothGattServiceClient)); |
| 82 bluez_dbus_setter->SetBluetoothInputClient( | 83 bluez_dbus_setter->SetBluetoothInputClient( |
| 83 scoped_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); | 84 std::unique_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); |
| 84 bluez_dbus_setter->SetBluetoothAgentManagerClient( | 85 bluez_dbus_setter->SetBluetoothAgentManagerClient( |
| 85 scoped_ptr<BluetoothAgentManagerClient>( | 86 std::unique_ptr<BluetoothAgentManagerClient>( |
| 86 new FakeBluetoothAgentManagerClient)); | 87 new FakeBluetoothAgentManagerClient)); |
| 87 | 88 |
| 88 // Set up a PowerManagerClient instance for PerfProvider. | 89 // Set up a PowerManagerClient instance for PerfProvider. |
| 89 scoped_ptr<DBusThreadManagerSetter> dbus_setter = | 90 std::unique_ptr<DBusThreadManagerSetter> dbus_setter = |
| 90 DBusThreadManager::GetSetterForTesting(); | 91 DBusThreadManager::GetSetterForTesting(); |
| 91 dbus_setter->SetPowerManagerClient( | 92 dbus_setter->SetPowerManagerClient(std::unique_ptr<PowerManagerClient>( |
| 92 scoped_ptr<PowerManagerClient>( | 93 PowerManagerClient::Create(STUB_DBUS_CLIENT_IMPLEMENTATION))); |
| 93 PowerManagerClient::Create(STUB_DBUS_CLIENT_IMPLEMENTATION))); | |
| 94 | 94 |
| 95 // Grab pointers to members of the thread manager for easier testing. | 95 // Grab pointers to members of the thread manager for easier testing. |
| 96 fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>( | 96 fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>( |
| 97 BluezDBusManager::Get()->GetBluetoothAdapterClient()); | 97 BluezDBusManager::Get()->GetBluetoothAdapterClient()); |
| 98 fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>( | 98 fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>( |
| 99 BluezDBusManager::Get()->GetBluetoothDeviceClient()); | 99 BluezDBusManager::Get()->GetBluetoothDeviceClient()); |
| 100 | 100 |
| 101 // Initialize the login state trackers. | 101 // Initialize the login state trackers. |
| 102 if (!chromeos::LoginState::IsInitialized()) | 102 if (!chromeos::LoginState::IsInitialized()) |
| 103 chromeos::LoginState::Initialize(); | 103 chromeos::LoginState::Initialize(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 EXPECT_EQ(0x030DU, device1.product_id()); | 279 EXPECT_EQ(0x030DU, device1.product_id()); |
| 280 EXPECT_EQ(0x0306U, device1.device_id()); | 280 EXPECT_EQ(0x0306U, device1.device_id()); |
| 281 | 281 |
| 282 // The Confirm Passkey object, this has no Device ID information. | 282 // The Confirm Passkey object, this has no Device ID information. |
| 283 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, | 283 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, |
| 284 device2.bluetooth_class()); | 284 device2.bluetooth_class()); |
| 285 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); | 285 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); |
| 286 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); | 286 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); |
| 287 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); | 287 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); |
| 288 } | 288 } |
| OLD | NEW |