| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 using bluez::FakeBluetoothAdapterClient; | 45 using bluez::FakeBluetoothAdapterClient; |
| 46 using bluez::FakeBluetoothAgentManagerClient; | 46 using bluez::FakeBluetoothAgentManagerClient; |
| 47 using bluez::FakeBluetoothDeviceClient; | 47 using bluez::FakeBluetoothDeviceClient; |
| 48 using bluez::FakeBluetoothGattCharacteristicClient; | 48 using bluez::FakeBluetoothGattCharacteristicClient; |
| 49 using bluez::FakeBluetoothGattDescriptorClient; | 49 using bluez::FakeBluetoothGattDescriptorClient; |
| 50 using bluez::FakeBluetoothGattServiceClient; | 50 using bluez::FakeBluetoothGattServiceClient; |
| 51 using bluez::FakeBluetoothInputClient; | 51 using bluez::FakeBluetoothInputClient; |
| 52 using chromeos::DBusThreadManager; | 52 using chromeos::DBusThreadManager; |
| 53 using chromeos::DBusThreadManagerSetter; | 53 using chromeos::DBusThreadManagerSetter; |
| 54 using chromeos::PowerManagerClient; | 54 using chromeos::PowerManagerClient; |
| 55 using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION; | 55 using chromeos::FAKE_DBUS_CLIENT_IMPLEMENTATION; |
| 56 | 56 |
| 57 class ChromeOSMetricsProviderTest : public testing::Test { | 57 class ChromeOSMetricsProviderTest : public testing::Test { |
| 58 public: | 58 public: |
| 59 ChromeOSMetricsProviderTest() {} | 59 ChromeOSMetricsProviderTest() {} |
| 60 | 60 |
| 61 protected: | 61 protected: |
| 62 void SetUp() override { | 62 void SetUp() override { |
| 63 #if defined(USE_X11) | 63 #if defined(USE_X11) |
| 64 ui::DeviceDataManagerX11::CreateInstance(); | 64 ui::DeviceDataManagerX11::CreateInstance(); |
| 65 #endif | 65 #endif |
| (...skipping 18 matching lines...) Expand all Loading... |
| 84 bluez_dbus_setter->SetBluetoothInputClient( | 84 bluez_dbus_setter->SetBluetoothInputClient( |
| 85 std::unique_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); | 85 std::unique_ptr<BluetoothInputClient>(new FakeBluetoothInputClient)); |
| 86 bluez_dbus_setter->SetBluetoothAgentManagerClient( | 86 bluez_dbus_setter->SetBluetoothAgentManagerClient( |
| 87 std::unique_ptr<BluetoothAgentManagerClient>( | 87 std::unique_ptr<BluetoothAgentManagerClient>( |
| 88 new FakeBluetoothAgentManagerClient)); | 88 new FakeBluetoothAgentManagerClient)); |
| 89 | 89 |
| 90 // Set up a PowerManagerClient instance for PerfProvider. | 90 // Set up a PowerManagerClient instance for PerfProvider. |
| 91 std::unique_ptr<DBusThreadManagerSetter> dbus_setter = | 91 std::unique_ptr<DBusThreadManagerSetter> dbus_setter = |
| 92 DBusThreadManager::GetSetterForTesting(); | 92 DBusThreadManager::GetSetterForTesting(); |
| 93 dbus_setter->SetPowerManagerClient(std::unique_ptr<PowerManagerClient>( | 93 dbus_setter->SetPowerManagerClient(std::unique_ptr<PowerManagerClient>( |
| 94 PowerManagerClient::Create(STUB_DBUS_CLIENT_IMPLEMENTATION))); | 94 PowerManagerClient::Create(FAKE_DBUS_CLIENT_IMPLEMENTATION))); |
| 95 | 95 |
| 96 // Grab pointers to members of the thread manager for easier testing. | 96 // Grab pointers to members of the thread manager for easier testing. |
| 97 fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>( | 97 fake_bluetooth_adapter_client_ = static_cast<FakeBluetoothAdapterClient*>( |
| 98 BluezDBusManager::Get()->GetBluetoothAdapterClient()); | 98 BluezDBusManager::Get()->GetBluetoothAdapterClient()); |
| 99 fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>( | 99 fake_bluetooth_device_client_ = static_cast<FakeBluetoothDeviceClient*>( |
| 100 BluezDBusManager::Get()->GetBluetoothDeviceClient()); | 100 BluezDBusManager::Get()->GetBluetoothDeviceClient()); |
| 101 | 101 |
| 102 // Initialize the login state trackers. | 102 // Initialize the login state trackers. |
| 103 if (!chromeos::LoginState::IsInitialized()) | 103 if (!chromeos::LoginState::IsInitialized()) |
| 104 chromeos::LoginState::Initialize(); | 104 chromeos::LoginState::Initialize(); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 EXPECT_EQ(0x030DU, device1.product_id()); | 280 EXPECT_EQ(0x030DU, device1.product_id()); |
| 281 EXPECT_EQ(0x0306U, device1.device_id()); | 281 EXPECT_EQ(0x0306U, device1.device_id()); |
| 282 | 282 |
| 283 // The Confirm Passkey object, this has no Device ID information. | 283 // The Confirm Passkey object, this has no Device ID information. |
| 284 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, | 284 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, |
| 285 device2.bluetooth_class()); | 285 device2.bluetooth_class()); |
| 286 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); | 286 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); |
| 287 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); | 287 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); |
| 288 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); | 288 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); |
| 289 } | 289 } |
| OLD | NEW |