| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 {13, 47}, | 62 {13, 47}, |
| 63 {23, 17} | 63 {23, 17} |
| 64 }; | 64 }; |
| 65 | 65 |
| 66 class TestMetricsLog : public MetricsLog { | 66 class TestMetricsLog : public MetricsLog { |
| 67 public: | 67 public: |
| 68 TestMetricsLog(const std::string& client_id, int session_id) | 68 TestMetricsLog(const std::string& client_id, int session_id) |
| 69 : MetricsLog(client_id, session_id), | 69 : MetricsLog(client_id, session_id), |
| 70 brand_for_testing_(kBrandForTesting) { | 70 brand_for_testing_(kBrandForTesting) { |
| 71 chrome::RegisterLocalState(prefs_.registry()); | 71 chrome::RegisterLocalState(prefs_.registry()); |
| 72 | 72 // prefs_.SetString(prefs::kHomePage, "http://www.google.com/foo"); |
| 73 prefs_.SetInt64(prefs::kInstallDate, kInstallDate); | 73 prefs_.SetInt64(prefs::kInstallDate, kInstallDate); |
| 74 prefs_.SetString(prefs::kMetricsClientIDTimestamp, | 74 prefs_.SetString(prefs::kMetricsClientIDTimestamp, |
| 75 base::Int64ToString(kEnabledDate)); | 75 base::Int64ToString(kEnabledDate)); |
| 76 #if defined(OS_CHROMEOS) | 76 #if defined(OS_CHROMEOS) |
| 77 prefs_.SetInteger(prefs::kStabilityChildProcessCrashCount, 10); | 77 prefs_.SetInteger(prefs::kStabilityChildProcessCrashCount, 10); |
| 78 prefs_.SetInteger(prefs::kStabilityOtherUserCrashCount, 11); | 78 prefs_.SetInteger(prefs::kStabilityOtherUserCrashCount, 11); |
| 79 prefs_.SetInteger(prefs::kStabilityKernelCrashCount, 12); | 79 prefs_.SetInteger(prefs::kStabilityKernelCrashCount, 12); |
| 80 prefs_.SetInteger(prefs::kStabilitySystemUncleanShutdownCount, 13); | 80 prefs_.SetInteger(prefs::kStabilitySystemUncleanShutdownCount, 13); |
| 81 #endif // OS_CHROMEOS | 81 #endif // OS_CHROMEOS |
| 82 } | 82 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 system_profile.hardware(); | 163 system_profile.hardware(); |
| 164 EXPECT_EQ(kScreenWidth, hardware.primary_screen_width()); | 164 EXPECT_EQ(kScreenWidth, hardware.primary_screen_width()); |
| 165 EXPECT_EQ(kScreenHeight, hardware.primary_screen_height()); | 165 EXPECT_EQ(kScreenHeight, hardware.primary_screen_height()); |
| 166 EXPECT_EQ(kScreenScaleFactor, hardware.primary_screen_scale_factor()); | 166 EXPECT_EQ(kScreenScaleFactor, hardware.primary_screen_scale_factor()); |
| 167 EXPECT_EQ(kScreenCount, hardware.screen_count()); | 167 EXPECT_EQ(kScreenCount, hardware.screen_count()); |
| 168 | 168 |
| 169 EXPECT_TRUE(hardware.has_cpu()); | 169 EXPECT_TRUE(hardware.has_cpu()); |
| 170 EXPECT_TRUE(hardware.cpu().has_vendor_name()); | 170 EXPECT_TRUE(hardware.cpu().has_vendor_name()); |
| 171 EXPECT_TRUE(hardware.cpu().has_signature()); | 171 EXPECT_TRUE(hardware.cpu().has_signature()); |
| 172 | 172 |
| 173 EXPECT_TRUE(system_profile.has_bloom_filter_bits()); |
| 174 EXPECT_EQ((uint64_t)128, system_profile.bloom_filter_bits().length()); |
| 175 |
| 173 // TODO(isherman): Verify other data written into the protobuf as a result | 176 // TODO(isherman): Verify other data written into the protobuf as a result |
| 174 // of this call. | 177 // of this call. |
| 175 } | 178 } |
| 176 | 179 |
| 177 virtual void SetUp() OVERRIDE { | 180 virtual void SetUp() OVERRIDE { |
| 178 #if defined(OS_CHROMEOS) | 181 #if defined(OS_CHROMEOS) |
| 179 fake_dbus_thread_manager_ = new chromeos::FakeDBusThreadManager(); | 182 fake_dbus_thread_manager_ = new chromeos::FakeDBusThreadManager(); |
| 180 chromeos::DBusThreadManager::InitializeForTesting( | 183 chromeos::DBusThreadManager::InitializeForTesting( |
| 181 fake_dbus_thread_manager_); | 184 fake_dbus_thread_manager_); |
| 182 | 185 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 392 |
| 390 TestMetricsLog log(kClientId, kSessionId); | 393 TestMetricsLog log(kClientId, kSessionId); |
| 391 EXPECT_EQ(1u, log.system_profile().multi_profile_user_count()); | 394 EXPECT_EQ(1u, log.system_profile().multi_profile_user_count()); |
| 392 | 395 |
| 393 user_manager->LoginUser(user2); | 396 user_manager->LoginUser(user2); |
| 394 log.RecordEnvironmentProto(std::vector<content::WebPluginInfo>(), | 397 log.RecordEnvironmentProto(std::vector<content::WebPluginInfo>(), |
| 395 GoogleUpdateMetrics()); | 398 GoogleUpdateMetrics()); |
| 396 EXPECT_EQ(0u, log.system_profile().multi_profile_user_count()); | 399 EXPECT_EQ(0u, log.system_profile().multi_profile_user_count()); |
| 397 } | 400 } |
| 398 #endif // OS_CHROMEOS | 401 #endif // OS_CHROMEOS |
| OLD | NEW |