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

Side by Side Diff: components/proximity_auth/logging/logging_unittest.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/proximity_auth/logging/logging.h" 5 #include "components/proximity_auth/logging/logging.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/numerics/safe_conversions.h" 10 #include "base/numerics/safe_conversions.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "components/proximity_auth/logging/log_buffer.h" 12 #include "components/proximity_auth/logging/log_buffer.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace proximity_auth { 15 namespace proximity_auth {
16 16
17 namespace { 17 namespace {
18 18
19 const char kLog1[] = "Mahogony destined to make a sturdy table"; 19 const char kLog1[] = "Mahogony destined to make a sturdy table";
20 const char kLog2[] = "Construction grade cedar"; 20 const char kLog2[] = "Construction grade cedar";
21 const char kLog3[] = "Pine infested by hungry beetles"; 21 const char kLog3[] = "Pine infested by hungry beetles";
22 22
23 // Called for every log message added to the standard logging system. The new 23 // Called for every log message added to the standard logging system. The new
24 // log is saved in |g_standard_logs| and consumed so it does not flood stdout. 24 // log is saved in |g_standard_logs| and consumed so it does not flood stdout.
25 base::LazyInstance<std::vector<std::string>> g_standard_logs = 25 base::LazyInstance<std::vector<std::string>>::DestructorAtExit g_standard_logs =
26 LAZY_INSTANCE_INITIALIZER; 26 LAZY_INSTANCE_INITIALIZER;
27 bool HandleStandardLogMessage(int severity, 27 bool HandleStandardLogMessage(int severity,
28 const char* file, 28 const char* file,
29 int line, 29 int line,
30 size_t message_start, 30 size_t message_start,
31 const std::string& str) { 31 const std::string& str) {
32 g_standard_logs.Get().push_back(str); 32 g_standard_logs.Get().push_back(str);
33 return true; 33 return true;
34 } 34 }
35 35
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 PA_LOG(WARNING) << kLog2; 110 PA_LOG(WARNING) << kLog2;
111 PA_LOG(ERROR) << kLog3; 111 PA_LOG(ERROR) << kLog3;
112 112
113 ASSERT_EQ(3u, g_standard_logs.Get().size()); 113 ASSERT_EQ(3u, g_standard_logs.Get().size());
114 EXPECT_NE(std::string::npos, g_standard_logs.Get()[0].find(kLog1)); 114 EXPECT_NE(std::string::npos, g_standard_logs.Get()[0].find(kLog1));
115 EXPECT_NE(std::string::npos, g_standard_logs.Get()[1].find(kLog2)); 115 EXPECT_NE(std::string::npos, g_standard_logs.Get()[1].find(kLog2));
116 EXPECT_NE(std::string::npos, g_standard_logs.Get()[2].find(kLog3)); 116 EXPECT_NE(std::string::npos, g_standard_logs.Get()[2].find(kLog3));
117 } 117 }
118 118
119 } // namespace proximity_auth 119 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_loader_win.cc ('k') | components/proximity_auth/screenlock_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698