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

Unified Diff: testing/gmock/test/gmock-nice-strict_test.cc

Issue 1151006: Update to current gtest/gmock. (Closed)
Patch Set: rebase Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/gmock/test/gmock-matchers_test.cc ('k') | testing/gmock/test/gmock-printers_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/gmock/test/gmock-nice-strict_test.cc
diff --git a/testing/gmock/test/gmock-nice-strict_test.cc b/testing/gmock/test/gmock-nice-strict_test.cc
index 1d36e03ebb85daf29738b73c24f4e2249d6fb7a6..f6f278e85747d99a10f10397d77f2e3e60ee92bc 100644
--- a/testing/gmock/test/gmock-nice-strict_test.cc
+++ b/testing/gmock/test/gmock-nice-strict_test.cc
@@ -57,6 +57,11 @@ using testing::HasSubstr;
using testing::NiceMock;
using testing::StrictMock;
+#if GTEST_HAS_STREAM_REDIRECTION_
+using testing::internal::CaptureStdout;
+using testing::internal::GetCapturedStdout;
+#endif // GTEST_HAS_STREAM_REDIRECTION_
+
// Defines some mock classes needed by the tests.
class Foo {
@@ -102,17 +107,16 @@ class MockBar {
GTEST_DISALLOW_COPY_AND_ASSIGN_(MockBar);
};
-// TODO(wan@google.com): find a way to re-enable these tests.
-#if 0
+#if GTEST_HAS_STREAM_REDIRECTION_
// Tests that a nice mock generates no warning for uninteresting calls.
TEST(NiceMockTest, NoWarningForUninterestingCall) {
NiceMock<MockFoo> nice_foo;
- CaptureTestStdout();
+ CaptureStdout();
nice_foo.DoThis();
nice_foo.DoThat(true);
- EXPECT_EQ("", GetCapturedTestStdout());
+ EXPECT_STREQ("", GetCapturedStdout().c_str());
}
// Tests that a nice mock generates no warning for uninteresting calls
@@ -123,9 +127,9 @@ TEST(NiceMockTest, NoWarningForUninterestingCallAfterDeath) {
ON_CALL(*nice_foo, DoThis())
.WillByDefault(Invoke(nice_foo, &MockFoo::Delete));
- CaptureTestStdout();
+ CaptureStdout();
nice_foo->DoThis();
- EXPECT_EQ("", GetCapturedTestStdout());
+ EXPECT_STREQ("", GetCapturedStdout().c_str());
}
// Tests that a nice mock generates informational logs for
@@ -134,18 +138,18 @@ TEST(NiceMockTest, InfoForUninterestingCall) {
NiceMock<MockFoo> nice_foo;
GMOCK_FLAG(verbose) = "info";
- CaptureTestStdout();
+ CaptureStdout();
nice_foo.DoThis();
- EXPECT_THAT(GetCapturedTestStdout(),
+ EXPECT_THAT(GetCapturedStdout(),
HasSubstr("Uninteresting mock function call"));
- CaptureTestStdout();
+ CaptureStdout();
nice_foo.DoThat(true);
- EXPECT_THAT(GetCapturedTestStdout(),
+ EXPECT_THAT(GetCapturedStdout(),
HasSubstr("Uninteresting mock function call"));
}
-#endif // 0
+#endif // GTEST_HAS_STREAM_REDIRECTION_
// Tests that a nice mock allows expected calls.
TEST(NiceMockTest, AllowsExpectedCall) {
« no previous file with comments | « testing/gmock/test/gmock-matchers_test.cc ('k') | testing/gmock/test/gmock-printers_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698