Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: chrome/browser/metrics/chromeos_metrics_provider_unittest.cc

Issue 289283015: Extract touchscreen device management into a generic manager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/chromeos/login/users/user_manager.h" 11 #include "chrome/browser/chromeos/login/users/user_manager.h"
12 #include "chrome/browser/metrics/chromeos_metrics_provider.h" 12 #include "chrome/browser/metrics/chromeos_metrics_provider.h"
13 #include "chromeos/dbus/fake_bluetooth_adapter_client.h" 13 #include "chromeos/dbus/fake_bluetooth_adapter_client.h"
14 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h" 14 #include "chromeos/dbus/fake_bluetooth_agent_manager_client.h"
15 #include "chromeos/dbus/fake_bluetooth_device_client.h" 15 #include "chromeos/dbus/fake_bluetooth_device_client.h"
16 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h" 16 #include "chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h"
17 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h" 17 #include "chromeos/dbus/fake_bluetooth_gatt_descriptor_client.h"
18 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h" 18 #include "chromeos/dbus/fake_bluetooth_gatt_service_client.h"
19 #include "chromeos/dbus/fake_bluetooth_input_client.h" 19 #include "chromeos/dbus/fake_bluetooth_input_client.h"
20 #include "chromeos/dbus/fake_dbus_thread_manager.h" 20 #include "chromeos/dbus/fake_dbus_thread_manager.h"
21 #include "chromeos/dbus/power_manager_client.h" 21 #include "chromeos/dbus/power_manager_client.h"
22 #include "chromeos/login/login_state.h" 22 #include "chromeos/login/login_state.h"
23 #include "components/metrics/proto/system_profile.pb.h" 23 #include "components/metrics/proto/system_profile.pb.h"
24 #include "content/public/test/test_browser_thread_bundle.h" 24 #include "content/public/test/test_browser_thread_bundle.h"
25 #include "content/public/test/test_utils.h" 25 #include "content/public/test/test_utils.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 #if defined(USE_X11)
29 #include "ui/events/x/device_data_manager_x11.h"
30 #endif
31
28 using chromeos::DBusThreadManager; 32 using chromeos::DBusThreadManager;
29 using chromeos::BluetoothAdapterClient; 33 using chromeos::BluetoothAdapterClient;
30 using chromeos::BluetoothAgentManagerClient; 34 using chromeos::BluetoothAgentManagerClient;
31 using chromeos::BluetoothDeviceClient; 35 using chromeos::BluetoothDeviceClient;
32 using chromeos::BluetoothGattCharacteristicClient; 36 using chromeos::BluetoothGattCharacteristicClient;
33 using chromeos::BluetoothGattDescriptorClient; 37 using chromeos::BluetoothGattDescriptorClient;
34 using chromeos::BluetoothGattServiceClient; 38 using chromeos::BluetoothGattServiceClient;
35 using chromeos::BluetoothInputClient; 39 using chromeos::BluetoothInputClient;
36 using chromeos::FakeBluetoothAdapterClient; 40 using chromeos::FakeBluetoothAdapterClient;
37 using chromeos::FakeBluetoothAgentManagerClient; 41 using chromeos::FakeBluetoothAgentManagerClient;
38 using chromeos::FakeBluetoothDeviceClient; 42 using chromeos::FakeBluetoothDeviceClient;
39 using chromeos::FakeBluetoothGattCharacteristicClient; 43 using chromeos::FakeBluetoothGattCharacteristicClient;
40 using chromeos::FakeBluetoothGattDescriptorClient; 44 using chromeos::FakeBluetoothGattDescriptorClient;
41 using chromeos::FakeBluetoothGattServiceClient; 45 using chromeos::FakeBluetoothGattServiceClient;
42 using chromeos::FakeBluetoothInputClient; 46 using chromeos::FakeBluetoothInputClient;
43 using chromeos::FakeDBusThreadManager; 47 using chromeos::FakeDBusThreadManager;
44 using chromeos::PowerManagerClient; 48 using chromeos::PowerManagerClient;
45 using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION; 49 using chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION;
46 50
47 class ChromeOSMetricsProviderTest : public testing::Test { 51 class ChromeOSMetricsProviderTest : public testing::Test {
48 public: 52 public:
49 ChromeOSMetricsProviderTest() {} 53 ChromeOSMetricsProviderTest() {}
50 54
51 protected: 55 protected:
52 virtual void SetUp() OVERRIDE { 56 virtual void SetUp() OVERRIDE {
57 #if defined(USE_X11)
58 ui::DeviceDataManagerX11::CreateInstance();
sadrul 2014/06/20 13:37:52 Is this necessary?
dnicoara 2014/06/20 14:48:00 Unfortunately it is. I double-checked.
59 #endif
60
53 // Set up the fake Bluetooth environment, 61 // Set up the fake Bluetooth environment,
54 scoped_ptr<FakeDBusThreadManager> fake_dbus_thread_manager( 62 scoped_ptr<FakeDBusThreadManager> fake_dbus_thread_manager(
55 new FakeDBusThreadManager); 63 new FakeDBusThreadManager);
56 fake_dbus_thread_manager->SetBluetoothAdapterClient( 64 fake_dbus_thread_manager->SetBluetoothAdapterClient(
57 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); 65 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient));
58 fake_dbus_thread_manager->SetBluetoothDeviceClient( 66 fake_dbus_thread_manager->SetBluetoothDeviceClient(
59 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); 67 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient));
60 fake_dbus_thread_manager->SetBluetoothGattCharacteristicClient( 68 fake_dbus_thread_manager->SetBluetoothGattCharacteristicClient(
61 scoped_ptr<BluetoothGattCharacteristicClient>( 69 scoped_ptr<BluetoothGattCharacteristicClient>(
62 new FakeBluetoothGattCharacteristicClient)); 70 new FakeBluetoothGattCharacteristicClient));
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // Second device should match the Confirm Passkey object, this has 241 // Second device should match the Confirm Passkey object, this has
234 // no Device ID information. 242 // no Device ID information.
235 PairedDevice device2 = system_profile.hardware().bluetooth().paired_device(1); 243 PairedDevice device2 = system_profile.hardware().bluetooth().paired_device(1);
236 244
237 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, 245 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass,
238 device2.bluetooth_class()); 246 device2.bluetooth_class());
239 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); 247 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type());
240 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); 248 EXPECT_EQ(0x207D74U, device2.vendor_prefix());
241 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); 249 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source());
242 } 250 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698