Skip to content

Commit

Permalink
Unit tests for wayland buffer manager are introduced. (#519)
Browse files Browse the repository at this point in the history
* The test harness for Ozone/Wayland unit tests is restructured.  Mock and test
classes are moved into separate files, renamed as appropriate, and moved into a
separate target that will later be used by other tests.  Use of the deprecated
SetImplementation call is almost eliminated.  Additional test and mock classes
are introduced that model environment of the Wayland buffer manager.

* Minor CC fixes.

* Minor code rearrangements.

* Look'n'feek issues are resolved, and const modifiers are added in some places.

* Redundant comments are removed.
The 'deprecated' SetImplementation is considered to be legitimate and renamed.
  • Loading branch information
alex-voodoo authored and msisov committed Jan 29, 2019
1 parent 9637482 commit 1637f68
Show file tree
Hide file tree
Showing 59 changed files with 2,582 additions and 1,878 deletions.
85 changes: 64 additions & 21 deletions ui/ozone/platform/wayland/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,74 @@ source_set("wayland") {
]
}

source_set("wayland_unittests") {
source_set("test_support") {
testonly = true

sources = [
"fake_server.cc",
"fake_server.h",
"test/constants.h",
"test/global_object.cc",
"test/global_object.h",
"test/mock_buffer.cc",
"test/mock_buffer.h",
"test/mock_surface.cc",
"test/mock_surface.h",
"test/mock_xdg_popup.cc",
"test/mock_xdg_popup.h",
"test/mock_xdg_shell.cc",
"test/mock_xdg_shell.h",
"test/mock_xdg_surface.cc",
"test/mock_xdg_surface.h",
"test/mock_zwp_linux_buffer_params.cc",
"test/mock_zwp_linux_buffer_params.h",
"test/mock_zwp_linux_dmabuf.cc",
"test/mock_zwp_linux_dmabuf.h",
"test/mock_zwp_text_input.cc",
"test/mock_zwp_text_input.h",
"test/server_object.cc",
"test/server_object.h",
"test/test_compositor.cc",
"test/test_compositor.h",
"test/test_data_device.cc",
"test/test_data_device.h",
"test/test_data_device_manager.cc",
"test/test_data_device_manager.h",
"test/test_data_offer.cc",
"test/test_data_offer.h",
"test/test_data_source.cc",
"test/test_data_source.h",
"test/test_keyboard.cc",
"test/test_keyboard.h",
"test/test_output.cc",
"test/test_output.h",
"test/test_pointer.cc",
"test/test_pointer.h",
"test/test_positioner.cc",
"test/test_positioner.h",
"test/test_seat.cc",
"test/test_seat.h",
"test/test_touch.cc",
"test/test_touch.h",
"test/test_zwp_text_input_manager.cc",
"test/test_zwp_text_input_manager.h",
]

deps = [
"//base:base",
"//testing/gmock",
"//third_party/wayland:wayland_server",
"//third_party/wayland-protocols:linux_dmabuf_protocol",
"//third_party/wayland-protocols:text_input_protocol",
"//third_party/wayland-protocols:xdg_shell_protocol",
"//ui/gfx/geometry:geometry",
]
}

source_set("wayland_unittests") {
testonly = true

sources = [
"wayland_buffer_manager_unittest.cc",
"wayland_connection_unittest.cc",
"wayland_data_device_unittest.cc",
Expand All @@ -169,6 +231,7 @@ source_set("wayland_unittests") {
]

deps = [
":test_support",
":wayland",
"//build/config/linux/libdrm",
"//testing/gmock",
Expand Down Expand Up @@ -196,24 +259,4 @@ source_set("wayland_unittests") {
}
}

fuzzer_test("wayland_buffer_fuzzer") {
sources = [
"fake_server.cc",
"fake_server.h",
"wayland_buffer_fuzzer.cc"
]
deps = [
":wayland",
"//base/test:test_support",
"//build/config/linux/libdrm",
"//testing/gmock",
"//third_party/wayland:wayland_server",
"//third_party/wayland-protocols:linux_dmabuf_protocol",
"//third_party/wayland-protocols:text_input_protocol",
"//third_party/wayland-protocols:xdg_shell_protocol",
"//ui/gfx:test_support",
"//ui/ozone/common/linux:drm",
"//ui/ozone:platform",
]
}

Loading

0 comments on commit 1637f68

Please sign in to comment.