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 "chrome/common/metrics/metrics_log_manager.h" | 5 #include "components/metrics/metrics_log_manager.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/sha1.h" | 11 #include "base/sha1.h" |
12 #include "chrome/common/metrics/metrics_log_base.h" | 12 #include "components/metrics/metrics_log_base.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
| 15 namespace metrics { |
| 16 |
15 namespace { | 17 namespace { |
16 | 18 |
17 // Dummy serializer that just stores logs in memory. | 19 // Dummy serializer that just stores logs in memory. |
18 class DummyLogSerializer : public MetricsLogManager::LogSerializer { | 20 class DummyLogSerializer : public MetricsLogManager::LogSerializer { |
19 public: | 21 public: |
20 virtual void SerializeLogs( | 22 virtual void SerializeLogs( |
21 const std::vector<MetricsLogManager::SerializedLog>& logs, | 23 const std::vector<MetricsLogManager::SerializedLog>& logs, |
22 MetricsLogManager::LogType log_type) OVERRIDE { | 24 MetricsLogManager::LogType log_type) OVERRIDE { |
23 persisted_logs_[log_type] = logs; | 25 persisted_logs_[log_type] = logs; |
24 } | 26 } |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 foo = kFooText; | 416 foo = kFooText; |
415 log2.SwapLogText(&foo); | 417 log2.SwapLogText(&foo); |
416 log.Swap(&log2); | 418 log.Swap(&log2); |
417 EXPECT_FALSE(log.IsEmpty()); | 419 EXPECT_FALSE(log.IsEmpty()); |
418 EXPECT_EQ(kFooText, log.log_text()); | 420 EXPECT_EQ(kFooText, log.log_text()); |
419 EXPECT_EQ(foo_hash, log.log_hash()); | 421 EXPECT_EQ(foo_hash, log.log_hash()); |
420 EXPECT_TRUE(log2.IsEmpty()); | 422 EXPECT_TRUE(log2.IsEmpty()); |
421 EXPECT_TRUE(log2.log_text().empty()); | 423 EXPECT_TRUE(log2.log_text().empty()); |
422 EXPECT_TRUE(log2.log_hash().empty()); | 424 EXPECT_TRUE(log2.log_hash().empty()); |
423 } | 425 } |
| 426 |
| 427 } // namespace metrics |
OLD | NEW |