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

Unified Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 221783002: Revert of gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/common/gles2_cmd_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gles2_implementation_unittest.cc
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index f57d07a8ded8be41387f469e42477697ed149271..aa9073388dca4e0e228b3374d19c9dd954701e26 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -5,8 +5,6 @@
// Tests for GLES2Implementation.
#include "gpu/command_buffer/client/gles2_implementation.h"
-
-#include <limits>
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
@@ -392,9 +390,7 @@
public:
TestContext() : commands_(NULL), token_(0) {}
- void Initialize(ShareGroup* share_group,
- bool bind_generates_resource,
- bool lose_context_when_out_of_memory) {
+ void Initialize(ShareGroup* share_group, bool bind_generates_resource) {
command_buffer_.reset(new StrictMock<MockClientCommandBuffer>());
ASSERT_TRUE(command_buffer_->Initialize());
@@ -443,12 +439,12 @@
.RetiresOnSaturation();
GetNextToken(); // eat the token that starting up will use.
- gl_.reset(new GLES2Implementation(helper_.get(),
- share_group,
- transfer_buffer_.get(),
- bind_generates_resource,
- lose_context_when_out_of_memory,
- gpu_control_.get()));
+ gl_.reset(
+ new GLES2Implementation(helper_.get(),
+ share_group,
+ transfer_buffer_.get(),
+ bind_generates_resource,
+ gpu_control_.get()));
ASSERT_TRUE(gl_->Initialize(kTransferBufferSize,
kTransferBufferSize,
kTransferBufferSize,
@@ -518,14 +514,11 @@
return gl_->query_tracker_->GetQuery(id);
}
- void Initialize(bool bind_generates_resource,
- bool lose_context_when_out_of_memory) {
+ void Initialize(bool bind_generates_resource) {
share_group_ = new ShareGroup(bind_generates_resource);
for (int i = 0; i < kNumTestContexts; i++)
- test_contexts_[i].Initialize(share_group_.get(),
- bind_generates_resource,
- lose_context_when_out_of_memory);
+ test_contexts_[i].Initialize(share_group_.get(), bind_generates_resource);
// Default to test context 0.
gpu_control_ = test_contexts_[0].gpu_control_.get();
@@ -592,20 +585,13 @@
};
void GLES2ImplementationTest::SetUp() {
- bool bind_generates_resource = true;
- bool lose_context_when_out_of_memory = false;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+ Initialize(true);
}
void GLES2ImplementationTest::TearDown() {
for (int i = 0; i < kNumTestContexts; i++)
test_contexts_[i].TearDown();
}
-
-class GLES2ImplementationManualInitTest : public GLES2ImplementationTest {
- protected:
- virtual void SetUp() OVERRIDE {}
-};
class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest {
protected:
@@ -697,9 +683,7 @@
};
void GLES2ImplementationStrictSharedTest::SetUp() {
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = false;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+ Initialize(false);
}
// GCC requires these declarations, but MSVC requires they not be present
@@ -3116,42 +3100,6 @@
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
-TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = true;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
-
- struct Cmds {
- cmds::LoseContextCHROMIUM cmd;
- };
-
- GLsizei max = std::numeric_limits<GLsizei>::max();
- EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _))
- .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL)));
- gl_->CreateImageCHROMIUM(max, max, 0);
- // The context should be lost.
- Cmds expected;
- expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB);
- EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
-}
-
-TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) {
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = false;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
-
- struct Cmds {
- cmds::LoseContextCHROMIUM cmd;
- };
-
- GLsizei max = std::numeric_limits<GLsizei>::max();
- EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _))
- .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL)));
- gl_->CreateImageCHROMIUM(max, max, 0);
- // The context should not be lost.
- EXPECT_TRUE(NoCommandsWritten());
-}
-
#include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
} // namespace gles2
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/common/gles2_cmd_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698