Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/port.h" | 12 #include "base/port.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/prefs/scoped_user_pref_update.h" | 14 #include "base/prefs/scoped_user_pref_update.h" |
| 15 #include "base/prefs/testing_pref_service.h" | 15 #include "base/prefs/testing_pref_service.h" |
| 16 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/threading/sequenced_worker_pool.h" | 20 #include "base/threading/sequenced_worker_pool.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "base/tracked_objects.h" | 22 #include "base/tracked_objects.h" |
| 23 #include "chrome/browser/google/google_util.h" | 23 #include "chrome/browser/google/google_util.h" |
| 24 #include "chrome/browser/prefs/browser_prefs.h" | 24 #include "chrome/browser/prefs/browser_prefs.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
|
Nikita (slow)
2014/05/19 14:27:15
nit: not used
| |
| 26 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
| 27 #include "chrome/common/metrics/variations/variations_util.h" | 27 #include "chrome/common/metrics/variations/variations_util.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/installer/util/google_update_settings.h" | 29 #include "chrome/installer/util/google_update_settings.h" |
| 30 #include "components/metrics/metrics_hashes.h" | 30 #include "components/metrics/metrics_hashes.h" |
| 31 #include "components/metrics/proto/profiler_event.pb.h" | 31 #include "components/metrics/proto/profiler_event.pb.h" |
| 32 #include "components/metrics/proto/system_profile.pb.h" | 32 #include "components/metrics/proto/system_profile.pb.h" |
| 33 #include "components/variations/metrics_util.h" | 33 #include "components/variations/metrics_util.h" |
| 34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
| 35 #include "content/public/common/process_type.h" | 35 #include "content/public/common/process_type.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 216 | 216 |
| 217 } // namespace | 217 } // namespace |
| 218 | 218 |
| 219 class MetricsLogTest : public testing::Test { | 219 class MetricsLogTest : public testing::Test { |
| 220 public: | 220 public: |
| 221 MetricsLogTest() {} | 221 MetricsLogTest() {} |
| 222 | 222 |
| 223 protected: | 223 protected: |
| 224 virtual void SetUp() OVERRIDE { | 224 virtual void SetUp() OVERRIDE { |
| 225 #if defined(OS_CHROMEOS) | 225 #if defined(OS_CHROMEOS) |
| 226 // Enable multi-profiles. | |
| 227 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kMultiProfiles); | |
| 228 | |
| 229 // Set up the fake Bluetooth environment, | 226 // Set up the fake Bluetooth environment, |
| 230 scoped_ptr<FakeDBusThreadManager> fake_dbus_thread_manager( | 227 scoped_ptr<FakeDBusThreadManager> fake_dbus_thread_manager( |
| 231 new FakeDBusThreadManager); | 228 new FakeDBusThreadManager); |
| 232 fake_dbus_thread_manager->SetBluetoothAdapterClient( | 229 fake_dbus_thread_manager->SetBluetoothAdapterClient( |
| 233 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); | 230 scoped_ptr<BluetoothAdapterClient>(new FakeBluetoothAdapterClient)); |
| 234 fake_dbus_thread_manager->SetBluetoothDeviceClient( | 231 fake_dbus_thread_manager->SetBluetoothDeviceClient( |
| 235 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); | 232 scoped_ptr<BluetoothDeviceClient>(new FakeBluetoothDeviceClient)); |
| 236 fake_dbus_thread_manager->SetBluetoothGattCharacteristicClient( | 233 fake_dbus_thread_manager->SetBluetoothGattCharacteristicClient( |
| 237 scoped_ptr<BluetoothGattCharacteristicClient>( | 234 scoped_ptr<BluetoothGattCharacteristicClient>( |
| 238 new FakeBluetoothGattCharacteristicClient)); | 235 new FakeBluetoothGattCharacteristicClient)); |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 PairedDevice device2 = | 784 PairedDevice device2 = |
| 788 log.system_profile().hardware().bluetooth().paired_device(1); | 785 log.system_profile().hardware().bluetooth().paired_device(1); |
| 789 | 786 |
| 790 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, | 787 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, |
| 791 device2.bluetooth_class()); | 788 device2.bluetooth_class()); |
| 792 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); | 789 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); |
| 793 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); | 790 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); |
| 794 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); | 791 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); |
| 795 } | 792 } |
| 796 #endif // OS_CHROMEOS | 793 #endif // OS_CHROMEOS |
| OLD | NEW |