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

Side by Side Diff: base/logging_unittest.cc

Issue 367063006: Move logging.h's definitions of operator<< into namespace std. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a // namespace std. Created 6 years, 5 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
« no previous file with comments | « base/logging.cc ('k') | base/test/launcher/test_results_tracker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 7
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 TEST_F(LoggingTest, DcheckReleaseBehavior) { 227 TEST_F(LoggingTest, DcheckReleaseBehavior) {
228 int some_variable = 1; 228 int some_variable = 1;
229 // These should still reference |some_variable| so we don't get 229 // These should still reference |some_variable| so we don't get
230 // unused variable warnings. 230 // unused variable warnings.
231 DCHECK(some_variable) << "test"; 231 DCHECK(some_variable) << "test";
232 DPCHECK(some_variable) << "test"; 232 DPCHECK(some_variable) << "test";
233 DCHECK_EQ(some_variable, 1) << "test"; 233 DCHECK_EQ(some_variable, 1) << "test";
234 } 234 }
235 235
236 // Test that defining an operator<< for a type in a namespace doesn't prevent
237 // other code in that namespace from calling the operator<<(ostream, wstring)
238 // defined by logging.h. This can fail if operator<<(ostream, wstring) can't be
239 // found by ADL, since defining another operator<< prevents name lookup from
240 // looking in the global namespace.
241 namespace nested_test {
242 class Streamable {};
243 ALLOW_UNUSED std::ostream& operator<<(std::ostream& out, const Streamable&) {
244 return out << "Streamable";
245 }
246 TEST_F(LoggingTest, StreamingWstringFindsCorrectOperator) {
247 std::wstring wstr = L"Hello World";
248 std::ostringstream ostr;
249 ostr << wstr;
250 EXPECT_EQ("Hello World", ostr.str());
251 }
252 } // namespace nested_test
253
236 } // namespace 254 } // namespace
237 255
238 } // namespace logging 256 } // namespace logging
OLDNEW
« no previous file with comments | « base/logging.cc ('k') | base/test/launcher/test_results_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698