Setup Xvfb, like
% Xvfb :9 -nolisten tcp 1280x800x24
Run PointerTest in exo_unittests
% DISPLAY=:9 ./out/Default/exo_unittests --gtest_filter='PointerTest.*'
failed with:
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: OnPointerLeave(0x348a44cfeaa0)
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#kn
owing-when-to-expect for details.
../../components/exo/pointer_unittest.cc:64: Failure
Mock function called more times than expected - returning directly.
Function call: OnPointerFrame()
Expected: to be called once
Actual: called twice - over-saturated and active
Stack trace:
#0 0x0000009b94f0 StackTraceGetter::CurrentStackTrace()
#1 0x0000009df017 testing::internal::UnitTestImpl::CurrentOsStackTraceExceptTop()
#2 0x0000009de47d testing::internal::AssertHelper::operator=()
#3 0x000000c52d98 testing::internal::GoogleTestFailureReporter::ReportFailure()
#4 0x0000005166d8 testing::internal::Expect()
#5 0x000000c5bceb testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith()
#6 0x0000005145b0 _ZN7testing8internal18FunctionMockerBaseIFvibdEE10InvokeWithEONSt3__15tupleIJibdEEE
#7 0x000000514570 testing::internal::FunctionMocker<>::Invoke()
#8 0x000000550ac4 exo::(anonymous namespace)::MockPointerDelegate::OnPointerFrame()
#9 0x000000629cb6 exo::Pointer::SetFocus()
#10 0x000000629e00 exo::Pointer::OnMouseEvent()
#11 0x7f7dbc66d755 ui::EventHandler::OnEvent()
#12 0x7f7dbc66c0ba ui::EventDispatcher::DispatchEvent()
#13 0x7f7dbc66b8c7 ui::EventDispatcher::DispatchEventToEventHandlers()
#14 0x7f7dbc66a8da ui::EventDispatcher::ProcessEvent()
#15 0x7f7dbc66a454 ui::EventDispatcherDelegate::DispatchEventToTarget()
#16 0x7f7dbc66a346 ui::EventDispatcherDelegate::DispatchEvent()
#17 0x7f7dc0351f5f aura::WindowEventDispatcher::DispatchMouseEnterOrExit()
#18 0x7f7dc0354a62 aura::WindowEventDispatcher::PreDispatchMouseEvent()
#19 0x7f7dc0354237 aura::WindowEventDispatcher::PreDispatchEvent()
#20 0x7f7dbc66a309 ui::EventDispatcherDelegate::DispatchEvent()
#21 0x7f7dbc66ed18 ui::EventProcessor::OnEventFromSource()
#22 0x7f7dbc66efec ui::EventProcessor::OnEventFromSource()
#23 0x7f7dbc671299 ui::EventSource::DeliverEventToSink()
#24 0x7f7dbc670938 ui::EventSource::SendEventToSinkFromRewriter()
#25 0x7f7dbc66fe51 ui::EventSource::SendEventToSink()
#26 0x7f7db805b121 ash::AshWindowTreeHostPlatform::DispatchEvent()
#27 0x7f7dbbce3570 _ZN4base8internal13FunctorTraitsIMN2ui22PlatformWindowDelegateEFvPNS2_5EventEEvE6InvokeIS7_PS3_JS5_EEEvT_OT0_DpOT1_
#28 0x7f7dbbce34cf _ZN4base8internal12InvokeHelperILb0EvE8MakeItSoIMN2ui22PlatformWindowDelegateEFvPNS4_5EventEEJPS5_S7_EEEvOT_DpOT0_
#29 0x7f7dbbce3465 _ZN4base8internal7InvokerINS0_9BindStateIMN2ui22PlatformWindowDelegateEFvPNS3_5EventEEJNS0_17UnretainedWrapperIS4_EEEEEFvS6_EE7RunImplIS8_NSt3__15tupleIJSA_EEEJLm0EEEEvOT_OT0_NSF_16integer_sequenceImJXspT1_EEEEOS6_
#30 0x7f7dbbce33f9 _ZN4base8internal7InvokerINS0_9BindStateIMN2ui22PlatformWindowDelegateEFvPNS3_5EventEEJNS0_17UnretainedWrapperIS4_EEEEEFvS6_EE7RunOnceEPNS0_13BindStateBaseES6_
#31 0x7f7dbc67cac1 _ZNO4base12OnceCallbackIFvPN2ui5EventEEE3RunES3_
#32 0x7f7dbc67c8ed ui::DispatchEventFromNativeUiEvent()
#33 0x7f7dbbd6857c ui::X11WindowOzone::DispatchEvent()
#34 0x7f7dbe3b28b4 ui::PlatformEventSource::DispatchEvent()
#35 0x7f7dadfef539 ui::X11EventSourceLibevent::DispatchPlatformEvent()
#36 0x7f7dadfedf3a ui::X11EventSourceLibevent::ProcessXEvent()
#37 0x7f7dadfdeac5 ui::X11EventSource::ExtractCookieDataDispatchEvent()
#38 0x7f7dadfdea4e ui::X11EventSource::DispatchXEvents()
#39 0x7f7dadfef77c ui::X11EventSourceLibevent::OnFileCanReadWithoutBlocking()
../../components/exo/pointer_unittest.cc:107: Failure
Value of: frame.render_pass_list.back().get() != last_render_pass
Actual: false
Expected: true
Stack trace:
#0 0x0000009b94f0 StackTraceGetter::CurrentStackTrace()
#1 0x0000009df017 testing::internal::UnitTestImpl::CurrentOsStackTraceExceptTop()
#2 0x0000009de47d testing::internal::AssertHelper::operator=()
#3 0x00000054fa95 exo::(anonymous namespace)::PointerTest_SetCursor_Test::TestBody()
#4 0x000000a18aee testing::internal::HandleSehExceptionsInMethodIfSupported<>()
[ FAILED ] PointerTest.SetCursor (694 ms)
Interestingly, PointerTest test cases can fail, when the case comes first for a run.
% DISPLAY=:9 ./out/Default/exo_unittests --gtest_filter='PointerTest.SetCursorNull'
...
GMOCK WARNING:
Uninteresting mock function call - returning directly.
Function call: OnPointerLeave(0x3665430f1aa0)
NOTE: You can safely ignore the above warning unless this call should not happen. Do not suppress it by blindly adding an EXPECT_CALL() if you don't mean to enforce the call. See https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#kn
owing-when-to-expect for details.
../../components/exo/pointer_unittest.cc:132: Failure
Mock function called more times than expected - returning directly.
Function call: OnPointerFrame()
Expected: to be called once
Actual: called twice - over-saturated and active
Stack trace:
#0 0x0000009b94f0 StackTraceGetter::CurrentStackTrace()
#1 0x0000009df017 testing::internal::UnitTestImpl::CurrentOsStackTraceExceptTop()
#2 0x0000009de47d testing::internal::AssertHelper::operator=()
#3 0x000000c52d98 testing::internal::GoogleTestFailureReporter::ReportFailure()
#4 0x0000005166d8 testing::internal::Expect()
#5 0x000000c5bceb testing::internal::UntypedFunctionMockerBase::UntypedInvokeWith()
#6 0x0000005145b0 _ZN7testing8internal18FunctionMockerBaseIFvibdEE10InvokeWithEONSt3__15tupleIJibdEEE
#7 0x000000514570 testing::internal::FunctionMocker<>::Invoke()
#8 0x000000550ac4 exo::(anonymous namespace)::MockPointerDelegate::OnPointerFrame()
#9 0x000000629cb6 exo::Pointer::SetFocus()
#10 0x000000629e00 exo::Pointer::OnMouseEvent()
#11 0x7f09fc3a8755 ui::EventHandler::OnEvent()
#12 0x7f09fc3a70ba ui::EventDispatcher::DispatchEvent()
#13 0x7f09fc3a68c7 ui::EventDispatcher::DispatchEventToEventHandlers()
#14 0x7f09fc3a58da ui::EventDispatcher::ProcessEvent()
#15 0x7f09fc3a5454 ui::EventDispatcherDelegate::DispatchEventToTarget()
#16 0x7f09fc3a5346 ui::EventDispatcherDelegate::DispatchEvent()
#17 0x7f0a0008cf5f aura::WindowEventDispatcher::DispatchMouseEnterOrExit()
#18 0x7f0a0008fa62 aura::WindowEventDispatcher::PreDispatchMouseEvent()
#19 0x7f0a0008f237 aura::WindowEventDispatcher::PreDispatchEvent()
#20 0x7f09fc3a5309 ui::EventDispatcherDelegate::DispatchEvent()
#21 0x7f09fc3a9d18 ui::EventProcessor::OnEventFromSource()
#22 0x7f09fc3a9fec ui::EventProcessor::OnEventFromSource()
#23 0x7f09fc3ac299 ui::EventSource::DeliverEventToSink()
#24 0x7f09fc3ab938 ui::EventSource::SendEventToSinkFromRewriter()
#25 0x7f09fc3aae51 ui::EventSource::SendEventToSink()
#26 0x7f09f7d96121 ash::AshWindowTreeHostPlatform::DispatchEvent()
#27 0x7f09fba1e570 _ZN4base8internal13FunctorTraitsIMN2ui22PlatformWindowDelegateEFvPNS2_5EventEEvE6InvokeIS7_PS3_JS5_EEEvT_OT0_DpOT1_
#28 0x7f09fba1e4cf _ZN4base8internal12InvokeHelperILb0EvE8MakeItSoIMN2ui22PlatformWindowDelegateEFvPNS4_5EventEEJPS5_S7_EEEvOT_DpOT0_
#29 0x7f09fba1e465 _ZN4base8internal7InvokerINS0_9BindStateIMN2ui22PlatformWindowDelegateEFvPNS3_5EventEEJNS0_17UnretainedWrapperIS4_EEEEEFvS6_EE7RunImplIS8_NSt3__15tupleIJSA_EEEJLm0EEEEvOT_OT0_NSF_16integer_sequenceImJXspT1_EEEEOS6_
#30 0x7f09fba1e3f9 _ZN4base8internal7InvokerINS0_9BindStateIMN2ui22PlatformWindowDelegateEFvPNS3_5EventEEJNS0_17UnretainedWrapperIS4_EEEEEFvS6_EE7RunOnceEPNS0_13BindStateBaseES6_
#31 0x7f09fc3b7ac1 _ZNO4base12OnceCallbackIFvPN2ui5EventEEE3RunES3_
#32 0x7f09fc3b78ed ui::DispatchEventFromNativeUiEvent()
#33 0x7f09fbaa357c ui::X11WindowOzone::DispatchEvent()
#34 0x7f09fe0ed8b4 ui::PlatformEventSource::DispatchEvent()
#35 0x7f09edd2a539 ui::X11EventSourceLibevent::DispatchPlatformEvent()
#36 0x7f09edd28f3a ui::X11EventSourceLibevent::ProcessXEvent()
#37 0x7f09edd19ac5 ui::X11EventSource::ExtractCookieDataDispatchEvent()
#38 0x7f09edd19a4e ui::X11EventSource::DispatchXEvents()
#39 0x7f09edd2a77c ui::X11EventSourceLibevent::OnFileCanReadWithoutBlocking()
../../components/exo/pointer_unittest.cc:142: Failure
Expected equality of these values:
ui::CursorType::kNone
Which is: 4-byte object <26-00 00-00>
cursor_client->GetCursor().native_type()
Which is: 4-byte object <00-00 00-00>
Stack trace:
#0 0x0000009b94f0 StackTraceGetter::CurrentStackTrace()
#1 0x0000009df017 testing::internal::UnitTestImpl::CurrentOsStackTraceExceptTop()
#2 0x0000009de47d testing::internal::AssertHelper::operator=()
#3 0x000000551653 exo::(anonymous namespace)::PointerTest_SetCursorNull_Test::TestBody()
#4 0x000000a18aee testing::internal::HandleSehExceptionsInMethodIfSupported<>()
[ FAILED ] PointerTest.SetCursorNull (609 ms)
I've come to realize that Xvfb may emit some pointer events like MouseEnter when the test process starts and connects to the X11 server, and that confuses the expectations of the mocks. This won't happen with the existing normal X11 server.
We would have to consume such events before test starts.
Comment 1 by bugdroid1@chromium.org
, Jun 20 2018