| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/time.h" | 8 #include "base/time.h" |
| 9 #include "chrome/browser/metrics_log.h" | 9 #include "chrome/browser/metrics_log.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 using base::TimeDelta; |
| 14 |
| 13 namespace { | 15 namespace { |
| 14 class MetricsLogTest : public testing::Test { | 16 class MetricsLogTest : public testing::Test { |
| 15 }; | 17 }; |
| 16 }; | 18 }; |
| 17 | 19 |
| 18 TEST(MetricsLogTest, EmptyRecord) { | 20 TEST(MetricsLogTest, EmptyRecord) { |
| 19 std::string expected_output = "<log clientid=\"bogus client ID\"/>"; | 21 std::string expected_output = "<log clientid=\"bogus client ID\"/>"; |
| 20 | 22 |
| 21 MetricsLog log("bogus client ID", 0); | 23 MetricsLog log("bogus client ID", 0); |
| 22 log.CloseLog(); | 24 log.CloseLog(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // the metrics server uses. | 121 // the metrics server uses. |
| 120 std::string hash_hex = "0x"; | 122 std::string hash_hex = "0x"; |
| 121 for (size_t j = 0; j < 8; j++) { | 123 for (size_t j = 0; j < 8; j++) { |
| 122 StringAppendF(&hash_hex, "%02x", | 124 StringAppendF(&hash_hex, "%02x", |
| 123 static_cast<uint8>(hash_string.data()[j])); | 125 static_cast<uint8>(hash_string.data()[j])); |
| 124 } | 126 } |
| 125 EXPECT_EQ(cases[i].output, hash_hex); | 127 EXPECT_EQ(cases[i].output, hash_hex); |
| 126 } | 128 } |
| 127 }; | 129 }; |
| 128 | 130 |
| OLD | NEW |