Return a program binary size of 0 when the program is not linked.

From the GLES3 spec:
"... When a program object's LINK_STATUS is FALSE, its program binary
length is zero ..."

Querying the size was generating errors in the GL backend.

BUG=angleproject:2569

Change-Id: I1be511040331abaec2bba98502d8aa88fb4bd19c
Reviewed-on: https://chromium-review.googlesource.com/1076317
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/gl_tests/ProgramBinaryTest.cpp b/src/tests/gl_tests/ProgramBinaryTest.cpp
index 95897c5..b6de1e9 100644
--- a/src/tests/gl_tests/ProgramBinaryTest.cpp
+++ b/src/tests/gl_tests/ProgramBinaryTest.cpp
@@ -235,6 +235,17 @@
     ASSERT_GL_NO_ERROR();
 }
 
+// Test that unlinked programs have a binary size of 0
+TEST_P(ProgramBinaryTest, ZeroSizedUnlinkedBinary)
+{
+    ANGLE_SKIP_TEST_IF(!supported());
+
+    ANGLE_GL_EMPTY_PROGRAM(program);
+    GLsizei length = 0;
+    glGetProgramiv(program, GL_PROGRAM_BINARY_LENGTH, &length);
+    ASSERT_EQ(0, length);
+}
+
 // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
 ANGLE_INSTANTIATE_TEST(ProgramBinaryTest,
                        ES2_D3D9(),