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

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

Issue 239093004: Move part of metrics from chrome/common to components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Alphabetizing DEPS Created 6 years, 8 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
OLDNEW
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"
26 #include "chrome/common/metrics/proto/profiler_event.pb.h" 26 #include "chrome/common/chrome_version_info.h"
27 #include "chrome/common/metrics/proto/system_profile.pb.h"
28 #include "chrome/common/metrics/variations/variations_util.h" 27 #include "chrome/common/metrics/variations/variations_util.h"
29 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
30 #include "chrome/installer/util/google_update_settings.h" 29 #include "chrome/installer/util/google_update_settings.h"
31 #include "components/metrics/metrics_hashes.h" 30 #include "components/metrics/metrics_hashes.h"
31 #include "components/metrics/proto/profiler_event.pb.h"
32 #include "components/metrics/proto/system_profile.pb.h"
32 #include "components/variations/metrics_util.h" 33 #include "components/variations/metrics_util.h"
33 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
34 #include "content/public/common/process_type.h" 35 #include "content/public/common/process_type.h"
35 #include "content/public/common/webplugininfo.h" 36 #include "content/public/common/webplugininfo.h"
36 #include "content/public/test/test_browser_thread_bundle.h" 37 #include "content/public/test/test_browser_thread_bundle.h"
37 #include "content/public/test/test_utils.h" 38 #include "content/public/test/test_utils.h"
38 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
39 #include "ui/gfx/size.h" 40 #include "ui/gfx/size.h"
40 #include "url/gurl.h" 41 #include "url/gurl.h"
41 42
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 EXPECT_EQ(114, tracked_object->exec_time_sampled()); 644 EXPECT_EQ(114, tracked_object->exec_time_sampled());
644 EXPECT_EQ(109, tracked_object->queue_time_total()); 645 EXPECT_EQ(109, tracked_object->queue_time_total());
645 EXPECT_EQ(104, tracked_object->queue_time_sampled()); 646 EXPECT_EQ(104, tracked_object->queue_time_sampled());
646 EXPECT_EQ(metrics::HashMetricName(""), 647 EXPECT_EQ(metrics::HashMetricName(""),
647 tracked_object->exec_thread_name_hash()); 648 tracked_object->exec_thread_name_hash());
648 EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER, 649 EXPECT_EQ(ProfilerEventProto::TrackedObject::RENDERER,
649 tracked_object->process_type()); 650 tracked_object->process_type());
650 } 651 }
651 } 652 }
652 653
654 TEST_F(MetricsLogTest, ChromeVersionWritten) {
Alexei Svitkine (slow) 2014/04/22 15:28:10 The name of this test should say "channel" somewhe
bsimonnet 2014/04/22 16:52:43 Done.
655 TestMetricsLog log("user@test.com", kSessionId, MetricsLog::ONGOING_LOG);
656 EXPECT_TRUE(log.uma_proto().system_profile().has_channel());
657 }
658
653 #if defined(OS_CHROMEOS) 659 #if defined(OS_CHROMEOS)
654 TEST_F(MetricsLogTest, MultiProfileUserCount) { 660 TEST_F(MetricsLogTest, MultiProfileUserCount) {
655 std::string user1("user1@example.com"); 661 std::string user1("user1@example.com");
656 std::string user2("user2@example.com"); 662 std::string user2("user2@example.com");
657 std::string user3("user3@example.com"); 663 std::string user3("user3@example.com");
658 664
659 // |scoped_enabler| takes over the lifetime of |user_manager|. 665 // |scoped_enabler| takes over the lifetime of |user_manager|.
660 chromeos::FakeUserManager* user_manager = new chromeos::FakeUserManager(); 666 chromeos::FakeUserManager* user_manager = new chromeos::FakeUserManager();
661 chromeos::ScopedUserManagerEnabler scoped_enabler(user_manager); 667 chromeos::ScopedUserManagerEnabler scoped_enabler(user_manager);
662 user_manager->AddKioskAppUser(user1); 668 user_manager->AddKioskAppUser(user1);
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 PairedDevice device2 = 787 PairedDevice device2 =
782 log.system_profile().hardware().bluetooth().paired_device(1); 788 log.system_profile().hardware().bluetooth().paired_device(1);
783 789
784 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass, 790 EXPECT_EQ(FakeBluetoothDeviceClient::kConfirmPasskeyClass,
785 device2.bluetooth_class()); 791 device2.bluetooth_class());
786 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type()); 792 EXPECT_EQ(PairedDevice::DEVICE_PHONE, device2.type());
787 EXPECT_EQ(0x207D74U, device2.vendor_prefix()); 793 EXPECT_EQ(0x207D74U, device2.vendor_prefix());
788 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source()); 794 EXPECT_EQ(PairedDevice::VENDOR_ID_UNKNOWN, device2.vendor_id_source());
789 } 795 }
790 #endif // OS_CHROMEOS 796 #endif // OS_CHROMEOS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698