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

Unified Diff: Source/core/html/canvas/WebGLRenderingContext.cpp

Issue 703903002: [WebGL-blink] Add test function to force fail the webgl-context (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove decleration from webwidget. Created 6 years, 1 month 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 | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/canvas/WebGLRenderingContext.cpp
diff --git a/Source/core/html/canvas/WebGLRenderingContext.cpp b/Source/core/html/canvas/WebGLRenderingContext.cpp
index 3f8e375d3e7e675fdaae90f88bce60d3dcb53f31..1062ffb791ced45afc39da60a03c6bf6b9d0d477 100644
--- a/Source/core/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/core/html/canvas/WebGLRenderingContext.cpp
@@ -61,6 +61,8 @@
namespace blink {
+static bool shouldFailContextCreationForTesting = false;
+
PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTMLCanvasElement* canvas, WebGLContextAttributes* attrs)
{
Document& document = canvas->document();
@@ -87,7 +89,8 @@ PassOwnPtrWillBeRawPtr<WebGLRenderingContext> WebGLRenderingContext::create(HTML
blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(document.topDocument().url().string(), settings, 1);
blink::WebGLInfo glInfo;
OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::current()->createOffscreenGraphicsContext3D(attributes, 0, &glInfo));
- if (!context) {
+ if (!context || shouldFailContextCreationForTesting) {
+ shouldFailContextCreationForTesting = false;
String statusMessage("Could not create a WebGL context for VendorInfo = ");
statusMessage.append(glInfo.vendorInfo);
statusMessage.append(", RendererInfo = ");
@@ -182,4 +185,9 @@ void WebGLRenderingContext::trace(Visitor* visitor)
WebGLRenderingContextBase::trace(visitor);
}
+void WebGLRenderingContext::forceNextWebGLContextCreationToFail()
+{
+ shouldFailContextCreationForTesting = true;
+}
+
} // namespace blink
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698