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/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "chrome/browser/metrics/metrics_log.h" | 11 #include "chrome/browser/metrics/metrics_log.h" |
12 #include "chrome/browser/prefs/browser_prefs.h" | 12 #include "chrome/browser/prefs/browser_prefs.h" |
13 #include "chrome/browser/prefs/pref_service.h" | 13 #include "chrome/browser/prefs/pref_service.h" |
| 14 #include "chrome/common/metrics/experiments_helper.h" |
14 #include "chrome/common/metrics/proto/system_profile.pb.h" | 15 #include "chrome/common/metrics/proto/system_profile.pb.h" |
15 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
16 #include "chrome/test/base/testing_pref_service.h" | 17 #include "chrome/test/base/testing_pref_service.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/gfx/size.h" | 20 #include "ui/gfx/size.h" |
20 #include "webkit/plugins/webplugininfo.h" | 21 #include "webkit/plugins/webplugininfo.h" |
21 | 22 |
22 using base::TimeDelta; | 23 using base::TimeDelta; |
23 | 24 |
24 namespace { | 25 namespace { |
25 | 26 |
26 const char kClientId[] = "bogus client ID"; | 27 const char kClientId[] = "bogus client ID"; |
27 const int kSessionId = 127; | 28 const int kSessionId = 127; |
28 const int kScreenWidth = 1024; | 29 const int kScreenWidth = 1024; |
29 const int kScreenHeight = 768; | 30 const int kScreenHeight = 768; |
30 const int kScreenCount = 3; | 31 const int kScreenCount = 3; |
31 const base::FieldTrial::NameGroupId kFieldTrialIds[] = { | 32 const experiments_helper::NameGroupId kFieldTrialIds[] = { |
32 {37, 43}, | 33 {37, 43}, |
33 {13, 47}, | 34 {13, 47}, |
34 {23, 17} | 35 {23, 17} |
35 }; | 36 }; |
36 | 37 |
37 class TestMetricsLog : public MetricsLog { | 38 class TestMetricsLog : public MetricsLog { |
38 public: | 39 public: |
39 TestMetricsLog(const std::string& client_id, int session_id) | 40 TestMetricsLog(const std::string& client_id, int session_id) |
40 : MetricsLog(client_id, session_id) { | 41 : MetricsLog(client_id, session_id) { |
41 browser::RegisterLocalState(&prefs_); | 42 browser::RegisterLocalState(&prefs_); |
(...skipping 14 matching lines...) Expand all Loading... |
56 const metrics::SystemProfileProto& system_profile() const { | 57 const metrics::SystemProfileProto& system_profile() const { |
57 return uma_proto()->system_profile(); | 58 return uma_proto()->system_profile(); |
58 } | 59 } |
59 | 60 |
60 private: | 61 private: |
61 virtual std::string GetCurrentTimeString() OVERRIDE { | 62 virtual std::string GetCurrentTimeString() OVERRIDE { |
62 return std::string(); | 63 return std::string(); |
63 } | 64 } |
64 | 65 |
65 virtual void GetFieldTrialIds( | 66 virtual void GetFieldTrialIds( |
66 std::vector<base::FieldTrial::NameGroupId>* field_trial_ids) const | 67 std::vector<experiments_helper::NameGroupId>* field_trial_ids) const |
67 OVERRIDE { | 68 OVERRIDE { |
68 ASSERT_TRUE(field_trial_ids->empty()); | 69 ASSERT_TRUE(field_trial_ids->empty()); |
69 | 70 |
70 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { | 71 for (size_t i = 0; i < arraysize(kFieldTrialIds); ++i) { |
71 field_trial_ids->push_back(kFieldTrialIds[i]); | 72 field_trial_ids->push_back(kFieldTrialIds[i]); |
72 } | 73 } |
73 } | 74 } |
74 | 75 |
75 virtual gfx::Size GetScreenSize() const OVERRIDE { | 76 virtual gfx::Size GetScreenSize() const OVERRIDE { |
76 return gfx::Size(kScreenWidth, kScreenHeight); | 77 return gfx::Size(kScreenWidth, kScreenHeight); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 EXPECT_NE(std::string::npos, | 152 EXPECT_NE(std::string::npos, |
152 encoded.find(" childprocesscrashcount=\"10\"")); | 153 encoded.find(" childprocesscrashcount=\"10\"")); |
153 EXPECT_EQ(std::string::npos, | 154 EXPECT_EQ(std::string::npos, |
154 encoded.find(" otherusercrashcount=")); | 155 encoded.find(" otherusercrashcount=")); |
155 EXPECT_EQ(std::string::npos, | 156 EXPECT_EQ(std::string::npos, |
156 encoded.find(" kernelcrashcount=")); | 157 encoded.find(" kernelcrashcount=")); |
157 EXPECT_EQ(std::string::npos, | 158 EXPECT_EQ(std::string::npos, |
158 encoded.find(" systemuncleanshutdowns=")); | 159 encoded.find(" systemuncleanshutdowns=")); |
159 } | 160 } |
160 #endif // OS_CHROMEOS | 161 #endif // OS_CHROMEOS |
OLD | NEW |