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

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

Issue 10151017: Remove the hash fields from FieldTrials. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: header order Created 8 years, 7 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
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | chrome/common/metrics/experiments_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/port.h" 8 #include "base/port.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
11 #include "base/time.h" 11 #include "base/time.h"
12 #include "base/tracked_objects.h" 12 #include "base/tracked_objects.h"
13 #include "chrome/browser/metrics/metrics_log.h" 13 #include "chrome/browser/metrics/metrics_log.h"
14 #include "chrome/browser/prefs/browser_prefs.h" 14 #include "chrome/browser/prefs/browser_prefs.h"
15 #include "chrome/browser/prefs/pref_service.h" 15 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/common/metrics/experiments_helper.h"
16 #include "chrome/common/metrics/proto/profiler_event.pb.h" 17 #include "chrome/common/metrics/proto/profiler_event.pb.h"
17 #include "chrome/common/metrics/proto/system_profile.pb.h" 18 #include "chrome/common/metrics/proto/system_profile.pb.h"
18 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
19 #include "chrome/test/base/testing_pref_service.h" 20 #include "chrome/test/base/testing_pref_service.h"
20 #include "googleurl/src/gurl.h" 21 #include "googleurl/src/gurl.h"
21 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "ui/gfx/size.h" 23 #include "ui/gfx/size.h"
23 #include "webkit/plugins/webplugininfo.h" 24 #include "webkit/plugins/webplugininfo.h"
24 25
25 using base::TimeDelta; 26 using base::TimeDelta;
26 using metrics::ProfilerEventProto; 27 using metrics::ProfilerEventProto;
27 using tracked_objects::ProcessDataSnapshot; 28 using tracked_objects::ProcessDataSnapshot;
28 using tracked_objects::TaskSnapshot; 29 using tracked_objects::TaskSnapshot;
29 30
30 namespace { 31 namespace {
31 32
32 const char kClientId[] = "bogus client ID"; 33 const char kClientId[] = "bogus client ID";
33 const int kSessionId = 127; 34 const int kSessionId = 127;
34 const int kScreenWidth = 1024; 35 const int kScreenWidth = 1024;
35 const int kScreenHeight = 768; 36 const int kScreenHeight = 768;
36 const int kScreenCount = 3; 37 const int kScreenCount = 3;
37 const base::FieldTrial::NameGroupId kFieldTrialIds[] = { 38 const experiments_helper::SelectedGroupId kFieldTrialIds[] = {
38 {37, 43}, 39 {37, 43},
39 {13, 47}, 40 {13, 47},
40 {23, 17} 41 {23, 17}
41 }; 42 };
42 43
43 class TestMetricsLog : public MetricsLog { 44 class TestMetricsLog : public MetricsLog {
44 public: 45 public:
45 TestMetricsLog(const std::string& client_id, int session_id) 46 TestMetricsLog(const std::string& client_id, int session_id)
46 : MetricsLog(client_id, session_id) { 47 : MetricsLog(client_id, session_id) {
47 browser::RegisterLocalState(&prefs_); 48 browser::RegisterLocalState(&prefs_);
(...skipping 18 matching lines...) Expand all
66 const metrics::SystemProfileProto& system_profile() const { 67 const metrics::SystemProfileProto& system_profile() const {
67 return uma_proto().system_profile(); 68 return uma_proto().system_profile();
68 } 69 }
69 70
70 private: 71 private:
71 virtual std::string GetCurrentTimeString() OVERRIDE { 72 virtual std::string GetCurrentTimeString() OVERRIDE {
72 return std::string(); 73 return std::string();
73 } 74 }
74 75
75 virtual void GetFieldTrialIds( 76 virtual void GetFieldTrialIds(
76 std::vector<base::FieldTrial::NameGroupId>* field_trial_ids) const 77 std::vector<experiments_helper::SelectedGroupId>* field_trial_ids) const
77 OVERRIDE { 78 OVERRIDE {
78 ASSERT_TRUE(field_trial_ids->empty()); 79 ASSERT_TRUE(field_trial_ids->empty());
79 80
80 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { 81 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) {
81 field_trial_ids->push_back(kFieldTrialIds[i]); 82 field_trial_ids->push_back(kFieldTrialIds[i]);
82 } 83 }
83 } 84 }
84 85
85 virtual gfx::Size GetScreenSize() const OVERRIDE { 86 virtual gfx::Size GetScreenSize() const OVERRIDE {
86 return gfx::Size(kScreenWidth, kScreenHeight); 87 return gfx::Size(kScreenWidth, kScreenHeight);
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 EXPECT_NE(std::string::npos, 293 EXPECT_NE(std::string::npos,
293 encoded.find(" childprocesscrashcount=\"10\"")); 294 encoded.find(" childprocesscrashcount=\"10\""));
294 EXPECT_EQ(std::string::npos, 295 EXPECT_EQ(std::string::npos,
295 encoded.find(" otherusercrashcount=")); 296 encoded.find(" otherusercrashcount="));
296 EXPECT_EQ(std::string::npos, 297 EXPECT_EQ(std::string::npos,
297 encoded.find(" kernelcrashcount=")); 298 encoded.find(" kernelcrashcount="));
298 EXPECT_EQ(std::string::npos, 299 EXPECT_EQ(std::string::npos,
299 encoded.find(" systemuncleanshutdowns=")); 300 encoded.find(" systemuncleanshutdowns="));
300 } 301 }
301 #endif // OS_CHROMEOS 302 #endif // OS_CHROMEOS
OLDNEW
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | chrome/common/metrics/experiments_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698