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 |
| 8 #include "base/logging.h" |
| 9 #include "gpu/command_buffer/tests/gl_manager.h" |
| 10 #include "gpu/command_buffer/tests/gl_test_utils.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 |
| 14 namespace gpu { |
| 15 |
| 16 class GLLoseContextTest : public testing::Test { |
| 17 protected: |
| 18 virtual void SetUp() { |
| 19 GLManager::Options options; |
| 20 gl2_.Initialize(options); |
| 21 options.context_lost_allowed = true; |
| 22 gl1a_.Initialize(options); |
| 23 options.share_group_manager = &gl1a_; |
| 24 gl1b_.Initialize(options); |
| 25 } |
| 26 |
| 27 virtual void TearDown() { |
| 28 gl1a_.Destroy(); |
| 29 gl1b_.Destroy(); |
| 30 gl2_.Destroy(); |
| 31 } |
| 32 |
| 33 GLManager gl1a_; |
| 34 GLManager gl1b_; |
| 35 GLManager gl2_; |
| 36 }; |
| 37 |
| 38 // Test that glLoseContextCHROMIUM loses context in the same |
| 39 // share group but not other. |
| 40 TEST_F(GLLoseContextTest, ShareGroup) { |
| 41 gl1a_.MakeCurrent(); |
| 42 glLoseContextCHROMIUM( |
| 43 GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_CONTEXT_RESET_EXT); |
| 44 |
| 45 uint8 expected_no_draw[] = { |
| 46 GLTestHelper::kCheckClearValue, |
| 47 GLTestHelper::kCheckClearValue, |
| 48 GLTestHelper::kCheckClearValue, |
| 49 GLTestHelper::kCheckClearValue, |
| 50 }; |
| 51 // Expect the read will fail. |
| 52 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_no_draw)); |
| 53 gl1b_.MakeCurrent(); |
| 54 // Expect the read will fail. |
| 55 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_no_draw)); |
| 56 gl2_.MakeCurrent(); |
| 57 uint8 expected_draw[] = { 0, 0, 0, 0, }; |
| 58 // Expect the read will succeed. |
| 59 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected_draw)); |
| 60 } |
| 61 |
| 62 } // namespace gpu |
| 63 |
OLD | NEW |