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

Side by Side Diff: testing/gmock/test/gmock-nice-strict_test.cc

Issue 3427004: clang: update gtest/gmock (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: yakshave Created 10 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
« no previous file with comments | « testing/gmock/test/gmock-matchers_test.cc ('k') | testing/gmock/test/gmock-port_test.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 2008, Google Inc. 1 // Copyright 2008, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 CaptureStdout(); 130 CaptureStdout();
131 nice_foo->DoThis(); 131 nice_foo->DoThis();
132 EXPECT_STREQ("", GetCapturedStdout().c_str()); 132 EXPECT_STREQ("", GetCapturedStdout().c_str());
133 } 133 }
134 134
135 // Tests that a nice mock generates informational logs for 135 // Tests that a nice mock generates informational logs for
136 // uninteresting calls. 136 // uninteresting calls.
137 TEST(NiceMockTest, InfoForUninterestingCall) { 137 TEST(NiceMockTest, InfoForUninterestingCall) {
138 NiceMock<MockFoo> nice_foo; 138 NiceMock<MockFoo> nice_foo;
139 139
140 const string saved_flag = GMOCK_FLAG(verbose);
140 GMOCK_FLAG(verbose) = "info"; 141 GMOCK_FLAG(verbose) = "info";
141 CaptureStdout(); 142 CaptureStdout();
142 nice_foo.DoThis(); 143 nice_foo.DoThis();
143 EXPECT_THAT(GetCapturedStdout(), 144 EXPECT_THAT(GetCapturedStdout(),
144 HasSubstr("Uninteresting mock function call")); 145 HasSubstr("Uninteresting mock function call"));
145 146
146 CaptureStdout(); 147 CaptureStdout();
147 nice_foo.DoThat(true); 148 nice_foo.DoThat(true);
148 EXPECT_THAT(GetCapturedStdout(), 149 EXPECT_THAT(GetCapturedStdout(),
149 HasSubstr("Uninteresting mock function call")); 150 HasSubstr("Uninteresting mock function call"));
151 GMOCK_FLAG(verbose) = saved_flag;
150 } 152 }
151 153
152 #endif // GTEST_HAS_STREAM_REDIRECTION_ 154 #endif // GTEST_HAS_STREAM_REDIRECTION_
153 155
154 // Tests that a nice mock allows expected calls. 156 // Tests that a nice mock allows expected calls.
155 TEST(NiceMockTest, AllowsExpectedCall) { 157 TEST(NiceMockTest, AllowsExpectedCall) {
156 NiceMock<MockFoo> nice_foo; 158 NiceMock<MockFoo> nice_foo;
157 159
158 EXPECT_CALL(nice_foo, DoThis()); 160 EXPECT_CALL(nice_foo, DoThis());
159 nice_foo.DoThis(); 161 nice_foo.DoThis();
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // causes the program to crash there, for reasons unclear to us yet. 275 // causes the program to crash there, for reasons unclear to us yet.
274 TEST(StrictMockTest, AcceptsClassNamedMock) { 276 TEST(StrictMockTest, AcceptsClassNamedMock) {
275 StrictMock< ::Mock> strict; 277 StrictMock< ::Mock> strict;
276 EXPECT_CALL(strict, DoThis()); 278 EXPECT_CALL(strict, DoThis());
277 strict.DoThis(); 279 strict.DoThis();
278 } 280 }
279 #endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE 281 #endif // !GTEST_OS_SYMBIAN && !GTEST_OS_WINDOWS_MOBILE
280 282
281 } // namespace gmock_nice_strict_test 283 } // namespace gmock_nice_strict_test
282 } // namespace testing 284 } // namespace testing
OLDNEW
« no previous file with comments | « testing/gmock/test/gmock-matchers_test.cc ('k') | testing/gmock/test/gmock-port_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698