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

Side by Side Diff: chrome/browser/sync_file_system/logger_unittest.cc

Issue 1349783006: Cleanup: Pass std::string as const reference if possible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert third_party changes Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/sync_file_system/logger.h" 5 #include "chrome/browser/sync_file_system/logger.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 using drive::EventLogger; 8 using drive::EventLogger;
9 9
10 namespace sync_file_system { 10 namespace sync_file_system {
11 11
12 namespace { 12 namespace {
13 13
14 // Logs one event at each supported LogSeverity level. 14 // Logs one event at each supported LogSeverity level.
15 void LogSampleEvents() { 15 void LogSampleEvents() {
16 util::Log(logging::LOG_INFO, FROM_HERE, "Info test message"); 16 util::Log(logging::LOG_INFO, FROM_HERE, "Info test message");
17 util::Log(logging::LOG_WARNING, FROM_HERE, "Warning test message"); 17 util::Log(logging::LOG_WARNING, FROM_HERE, "Warning test message");
18 util::Log(logging::LOG_ERROR, FROM_HERE, "Error test message"); 18 util::Log(logging::LOG_ERROR, FROM_HERE, "Error test message");
19 } 19 }
20 20
21 bool ContainsString(std::string contains_string, EventLogger::Event event) { 21 bool ContainsString(const std::string& contains_string,
22 EventLogger::Event event) {
22 return event.what.find(contains_string) != std::string::npos; 23 return event.what.find(contains_string) != std::string::npos;
23 } 24 }
24 25
25 } // namespace 26 } // namespace
26 27
27 class LoggerTest : public testing::Test { 28 class LoggerTest : public testing::Test {
28 public: 29 public:
29 LoggerTest() {} 30 LoggerTest() {}
30 31
31 void SetUp() override { 32 void SetUp() override {
(...skipping 18 matching lines...) Expand all
50 TEST_F(LoggerTest, ClearLog) { 51 TEST_F(LoggerTest, ClearLog) {
51 LogSampleEvents(); 52 LogSampleEvents();
52 EXPECT_EQ(3u, util::GetLogHistory().size()); 53 EXPECT_EQ(3u, util::GetLogHistory().size());
53 54
54 util::ClearLog(); 55 util::ClearLog();
55 EXPECT_EQ(0u, util::GetLogHistory().size()); 56 EXPECT_EQ(0u, util::GetLogHistory().size());
56 } 57 }
57 58
58 59
59 } // namespace sync_file_system 60 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698