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

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp

Issue 2335223004: Make SharedGpuContext recover automatically after a context loss (Closed)
Patch Set: build fix Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..12c50d1f86e7971249307de4f177574bc5c3252f
--- /dev/null
+++ b/third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContextTest.cpp
@@ -0,0 +1,50 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "platform/graphics/gpu/SharedGpuContext.h"
+
+#include "gpu/command_buffer/client/gles2_interface.h"
+#include "platform/graphics/test/FakeGLES2Interface.h"
+#include "platform/graphics/test/FakeWebGraphicsContext3DProvider.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "third_party/khronos/GLES2/gl2ext.h"
+
+using testing::Test;
+
+namespace blink {
+
+namespace {
+
+class SharedGpuContextTest : public Test {
+public:
+ void SetUp() override
+ {
+ SharedGpuContext::setContextProviderFactoryForTesting([this] {
+ m_gl.setIsContextLost(false);
+ return std::unique_ptr<WebGraphicsContext3DProvider>(new FakeWebGraphicsContext3DProvider(&m_gl));
+ });
+ }
+
+ void TearDown() override
+ {
+ SharedGpuContext::setContextProviderFactoryForTesting(nullptr);
+ }
+
+ FakeGLES2Interface m_gl;
+};
+
+TEST_F(SharedGpuContextTest, contextLossAutoRecovery)
+{
+ EXPECT_TRUE(SharedGpuContext::isValid());
+ unsigned contextId = SharedGpuContext::contextId();
+ m_gl.setIsContextLost(true);
+ EXPECT_FALSE(SharedGpuContext::isValidWithoutRestoring());
+ EXPECT_TRUE(SharedGpuContext::isValid());
+ EXPECT_NE(contextId, SharedGpuContext::contextId());
+}
+
+
+} // unnamed namespace
+
+} // blink
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/gpu/SharedGpuContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698