gui: Set up libgui_mocks
Move the existing mocks for IGraphicBufferProducer and
IGraphicBufferConsumer over to libs/gui/..., and create a new static
library "libgui_mocks" to hold the mocks.
libsurfaceflinger_unittest is also adjusted as needed to use the new
library.
Test: atest libsurfaceflinger_unittest
Change-Id: I740ae9d999812896f525f86a30c6800f86ed8ca9
diff --git a/libs/gui/Android.bp b/libs/gui/Android.bp
index 3f8b436..da51675 100644
--- a/libs/gui/Android.bp
+++ b/libs/gui/Android.bp
@@ -32,6 +32,8 @@
defaults: ["libgui_bufferqueue-defaults"],
srcs: [
+ ":libgui_bufferqueue_sources",
+
"BitTube.cpp",
"BufferHubConsumer.cpp",
"BufferHubProducer.cpp",
@@ -104,32 +106,14 @@
],
defaults: ["libgui_bufferqueue-defaults"],
+
+ srcs: [
+ ":libgui_bufferqueue_sources",
+ ],
}
-// Common build config shared by libgui and libgui_bufferqueue_static.
-cc_defaults {
- name: "libgui_bufferqueue-defaults",
-
- clang: true,
- cflags: [
- "-Wall",
- "-Werror",
- ],
-
- cppflags: [
- "-Wextra",
- "-DDEBUG_ONLY_CODE=0",
- ],
-
- product_variables: {
- eng: {
- cppflags: [
- "-UDEBUG_ONLY_CODE",
- "-DDEBUG_ONLY_CODE=1",
- ],
- },
- },
-
+filegroup {
+ name: "libgui_bufferqueue_sources",
srcs: [
"BufferItem.cpp",
"BufferQueue.cpp",
@@ -157,6 +141,31 @@
"bufferqueue/2.0/H2BProducerListener.cpp",
"bufferqueue/2.0/types.cpp",
],
+}
+
+// Common build config shared by libgui and libgui_bufferqueue_static.
+cc_defaults {
+ name: "libgui_bufferqueue-defaults",
+
+ clang: true,
+ cflags: [
+ "-Wall",
+ "-Werror",
+ ],
+
+ cppflags: [
+ "-Wextra",
+ "-DDEBUG_ONLY_CODE=0",
+ ],
+
+ product_variables: {
+ eng: {
+ cppflags: [
+ "-UDEBUG_ONLY_CODE",
+ "-DDEBUG_ONLY_CODE=1",
+ ],
+ },
+ },
shared_libs: [
"android.hardware.graphics.bufferqueue@1.0",
@@ -204,4 +213,21 @@
],
}
+// GMocks for use by external code
+cc_library_static {
+ name: "libgui_mocks",
+ vendor_available: false,
+
+ defaults: ["libgui_bufferqueue-defaults"],
+ static_libs: [
+ "libgtest",
+ "libgmock",
+ ],
+
+ srcs: [
+ "mock/GraphicBufferConsumer.cpp",
+ "mock/GraphicBufferProducer.cpp",
+ ],
+}
+
subdirs = ["tests"]