Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Revert "vm_tools: sommelier: Test handling of XCB_MAP_REQUEST."
Browse files Browse the repository at this point in the history
This reverts commit 3b3e04abdeddc4fc3cb8e4a02528794169122922.

Reason for revert: b/302429827 tatl,tael release builders failing to compile sommelier unit tests

Original change's description:
> vm_tools: sommelier: Test handling of XCB_MAP_REQUEST.
>
> This requires a working model of the xcb_get_property*() functions,
> which is hard to create using mocks due to the required state tracking.
> Instead, we can use a simple fake.
>
> BUG=b:296327255
> TEST=run unit tests: meson setup builddir; pushd builddir; ninja && ./sommelier_test; popd
>
> Change-Id: I33d53fd838211bc0a69e5befdf71b734177d917b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/4885941
> Tested-by: Chloe Pelling <[email protected]>
> Commit-Queue: Chloe Pelling <[email protected]>
> Reviewed-by: Justin Huang <[email protected]>
> Auto-Submit: Chloe Pelling <[email protected]>

BUG=b:296327255,b:302429827

Change-Id: If0211fd3f9dd30e716ef10d6d33e6fc49dbaf78c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/4900441
Commit-Queue: Chloe Pelling <[email protected]>
Commit-Queue: Sophia Lin <[email protected]>
Reviewed-by: Sophia Lin <[email protected]>
Tested-by: Chloe Pelling <[email protected]>
Auto-Submit: Chloe Pelling <[email protected]>
  • Loading branch information
cpelling authored and Chromeos LUCI committed Sep 29, 2023
1 parent 866d87f commit a3b1478
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 522 deletions.
2 changes: 0 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,9 @@ if (use.test) {
"sommelier-test.cc",
"sommelier-transform-test.cc",
"sommelier-window-test.cc",
"sommelier-x11event-test.cc",
"sommelier-xdg-shell-test.cc",
"testing/mock-wayland-channel.cc",
"testing/sommelier-test-util.cc",
"xcb/fake-xcb-shim.cc",
]
include_dirs = [ "testing" ]

Expand Down
2 changes: 0 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,9 @@ if get_option('with_tests')
'sommelier-transform-test.cc',
'sommelier-output-test.cc',
'sommelier-window-test.cc',
'sommelier-x11event-test.cc',
'sommelier-xdg-shell-test.cc',
'testing/mock-wayland-channel.cc',
'testing/sommelier-test-util.cc',
'xcb/fake-xcb-shim.cc',
] + wl_outs + shim_outs + gamepad_testing,
link_with: libsommelier,
dependencies: [
Expand Down
6 changes: 3 additions & 3 deletions sommelier-output-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ TEST_F(X11Test, OutputsPositionedCorrectlyAfterRemovingLeftOutput) {
EXPECT_EQ(output->virt_y, 0);

// outputs has length 2.
EXPECT_EQ(ctx.host_outputs.size(), 2u);
EXPECT_EQ(ctx.host_outputs.size(), 2);
}

TEST_F(X11Test, OutputsPositionedCorrectlyAfterRemovingMiddleOutput) {
Expand Down Expand Up @@ -201,7 +201,7 @@ TEST_F(X11Test, OutputsPositionedCorrectlyAfterRemovingMiddleOutput) {
EXPECT_EQ(output->virt_y, 0);

// outputs has length 2.
EXPECT_EQ(ctx.host_outputs.size(), 2u);
EXPECT_EQ(ctx.host_outputs.size(), 2);
}

TEST_F(X11Test, OtherOutputUnchangedAfterRemovingRightOutput) {
Expand All @@ -222,7 +222,7 @@ TEST_F(X11Test, OtherOutputUnchangedAfterRemovingRightOutput) {
EXPECT_EQ(output->virt_x, 0);
EXPECT_EQ(output->virt_y, 0);
// outputs has length 1.
EXPECT_EQ(ctx.host_outputs.size(), 1u);
EXPECT_EQ(ctx.host_outputs.size(), 1);
}

TEST_F(X11Test, RotatingOutputsShiftsNeighbouringOutputs) {
Expand Down
113 changes: 0 additions & 113 deletions sommelier-x11event-test.cc

This file was deleted.

13 changes: 7 additions & 6 deletions testing/x11-test-base.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ class X11TestBase : public WaylandTestBase {
WaylandTestBase::InitContext();
ctx.xwayland = 1;

// Always delegate ID generation to the fake XCB shim, even for test cases
// that never use the fake for anything else. This prevents ID collisions.
xcb.DelegateIdGenerationToFake();

// Create a fake screen with somewhat plausible values.
// Some of these are not realistic because they refer to things not present
// in the mocked X environment (such as specifying a root window with ID 0).
Expand Down Expand Up @@ -60,8 +56,13 @@ class X11TestBase : public WaylandTestBase {

~X11TestBase() override { set_xcb_shim(nullptr); }

uint32_t GenerateId() {
static uint32_t id = 0;
return ++id;
}

virtual sl_window* CreateWindowWithoutRole() {
xcb_window_t window_id = xcb.generate_id(ctx.connection);
xcb_window_t window_id = GenerateId();
sl_create_window(&ctx, window_id, 0, 0, 800, 600, 0);
sl_window* window = sl_lookup_window(&ctx, window_id);
EXPECT_NE(window, nullptr);
Expand All @@ -72,7 +73,7 @@ class X11TestBase : public WaylandTestBase {
sl_window* window = CreateWindowWithoutRole();

// Pretend we created a frame window too
window->frame_id = xcb.generate_id(ctx.connection);
window->frame_id = GenerateId();

window->host_surface_id = SurfaceId(xwayland->CreateSurface());
sl_window_update(window);
Expand Down
191 changes: 0 additions & 191 deletions xcb/fake-xcb-shim.cc

This file was deleted.

Loading

0 comments on commit a3b1478

Please sign in to comment.