| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 using bluez::FakeBluetoothAdapterClient; | 44 using bluez::FakeBluetoothAdapterClient; |
| 45 using bluez::FakeBluetoothAgentManagerClient; | 45 using bluez::FakeBluetoothAgentManagerClient; |
| 46 using bluez::FakeBluetoothDeviceClient; | 46 using bluez::FakeBluetoothDeviceClient; |
| 47 using bluez::FakeBluetoothGattCharacteristicClient; | 47 using bluez::FakeBluetoothGattCharacteristicClient; |
| 48 using bluez::FakeBluetoothGattDescriptorClient; | 48 using bluez::FakeBluetoothGattDescriptorClient; |
| 49 using bluez::FakeBluetoothGattServiceClient; | 49 using bluez::FakeBluetoothGattServiceClient; |
| 50 using bluez::FakeBluetoothInputClient; | 50 using bluez::FakeBluetoothInputClient; |
| 51 using chromeos::DBusThreadManager; | 51 using chromeos::DBusThreadManager; |
| 52 using chromeos::DBusThreadManagerSetter; | 52 using chromeos::DBusThreadManagerSetter; |
| 53 using chromeos::PowerManagerClient; | 53 using chromeos::PowerManagerClient; |
| 54 using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION; | 54 using chromeos::FAKE_DBUS_CLIENT_IMPLEMENTATION; |
| 55 | 55 |
| 56 class ChromeOSMetricsProviderTest : public testing::Test { | 56 class ChromeOSMetricsProviderTest : public testing::Test { |
| 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 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 83 bluez_dbus_setter->SetBluetoothInputClient( | 83 bluez_dbus_setter->SetBluetoothInputClient( |
| 84 std::unique_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); | 84 std::unique_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); |
| 85 bluez_dbus_setter->SetBluetoothAgentManagerClient( | 85 bluez_dbus_setter->SetBluetoothAgentManagerClient( |
| 86 std::unique_ptr<BluetoothAgentManagerClient>( | 86 std::unique_ptr<BluetoothAgentManagerClient>( |
| 87 new FakeBluetoothAgentManagerClient)); | 87 new FakeBluetoothAgentManagerClient)); |
| 88 | 88 |
| 89 // Set up a PowerManagerClient instance for PerfProvider. | 89 // Set up a PowerManagerClient instance for PerfProvider. |
| 90 std::unique_ptr<DBusThreadManagerSetter> dbus_setter = | 90 std::unique_ptr<DBusThreadManagerSetter> dbus_setter = |
| 91 DBusThreadManager::GetSetterForTesting(); | 91 DBusThreadManager::GetSetterForTesting(); |
| 92 dbus_setter->SetPowerManagerClient(std::unique_ptr<PowerManagerClient>( | 92 dbus_setter->SetPowerManagerClient(std::unique_ptr<PowerManagerClient>( |
| 93 PowerManagerClient::Create(STUB_DBUS_CLIENT_IMPLEMENTATION))); | 93 PowerManagerClient::Create(FAKE_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 |