summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
diff options
context:
space:
mode:
authorsievers <sievers@chromium.org>2015-04-27 17:45:31 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-28 00:45:49 +0000
commitfbaa5dc2fcb2e482c1daec1b9bcf1d577d53ca30 (patch)
treeb5024f14c70c616a96e9e4254315b7bce287ac27 /gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
parent8fbbc669b356f7c25b8c6417738986f5c8525d37 (diff)
downloadchromium_src-fbaa5dc2fcb2e482c1daec1b9bcf1d577d53ca30.zip
chromium_src-fbaa5dc2fcb2e482c1daec1b9bcf1d577d53ca30.tar.gz
chromium_src-fbaa5dc2fcb2e482c1daec1b9bcf1d577d53ca30.tar.bz2
gpu: Fix some context lost marking glitches+leaks and add UMA stats
* This fixes some glitches in the decoder where we were not ending up with the correct 'context lost' reason, such as calling things in the wrong order or calling glGetGraphicsResetStatus() while we might not have the correct context current. * Add context lost reasons for when the context group is forcibly lost when GL_OUT_OF_MEMORY is detected and when MakeCurrent fails. * Also communicate parse errors to the client. * Record UMA histograms for each context type (for example 'browser compositor') with the context lost reason. * Always lose (client-side) share-group if we force-lose a context so we don't leak resources. * Fix a bug where we weren't deleting GL resources if the context was lost although we might still be able to make it current. Add a bunch of tests. BUG=475676 Review URL: https://codereview.chromium.org/1095893002 Cr-Commit-Position: refs/heads/master@{#327197}
Diffstat (limited to 'gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc')
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index cae6c00..d3a20b3 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -1125,17 +1125,30 @@ TEST_P(GLES2DecoderManualInitTest, ImmutableCopyTexImage2D) {
EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
}
-TEST_P(GLES2DecoderTest, LoseContextCHROMIUMValidArgs) {
- EXPECT_CALL(*mock_decoder_, LoseContext(GL_GUILTY_CONTEXT_RESET_ARB))
+TEST_P(GLES2DecoderTest, LoseContextCHROMIUMGuilty) {
+ EXPECT_CALL(*mock_decoder_, MarkContextLost(error::kInnocent))
.Times(1);
cmds::LoseContextCHROMIUM cmd;
- cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB);
+ cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB);
EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd));
EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_TRUE(decoder_->WasContextLost());
+ EXPECT_TRUE(decoder_->WasContextLostByRobustnessExtension());
+}
+
+TEST_P(GLES2DecoderTest, LoseContextCHROMIUMUnkown) {
+ EXPECT_CALL(*mock_decoder_, MarkContextLost(error::kUnknown))
+ .Times(1);
+ cmds::LoseContextCHROMIUM cmd;
+ cmd.Init(GL_UNKNOWN_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB);
+ EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_TRUE(decoder_->WasContextLost());
+ EXPECT_TRUE(decoder_->WasContextLostByRobustnessExtension());
}
TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs0_0) {
- EXPECT_CALL(*mock_decoder_, LoseContext(_))
+ EXPECT_CALL(*mock_decoder_, MarkContextLost(_))
.Times(0);
cmds::LoseContextCHROMIUM cmd;
cmd.Init(GL_NONE, GL_GUILTY_CONTEXT_RESET_ARB);
@@ -1144,7 +1157,7 @@ TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs0_0) {
}
TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs1_0) {
- EXPECT_CALL(*mock_decoder_, LoseContext(_))
+ EXPECT_CALL(*mock_decoder_, MarkContextLost(_))
.Times(0);
cmds::LoseContextCHROMIUM cmd;
cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_NONE);