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

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

Issue 267683008: ChromeOS only version of r261563 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/src/
Patch Set: Created 6 years, 8 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.cc » ('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
===================================================================
--- gpu/command_buffer/client/gles2_implementation_unittest.cc (revision 267947)
+++ gpu/command_buffer/client/gles2_implementation_unittest.cc (working copy)
@@ -392,11 +392,22 @@
public:
TestContext() : commands_(NULL), token_(0) {}
+#if defined(OS_CHROMEOS)
+ bool Initialize(ShareGroup* share_group,
+ bool bind_generates_resource,
+ bool lose_context_when_out_of_memory) {
+#else
void Initialize(ShareGroup* share_group,
bool bind_generates_resource,
bool lose_context_when_out_of_memory) {
+#endif
command_buffer_.reset(new StrictMock<MockClientCommandBuffer>());
+#if defined(OS_CHROMEOS)
+ if (!command_buffer_->Initialize())
+ return false;
+#else
ASSERT_TRUE(command_buffer_->Initialize());
+#endif
transfer_buffer_.reset(
new MockTransferBuffer(command_buffer_.get(),
@@ -426,6 +437,10 @@
int_state.max_vertex_uniform_vectors = kMaxVertexUniformVectors;
int_state.num_compressed_texture_formats = kNumCompressedTextureFormats;
int_state.num_shader_binary_formats = kNumShaderBinaryFormats;
+#if defined(OS_CHROMEOS)
+ int_state.bind_generates_resource_chromium =
+ bind_generates_resource ? 1 : 0;
+#endif
// This just happens to work for now because IntState has 1 GLint per
// state.
@@ -449,10 +464,18 @@
bind_generates_resource,
lose_context_when_out_of_memory,
gpu_control_.get()));
+#if defined(OS_CHROMEOS)
+ if (!gl_->Initialize(kTransferBufferSize,
+ kTransferBufferSize,
+ kTransferBufferSize,
+ GLES2Implementation::kNoLimit))
+ return false;
+#else
ASSERT_TRUE(gl_->Initialize(kTransferBufferSize,
kTransferBufferSize,
kTransferBufferSize,
GLES2Implementation::kNoLimit));
+#endif
}
EXPECT_CALL(*command_buffer_, OnFlush()).Times(1).RetiresOnSaturation();
@@ -466,6 +489,9 @@
EXPECT_TRUE(transfer_buffer_->InSync());
::testing::Mock::VerifyAndClearExpectations(command_buffer());
+#if defined(OS_CHROMEOS)
+ return true;
+#endif
}
void TearDown() {
@@ -518,6 +544,7 @@
return gl_->query_tracker_->GetQuery(id);
}
+#if !defined(OS_CHROMEOS)
void Initialize(bool bind_generates_resource,
bool lose_context_when_out_of_memory) {
share_group_ = new ShareGroup(bind_generates_resource);
@@ -526,13 +553,40 @@
test_contexts_[i].Initialize(share_group_.get(),
bind_generates_resource,
lose_context_when_out_of_memory);
+#else
+ struct ContextInitOptions {
+ ContextInitOptions()
+ : bind_generates_resource_client(true),
+ bind_generates_resource_service(true),
+ lose_context_when_out_of_memory(false) {}
+ bool bind_generates_resource_client;
+ bool bind_generates_resource_service;
+ bool lose_context_when_out_of_memory;
+ };
+
+ bool Initialize(const ContextInitOptions& init_options) {
+ bool success = true;
+ share_group_ = new ShareGroup(init_options.bind_generates_resource_service);
+
+ for (int i = 0; i < kNumTestContexts; i++) {
+ if (!test_contexts_[i].Initialize(
+ share_group_.get(),
+ init_options.bind_generates_resource_client,
+ init_options.lose_context_when_out_of_memory))
+ success = false;
+ }
+#endif
+
// Default to test context 0.
gpu_control_ = test_contexts_[0].gpu_control_.get();
helper_ = test_contexts_[0].helper_.get();
transfer_buffer_ = test_contexts_[0].transfer_buffer_.get();
gl_ = test_contexts_[0].gl_.get();
commands_ = test_contexts_[0].commands_;
+#if defined(OS_CHROMEOS)
+ return success;
+#endif
}
MockClientCommandBuffer* command_buffer() const {
@@ -592,9 +646,14 @@
};
void GLES2ImplementationTest::SetUp() {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = true;
bool lose_context_when_out_of_memory = false;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+#endif
}
void GLES2ImplementationTest::TearDown() {
@@ -697,9 +756,16 @@
};
void GLES2ImplementationStrictSharedTest::SetUp() {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ init_options.bind_generates_resource_client = false;
+ init_options.bind_generates_resource_service = false;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = false;
bool lose_context_when_out_of_memory = false;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+#endif
}
// GCC requires these declarations, but MSVC requires they not be present
@@ -3117,9 +3183,15 @@
}
TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ init_options.lose_context_when_out_of_memory = true;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = false;
bool lose_context_when_out_of_memory = true;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+#endif
struct Cmds {
cmds::LoseContextCHROMIUM cmd;
@@ -3136,10 +3208,14 @@
}
TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = false;
bool lose_context_when_out_of_memory = false;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
-
+#endif
struct Cmds {
cmds::LoseContextCHROMIUM cmd;
};
@@ -3152,6 +3228,22 @@
EXPECT_TRUE(NoCommandsWritten());
}
+#if defined(OS_CHROMEOS)
+TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch1) {
+ ContextInitOptions init_options;
+ init_options.bind_generates_resource_client = false;
+ init_options.bind_generates_resource_service = true;
+ EXPECT_FALSE(Initialize(init_options));
+}
+
+TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch2) {
+ ContextInitOptions init_options;
+ init_options.bind_generates_resource_client = true;
+ init_options.bind_generates_resource_service = false;
+ EXPECT_FALSE(Initialize(init_options));
+}
+#endif
+
#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.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698