New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 641969 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

Making first browser frontmost window in interactive_ui_tests causes crash on mac

Project Member Reported by sky@chromium.org, Aug 29 2016

Issue description

As part of 639350 I changed it so that the first browser in interactive_ui_tests is brought to the front (using BringBrowserWindowToFront). This caused a crash in AutofillInteractiveTest.AutofillAfterTranslate on mac only. Here's the trace:

0   interactive_ui_tests                0x00000001084a47d3 _ZN4base5debug10StackTraceC1Ev + 19
1   interactive_ui_tests                0x0000000107c4daec _ZN7content12_GLOBAL__N_1L27DumpStackTraceSignalHandlerEi + 204
2   libsystem_platform.dylib            0x00007fff8e14f5aa _sigtramp + 26
3   ???                                 0x00007fddebc1f550 0x0 + 140591119856976
4   CoreFoundation                      0x00007fff82285f15 __CFRunLoopServiceMachPort + 181
5   CoreFoundation                      0x00007fff82285539 __CFRunLoopRun + 1161
6   CoreFoundation                      0x00007fff82284e75 CFRunLoopRunSpecific + 309
7   HIToolbox                           0x00007fff8b2eba0d RunCurrentEventLoopInMode + 226
8   HIToolbox                           0x00007fff8b2eb7b7 ReceiveNextEventCommon + 479
9   HIToolbox                           0x00007fff8b2eb5bc _BlockUntilNextEventMatchingListInModeWithFilter + 65
10  AppKit                              0x00007fff84d0f24e _DPSNextEvent + 1434
11  AppKit                              0x00007fff84d0e89b -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 122
12  AppKit                              0x00007fff84d0299c -[NSApplication run] + 553
13  interactive_ui_tests                0x00000001084de3a7 _ZN4base24MessagePumpNSApplication5DoRunEPNS_11MessagePump8DelegateE + 359
14  interactive_ui_tests                0x00000001084dd72f _ZN4base24MessagePumpCFRunLoopBase3RunEPNS_11MessagePump8DelegateE + 127
15  interactive_ui_tests                0x00000001084d9617 _ZN4base11MessageLoop10RunHandlerEv + 215
16  interactive_ui_tests                0x0000000108507393 _ZN4base7RunLoop3RunEv + 51
17  interactive_ui_tests                0x0000000107c5e5cf _ZN7content14RunThisRunLoopEPN4base7RunLoopE + 79
18  interactive_ui_tests                0x0000000107c5ef44 _ZN7content17MessageLoopRunner3RunEv + 116
19  interactive_ui_tests                0x0000000107c4fd0d _ZN7content12_GLOBAL__N_119ExecuteScriptHelperEPNS_15RenderFrameHostERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEPNS3_10unique_ptrIN4base5ValueENS3_14default_deleteISE_EEEE + 189
20  interactive_ui_tests                0x0000000107c50177 _ZN7content27ExecuteScriptAndExtractBoolERKNS_17ToRenderFrameHostERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEEPb + 119
21  interactive_ui_tests                0x0000000105739c65 _ZN8autofill23AutofillInteractiveTest19FocusFirstNameFieldEv + 133
22  interactive_ui_tests                0x0000000105739565 _ZN8autofill23AutofillInteractiveTest16TryBasicFormFillEv + 21
23  interactive_ui_tests                0x00000001057443c3 _ZN8autofill51AutofillInteractiveTest_AutofillAfterTranslate_Test19RunTestOnMainThreadEv + 2115
24  interactive_ui_tests                0x0000000107565f03 _ZN20InProcessBrowserTest23RunTestOnMainThreadLoopEv + 211
25  interactive_ui_tests                0x0000000107c4d85e _ZN7content15BrowserTestBase28ProxyRunTestOnMainThreadLoopEv + 270
26  interactive_ui_tests                0x00000001075c3243 _ZN22ChromeBrowserMainParts25PreMainMessageLoopRunImplEv + 4419
27  interactive_ui_tests                0x00000001075c1fce _ZN22ChromeBrowserMainParts21PreMainMessageLoopRunEv + 62
28  interactive_ui_tests                0x0000000106881903 _ZN7content15BrowserMainLoop21PreMainMessageLoopRunEv + 67
29  interactive_ui_tests                0x0000000106c60d00 _ZN7content17StartupTaskRunner14RunAllTasksNowEv + 48
30  interactive_ui_tests                0x000000010687fff3 _ZN7content15BrowserMainLoop18CreateStartupTasksEv + 579
31  interactive_ui_tests                0x000000010688485e _ZN7content21BrowserMainRunnerImpl10InitializeERKNS_18MainFunctionParamsE + 590
32  interactive_ui_tests                0x000000010687d5b4 _ZN7content11BrowserMainERKNS_18MainFunctionParamsE + 100
33  interactive_ui_tests                0x00000001074a178e _ZN7content21ContentMainRunnerImpl3RunEv + 798
34  interactive_ui_tests                0x00000001074a0736 _ZN7content11ContentMainERKNS_17ContentMainParamsE + 54
35  interactive_ui_tests                0x0000000107c4d5a3 _ZN7content15BrowserTestBase5SetUpEv + 2195
36  interactive_ui_tests                0x00000001075650f7 _ZN20InProcessBrowserTest5SetUpEv + 423
37  interactive_ui_tests                0x00000001083a62cb _ZN7testing4Test3RunEv + 299
38  interactive_ui_tests                0x00000001083a7114 _ZN7testing8TestInfo3RunEv + 404
39  interactive_ui_tests                0x00000001083a7867 _ZN7testing8TestCase3RunEv + 455
40  interactive_ui_tests                0x00000001083aecd7 _ZN7testing8internal12UnitTestImpl11RunAllTestsEv + 823
41  interactive_ui_tests                0x00000001083ae969 _ZN7testing8UnitTest3RunEv + 265
42  interactive_ui_tests                0x000000010848b2df _ZN4base9TestSuite3RunEv + 127
43  interactive_ui_tests                0x000000010580c2da _ZN28InteractiveUITestSuiteRunner12RunTestSuiteEiPPc + 42
44  interactive_ui_tests                0x0000000107c5b512 _ZN7content11LaunchTestsEPNS_20TestLauncherDelegateEiiPPc + 386
45  interactive_ui_tests                0x000000010580c251 main + 97
46  interactive_ui_tests                0x00000001056f2234 start + 52
47  ???                                 0x0000000000000009 0x0 + 9

As a result I made BringBrowserWindowToFront not called on mac. I don't have a mac to investigate, but it would be good if we could call BringBrowserWindowToFront everywhere and remove some of the explicit calls to BringBrowserWindowToFront throughout the tests.
 
Owner: ellyjo...@chromium.org
Status: Assigned (was: Untriaged)

Comment 2 by sky@chromium.org, Sep 14 2016

Thanks for taking this Elly! If we can fix the mac one there is a bunch of random calls to BringBrowserWindowToFront throughout tests that can be removed.

Comment 3 by groby@chromium.org, Sep 14 2016

This sounds vaguely familiar. I want to say it's an issue because of the translate bubble's focus handling.

That particular test simulates a translation occurring, and the bubble goes into the "after" (this page has been translated, revert?) state. A focus event takes away key status from the window, which will close it.

I wonder if there's a race condition where a key event at _just_ the right moment closes the window before it should be closed...

Here's my guess: 
* translate notification posted
* as part of that, -switchView on TranslateBubbleController is invoked
* that does an _animated_ showWindow
* still in the callback, the test observer fires, and the test continues
* FocusFirstField focuses, the - animating - window is being closed.

Closing an animating window has never been good, and there are countless tests littered with 

I suggest, just for fun, ripping the disable animations code from translate_bubble_controller_unittest.mm. Basically
  bwc_ =
        [BrowserWindowController browserWindowControllerForWindow:nativeWindow]
  [[bwc_ translateBubbleController] setAllowedAnimations:info_bubble::kAnimationNone];

The better fix is probably actually closing the bubble and waiting for the close.

Sign in to add a comment