WebGLCompatibility: Fix shader validation using define macros.

Backslash as line-continutation character is not permitted to be used
within a pre-processor directive for WebGL1.

BUG=angleproject:2093

Change-Id: I649a914b9bc544a3e4f9e7eff23b95a62c9b7008
Reviewed-on: https://chromium-review.googlesource.com/734218
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
Commit-Queue: Bryan Bernhart <bryan.bernhart@intel.com>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/WebGLCompatibilityTest.cpp b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
index 426abc5..c64be19 100644
--- a/src/tests/gl_tests/WebGLCompatibilityTest.cpp
+++ b/src/tests/gl_tests/WebGLCompatibilityTest.cpp
@@ -1511,6 +1511,39 @@
 }
 
 // Test that line continuation is handled correctly when valdiating shader source
+TEST_P(WebGLCompatibilityTest, ShaderSourceLineContinuation)
+{
+    // Verify that a line continuation character (i.e. backslash) cannot be used
+    // within a preprocessor directive in a ES2 context.
+    ANGLE_SKIP_TEST_IF(getClientMajorVersion() >= 3);
+
+    const char *validVert =
+        "#define foo this is a test\n"
+        "precision mediump float;\n"
+        "void main()\n"
+        "{\n"
+        "    gl_Position = vec4(1.0);\n"
+        "}\n";
+
+    const char *invalidVert =
+        "#define foo this \\n"
+        "  is a test\n"
+        "precision mediump float;\n"
+        "void main()\n"
+        "{\n"
+        "    gl_Position = vec4(1.0);\n"
+        "}\n";
+
+    GLuint shader = glCreateShader(GL_VERTEX_SHADER);
+    glShaderSource(shader, 1, &validVert, nullptr);
+    EXPECT_GL_NO_ERROR();
+
+    glShaderSource(shader, 1, &invalidVert, nullptr);
+    EXPECT_GL_ERROR(GL_INVALID_VALUE);
+    glDeleteShader(shader);
+}
+
+// Test that line continuation is handled correctly when valdiating shader source
 TEST_P(WebGL2CompatibilityTest, ShaderSourceLineContinuation)
 {
     const char *validVert =