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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc

Issue 118203002: During virtual context switches only restore texture units that have changed from the previous cont… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactor unittests Created 6 years, 11 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
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index ea3308ea5c57dbe46400f26e2eb240f430542a2a..7afe6fa1d340bd87a14b3f589f4326a3b49178cb 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -14,6 +14,7 @@
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/cmd_buffer_engine.h"
#include "gpu/command_buffer/service/context_group.h"
+#include "gpu/command_buffer/service/context_state.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
#include "gpu/command_buffer/service/logger.h"
#include "gpu/command_buffer/service/program_manager.h"
@@ -79,6 +80,36 @@ void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() {
}
}
+void GLES2DecoderTestBase::AddExpectationsForActiveTexture(GLenum unit) {
+ EXPECT_CALL(*gl_, ActiveTexture(unit))
+ .Times(1)
+ .RetiresOnSaturation();
+}
+
+void GLES2DecoderTestBase::AddExpectationsForBindTexture(GLenum target,
+ GLuint id) {
+ EXPECT_CALL(*gl_, BindTexture(target, id))
+ .Times(1)
+ .RetiresOnSaturation();
+}
+
+void GLES2DecoderTestBase::InitializeContextState(ContextState* state,
+ uint32 non_default_unit,
+ uint32 active_unit) {
no sievers 2014/01/13 22:06:29 This seems to be very specific to your tests. How
kaanb 2014/01/14 22:04:22 Done.
+ state->texture_units.resize(group().max_texture_units());
+ for (uint32 tt = 0; tt < state->texture_units.size(); ++tt) {
+ TextureRef* ref_cube_map =
+ group().texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP);
+ state->texture_units[tt].bound_texture_cube_map = ref_cube_map;
+ TextureRef* ref_2d =
+ (tt == non_default_unit)
+ ? group().texture_manager()->GetTexture(client_texture_id_)
+ : group().texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D);
+ state->texture_units[tt].bound_texture_2d = ref_2d;
+ }
+ state->active_texture_unit = active_unit;
+}
+
void GLES2DecoderTestBase::InitDecoder(
const char* extensions,
bool has_alpha,

Powered by Google App Engine
This is Rietveld 408576698