Commit 9d7cd643 authored by Victor Costan's avatar Victor Costan Committed by Commit Bot

Fix warnings exposed by googletest update.

These patches are taken out of googletest update
https://crrev.com/c/900544. That CL has been reverted, and fixing the
revert cause may take a while. Landing these patches now, separately,
will reduce the size of the next googletest update CL, and might reduce
code churn, if the googletest update CL needs to be reverted.

Bug: 813219
Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I19022e107f459e1dce91921336346c610ec51409
Reviewed-on: https://chromium-review.googlesource.com/924444
Commit-Queue: Victor Costan <pwnall@chromium.org>
Reviewed-by: default avatarAntoine Labour <piman@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537444}
parent f5b11eb9
...@@ -1581,7 +1581,11 @@ TEST_P(GLES2DecoderDoCommandsTest, DoCommandsBadArgSize) { ...@@ -1581,7 +1581,11 @@ TEST_P(GLES2DecoderDoCommandsTest, DoCommandsBadArgSize) {
decoder_->DoCommands( decoder_->DoCommands(
2, &cmds_, entries_per_cmd_ * 2 + 1, &num_processed)); 2, &cmds_, entries_per_cmd_ * 2 + 1, &num_processed));
EXPECT_EQ(GL_NO_ERROR, GetGLError()); EXPECT_EQ(GL_NO_ERROR, GetGLError());
EXPECT_EQ(entries_per_cmd_ + cmds_[1].header.size, num_processed); // gpu::CommandHeader::size is a 21-bit field, so casting it to int is safe.
// Without the explicit cast, Visual Studio ends up promoting the left hand
// side to unsigned, and emits a sign mismatch warning.
EXPECT_EQ(entries_per_cmd_ + static_cast<int>(cmds_[1].header.size),
num_processed);
} }
class GLES2DecoderDescheduleUntilFinishedTest : public GLES2DecoderTest { class GLES2DecoderDescheduleUntilFinishedTest : public GLES2DecoderTest {
......
...@@ -24,7 +24,9 @@ TEST(HTMLParserIdiomsTest, ParseHTMLInteger) { ...@@ -24,7 +24,9 @@ TEST(HTMLParserIdiomsTest, ParseHTMLInteger) {
EXPECT_TRUE(ParseHTMLInteger("-2147483647", value)); EXPECT_TRUE(ParseHTMLInteger("-2147483647", value));
EXPECT_EQ(-2147483647, value); EXPECT_EQ(-2147483647, value);
EXPECT_TRUE(ParseHTMLInteger("-2147483648", value)); EXPECT_TRUE(ParseHTMLInteger("-2147483648", value));
EXPECT_EQ(0 - 2147483648, value); // The static_cast prevents a sign mismatch warning on Visual Studio, which
// automatically promotes the subtraction result to unsigned long.
EXPECT_EQ(static_cast<int>(0 - 2147483648), value);
value = 12345; value = 12345;
EXPECT_FALSE(ParseHTMLInteger("-2147483649", value)); EXPECT_FALSE(ParseHTMLInteger("-2147483649", value));
EXPECT_EQ(12345, value); EXPECT_EQ(12345, value);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment