| 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 "base/base64.h" | 5 #include "base/base64.h" |
| 6 #include "base/md5.h" | 6 #include "base/md5.h" |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/metrics/metrics_log_serializer.h" | 8 #include "chrome/browser/metrics/metrics_log_serializer.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 using metrics::MetricsLogManager; |
| 12 |
| 11 namespace { | 13 namespace { |
| 12 | 14 |
| 13 const size_t kListLengthLimit = 3; | 15 const size_t kListLengthLimit = 3; |
| 14 const size_t kLogByteLimit = 1000; | 16 const size_t kLogByteLimit = 1000; |
| 15 | 17 |
| 16 void SetLogText(const std::string& log_text, | 18 void SetLogText(const std::string& log_text, |
| 17 MetricsLogManager::SerializedLog* log) { | 19 MetricsLogManager::SerializedLog* log) { |
| 18 std::string log_text_copy = log_text; | 20 std::string log_text_copy = log_text; |
| 19 log->SwapLogText(&log_text_copy); | 21 log->SwapLogText(&log_text_copy); |
| 20 } | 22 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 EXPECT_TRUE((*(list.end() - 1))->GetAsString(&checksum)); | 265 EXPECT_TRUE((*(list.end() - 1))->GetAsString(&checksum)); |
| 264 checksum[0] = (checksum[0] == 'a') ? 'b' : 'a'; | 266 checksum[0] = (checksum[0] == 'a') ? 'b' : 'a'; |
| 265 EXPECT_TRUE(list.Set(2, base::Value::CreateStringValue(checksum))); | 267 EXPECT_TRUE(list.Set(2, base::Value::CreateStringValue(checksum))); |
| 266 EXPECT_EQ(3U, list.GetSize()); | 268 EXPECT_EQ(3U, list.GetSize()); |
| 267 | 269 |
| 268 local_list.clear(); | 270 local_list.clear(); |
| 269 EXPECT_EQ( | 271 EXPECT_EQ( |
| 270 MetricsLogSerializer::CHECKSUM_CORRUPTION, | 272 MetricsLogSerializer::CHECKSUM_CORRUPTION, |
| 271 MetricsLogSerializer::ReadLogsFromPrefList(list, &local_list)); | 273 MetricsLogSerializer::ReadLogsFromPrefList(list, &local_list)); |
| 272 } | 274 } |
| OLD | NEW |