Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / gpu / command_buffer / tests / gl_lose_context_chromium_unittest.cc
blob94381ac31ad7be8585e1320c79622f0236bdc6f5
1 // Copyright 2014 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.
5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h>
7 #include <GLES2/gl2extchromium.h>
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"
16 namespace gpu {
18 class GLLoseContextTest : public testing::Test {
19 protected:
20 void SetUp() override {
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);
29 void TearDown() override {
30 gl1a_.Destroy();
31 gl1b_.Destroy();
32 gl2_.Destroy();
35 GLManager gl1a_;
36 GLManager gl1b_;
37 GLManager gl2_;
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;
48 gl1a_.MakeCurrent();
49 glLoseContextCHROMIUM(
50 GL_GUILTY_CONTEXT_RESET_EXT, GL_INNOCENT_CONTEXT_RESET_EXT);
52 uint8 expected_no_draw[] = {
53 GLTestHelper::kCheckClearValue,
54 GLTestHelper::kCheckClearValue,
55 GLTestHelper::kCheckClearValue,
56 GLTestHelper::kCheckClearValue,
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));
69 } // namespace gpu