gui: Add tests for IGraphicBufferProducer

* Basic tests only. Needs more complicated queue/dequeue tests.
* Also needs consumer-side tests to really be thorough.

Change-Id: I1099dd56d65b6e9dfa15377726d6054ce657c0ca
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index a95ac64..2fa0433 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -195,6 +195,11 @@
     ATRACE_CALL();
     Mutex::Autolock lock(mMutex);
 
+    if (outValue == NULL) {
+        ST_LOGE("query: outValue was NULL");
+        return BAD_VALUE;
+    }
+
     if (mAbandoned) {
         ST_LOGE("query: BufferQueue has been abandoned!");
         return NO_INIT;
@@ -654,10 +659,15 @@
         return NO_INIT;
     }
 
+    if (output == NULL) {
+        ST_LOGE("connect: output was NULL");
+        return BAD_VALUE;
+    }
+
     if (mConnectedApi != NO_CONNECTED_API) {
         ST_LOGE("connect: already connected (cur=%d, req=%d)",
                 mConnectedApi, api);
-        return -EINVAL;
+        return BAD_VALUE;
     }
 
     // If we disconnect and reconnect quickly, we can be in a state where our slots are
@@ -693,7 +703,7 @@
             }
             break;
         default:
-            err = -EINVAL;
+            err = BAD_VALUE;
             break;
     }