diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 21:31:57 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 21:31:57 +0000 |
commit | efc607beca3ac04e4f0f4499459ff0314b65689b (patch) | |
tree | 2503f349e3897b2e9c82c0df2635cb6d1ec89efd /chrome/browser/metrics | |
parent | f3bf27ecccae3666f9c567630b805549b900f02e (diff) | |
download | chromium_src-efc607beca3ac04e4f0f4499459ff0314b65689b.zip chromium_src-efc607beca3ac04e4f0f4499459ff0314b65689b.tar.gz chromium_src-efc607beca3ac04e4f0f4499459ff0314b65689b.tar.bz2 |
Switch to putting appversion at top level of XML
This change puts appversion at the same level as buildtime, and
so it is avalable (now) for use in histogram versioning, as well
as stability versioning (or user metrics versioning).
r=huanr
Review URL: http://codereview.chromium.org/650017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39493 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r-- | chrome/browser/metrics/metrics_log.cc | 2 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_log_unittest.cc | 22 |
2 files changed, 13 insertions, 11 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index 6ddb61e..dd4aa3f 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -64,6 +64,7 @@ MetricsLog::MetricsLog(const std::string& client_id, int session_id) StartElement("log"); WriteAttribute("clientid", client_id_); WriteInt64Attribute("buildtime", GetBuildTime()); + WriteAttribute("appversion", GetVersionString()); DCHECK_GE(result, 0); } @@ -509,7 +510,6 @@ void MetricsLog::WriteInstallElement() { OPEN_ELEMENT_FOR_SCOPE("install"); WriteAttribute("installdate", GetInstallDate()); WriteIntAttribute("buildid", 0); // We're using appversion instead. - WriteAttribute("appversion", GetVersionString()); } void MetricsLog::RecordEnvironment( diff --git a/chrome/browser/metrics/metrics_log_unittest.cc b/chrome/browser/metrics/metrics_log_unittest.cc index 85d7aaf..4ac4cb8 100644 --- a/chrome/browser/metrics/metrics_log_unittest.cc +++ b/chrome/browser/metrics/metrics_log_unittest.cc @@ -39,8 +39,9 @@ static void NormalizeBuildtime(std::string* xml_encoded) { } TEST(MetricsLogTest, EmptyRecord) { - std::string expected_output = - "<log clientid=\"bogus client ID\" buildtime=\"123456789\"/>"; + std::string expected_output = StringPrintf( + "<log clientid=\"bogus client ID\" buildtime=\"123456789\" " + "appversion=\"%s\"/>", MetricsLog::GetVersionString().c_str()); MetricsLog log("bogus client ID", 0); log.CloseLog(); @@ -73,15 +74,16 @@ class NoTimeMetricsLog : public MetricsLog { }; // namespace TEST(MetricsLogTest, WindowEvent) { - std::string expected_output = - "<log clientid=\"bogus client ID\" buildtime=\"123456789\">\n" + std::string expected_output = StringPrintf( + "<log clientid=\"bogus client ID\" buildtime=\"123456789\" " + "appversion=\"%s\">\n" " <window action=\"create\" windowid=\"0\" session=\"0\" time=\"\"/>\n" " <window action=\"open\" windowid=\"1\" parent=\"0\" " "session=\"0\" time=\"\"/>\n" " <window action=\"close\" windowid=\"1\" parent=\"0\" " "session=\"0\" time=\"\"/>\n" " <window action=\"destroy\" windowid=\"0\" session=\"0\" time=\"\"/>\n" - "</log>"; + "</log>", MetricsLog::GetVersionString().c_str()); NoTimeMetricsLog log("bogus client ID", 0); log.RecordWindowEvent(MetricsLog::WINDOW_CREATE, 0, -1); @@ -104,12 +106,12 @@ TEST(MetricsLogTest, WindowEvent) { } TEST(MetricsLogTest, LoadEvent) { - std::string expected_output = - "<log clientid=\"bogus client ID\" buildtime=\"123456789\">\n" + std::string expected_output = StringPrintf( + "<log clientid=\"bogus client ID\" buildtime=\"123456789\" " + "appversion=\"%s\">\n" " <document action=\"load\" docid=\"1\" window=\"3\" loadtime=\"7219\" " - "origin=\"link\" " - "session=\"0\" time=\"\"/>\n" - "</log>"; + "origin=\"link\" session=\"0\" time=\"\"/>\n" + "</log>", MetricsLog::GetVersionString().c_str()); NoTimeMetricsLog log("bogus client ID", 0); log.RecordLoadEvent(3, GURL("http://google.com"), PageTransition::LINK, |