-
Notifications
You must be signed in to change notification settings - Fork 6k
Remove noisy log from startup #35954
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,6 +38,32 @@ TEST_F(WindowsTest, LaunchMain) { | |
| ASSERT_NE(controller, nullptr); | ||
| } | ||
|
|
||
| // Verify there is no unexpected output from launching main. | ||
| TEST_F(WindowsTest, LaunchMainHasNoOutput) { | ||
| // Replace stdout & stderr stream buffers with our own. | ||
| std::stringstream cout_buffer; | ||
| std::stringstream cerr_buffer; | ||
| std::streambuf* old_cout_buffer = std::cout.rdbuf(); | ||
| std::streambuf* old_cerr_buffer = std::cerr.rdbuf(); | ||
| std::cout.rdbuf(cout_buffer.rdbuf()); | ||
| std::cerr.rdbuf(cerr_buffer.rdbuf()); | ||
|
|
||
| auto& context = GetContext(); | ||
| WindowsConfigBuilder builder(context); | ||
| ViewControllerPtr controller{builder.Run()}; | ||
| ASSERT_NE(controller, nullptr); | ||
|
|
||
| // Restore original stdout & stderr stream buffer. | ||
| std::cout.rdbuf(old_cout_buffer); | ||
| std::cerr.rdbuf(old_cerr_buffer); | ||
|
|
||
| // Verify stdout & stderr have no output. | ||
| std::string cout = cout_buffer.str(); | ||
| std::string cerr = cerr_buffer.str(); | ||
| EXPECT_TRUE(cout.empty()); | ||
| EXPECT_TRUE(cerr.empty()); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can use
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I considered this but then found this message by the gtest folks: https://groups.google.com/g/googletestframework/c/7OTybZo-jp8
And:
I think if this becomes a common pattern we could introduce a helper to prevent possible gotchas.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I accidentally added the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems reasonable. If we find ourselves needing to do this more than once we should create an RAII wrapper that does the grabbing and restoring. |
||
| } | ||
|
|
||
| // Verify we can successfully launch a custom entry point. | ||
| TEST_F(WindowsTest, LaunchCustomEntrypoint) { | ||
| auto& context = GetContext(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The embedder API has lots of other optional callbacks that no-op if they aren't provided. The embedder API does not log a message if those other optional callbacks aren't provided.