Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: chrome/common/metrics/metrics_log_manager_unittest.cc

Issue 12226045: Linux/ChromeOS Chromium style checker cleanup, chrome/ edition part 1. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include <utility> 6 #include <utility>
7 #include <vector> 7 #include <vector>
8 8
9 #include "chrome/common/metrics/metrics_log_base.h" 9 #include "chrome/common/metrics/metrics_log_base.h"
10 #include "chrome/common/metrics/metrics_log_manager.h" 10 #include "chrome/common/metrics/metrics_log_manager.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 typedef MetricsLogManager::SerializedLog SerializedLog; 13 typedef MetricsLogManager::SerializedLog SerializedLog;
14 14
15 namespace { 15 namespace {
16 16
17 class MetricsLogManagerTest : public testing::Test { 17 class MetricsLogManagerTest : public testing::Test {
18 }; 18 };
19 19
20 // Dummy serializer that just stores logs in memory. 20 // Dummy serializer that just stores logs in memory.
21 class DummyLogSerializer : public MetricsLogManager::LogSerializer { 21 class DummyLogSerializer : public MetricsLogManager::LogSerializer {
22 public: 22 public:
23 virtual void SerializeLogs(const std::vector<SerializedLog>& logs, 23 virtual void SerializeLogs(const std::vector<SerializedLog>& logs,
24 MetricsLogManager::LogType log_type) { 24 MetricsLogManager::LogType log_type) OVERRIDE {
25 persisted_logs_[log_type] = logs; 25 persisted_logs_[log_type] = logs;
26 } 26 }
27 27
28 virtual void DeserializeLogs(MetricsLogManager::LogType log_type, 28 virtual void DeserializeLogs(MetricsLogManager::LogType log_type,
29 std::vector<SerializedLog>* logs) { 29 std::vector<SerializedLog>* logs) OVERRIDE {
30 ASSERT_NE(static_cast<void*>(NULL), logs); 30 ASSERT_NE(static_cast<void*>(NULL), logs);
31 *logs = persisted_logs_[log_type]; 31 *logs = persisted_logs_[log_type];
32 } 32 }
33 33
34 // Returns the number of logs of the given type. 34 // Returns the number of logs of the given type.
35 size_t TypeCount(MetricsLogManager::LogType log_type) { 35 size_t TypeCount(MetricsLogManager::LogType log_type) {
36 return persisted_logs_[log_type].size(); 36 return persisted_logs_[log_type].size();
37 } 37 }
38 38
39 // In-memory "persitent storage". 39 // In-memory "persitent storage".
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 EXPECT_TRUE(log_manager.has_staged_log_xml()); 411 EXPECT_TRUE(log_manager.has_staged_log_xml());
412 EXPECT_FALSE(log_manager.has_staged_log_proto()); 412 EXPECT_FALSE(log_manager.has_staged_log_proto());
413 EXPECT_FALSE(log_manager.staged_log_text().empty()); 413 EXPECT_FALSE(log_manager.staged_log_text().empty());
414 414
415 log_manager.DiscardStagedLogXml(); 415 log_manager.DiscardStagedLogXml();
416 EXPECT_FALSE(log_manager.has_staged_log()); 416 EXPECT_FALSE(log_manager.has_staged_log());
417 EXPECT_FALSE(log_manager.has_staged_log_xml()); 417 EXPECT_FALSE(log_manager.has_staged_log_xml());
418 EXPECT_FALSE(log_manager.has_staged_log_proto()); 418 EXPECT_FALSE(log_manager.has_staged_log_proto());
419 EXPECT_TRUE(log_manager.staged_log_text().empty()); 419 EXPECT_TRUE(log_manager.staged_log_text().empty());
420 } 420 }
OLDNEW
« no previous file with comments | « chrome/common/metrics/entropy_provider_unittest.cc ('k') | chrome/common/multi_process_lock_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698