Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ebe090c authored by Lloyd Pique's avatar Lloyd Pique
Browse files

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
parent adbb90ba
Loading
Loading
Loading
Loading
+49 −23
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ cc_library_shared {
    defaults: ["libgui_bufferqueue-defaults"],

    srcs: [
        ":libgui_bufferqueue_sources",

        "BitTube.cpp",
        "BufferHubConsumer.cpp",
        "BufferHubProducer.cpp",
@@ -104,32 +106,14 @@ cc_library_static {
    ],

    defaults: ["libgui_bufferqueue-defaults"],
}

// 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",
    srcs: [
        ":libgui_bufferqueue_sources",
    ],
        },
    },
}

filegroup {
    name: "libgui_bufferqueue_sources",
    srcs: [
        "BufferItem.cpp",
        "BufferQueue.cpp",
@@ -157,6 +141,31 @@ cc_defaults {
        "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 @@ cc_defaults {
    ],
}

// 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"]
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#include "mock/gui/MockGraphicBufferConsumer.h"
#include <gui/mock/GraphicBufferConsumer.h>

namespace android {
namespace mock {
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * limitations under the License.
 */

#include "mock/gui/MockGraphicBufferProducer.h"
#include <gui/mock/GraphicBufferProducer.h>

namespace android {
namespace mock {
Loading