| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <GLES2/gl2.h> | |
| 6 #include <GLES2/gl2ext.h> | |
| 7 #include <GLES2/gl2extchromium.h> | |
| 8 | |
| 9 #include "base/logging.h" | |
| 10 #include "gpu/command_buffer/service/feature_info.h" | |
| 11 #include "gpu/command_buffer/tests/gl_manager.h" | |
| 12 #include "gpu/command_buffer/tests/gl_test_utils.h" | |
| 13 #include "testing/gmock/include/gmock/gmock.h" | |
| 14 #include "testing/gtest/include/gtest/gtest.h" | |
| 15 | |
| 16 namespace gpu { | |
| 17 | |
| 18 class GLLoseContextTest : public testing::Test { | |
| 19 protected: | |
| 20 virtual void SetUp() { | |
| 21 GLManager::Options options; | |
| 22 gl2_.Initialize(options); | |
| 23 options.context_lost_allowed = true; | |
| 24 gl1a_.Initialize(options); | |
| 25 options.share_group_manager = &gl1a_; | |
| 26 gl1b_.Initialize(options); | |
| 27 } | |
| 28 | |
| 29 virtual void TearDown() { | |
| 30 gl1a_.Destroy(); | |
| 31 gl1b_.Destroy(); | |
| 32 gl2_.Destroy(); | |
| 33 } | |
| 34 | |
| 35 GLManager gl1a_; | |
| 36 GLManager gl1b_; | |
| 37 GLManager gl2_; | |
| 38 }; | |
| 39 | |
| 40 // Test that glLoseContextCHROMIUM loses context in the same | |
| 41 // share group but not other. | |
| 42 TEST_F(GLLoseContextTest, ShareGroup) { | |
| 43 // If losing the context will cause the process to exit, do not perform this | |
| 44 // test as it will cause all subsequent tests to not run. | |
| 45 if (gl1a_.workarounds().exit_on_context_lost) | |
| 46 return; | |
| 47 | |
| 48 gl1a_.MakeCurrent(); | |
| 49 glLoseContextCHROMIUM( | |
| 50 GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_CONTEXT_RESET_EXT); | |
| 51 | |
| 52 uint8 expected_no_draw[] = { | |
| 53 GLTestHelper::kCheckClearValue, | |
| 54 GLTestHelper::kCheckClearValue, | |
| 55 GLTestHelper::kCheckClearValue, | |
| 56 GLTestHelper::kCheckClearValue, | |
| 57 }; | |
| 58 // Expect the read will fail. | |
| 59 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_no_draw)); | |
| 60 gl1b_.MakeCurrent(); | |
| 61 // Expect the read will fail. | |
| 62 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_no_draw)); | |
| 63 gl2_.MakeCurrent(); | |
| 64 uint8 expected_draw[] = { 0, 0, 0, 0, }; | |
| 65 // Expect the read will succeed. | |
| 66 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_draw)); | |
| 67 } | |
| 68 | |
| 69 } // namespace gpu | |
| 70 | |
| OLD | NEW |