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

Side by Side Diff: gpu/command_buffer/tests/gl_lose_context_chromium_unittests.cc

Issue 11568029: Add a command to lose the context (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add docs, lose parent and children, fix typo Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h ('k') | gpu/command_buffer/tests/gl_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698