# Page isn't responding and crash pages (S068). Offline; hidden only (real clicks: tools/wl-input), SMOKE_SIZE=1280x900.
# A busy page: after HANG_AFTER (5 s) without an answer the bar shows (also when its tab comes back to the front), a
# second tab stays usable, Reload page kills the process and loads the page again; Wait hides the bar and it clears
# itself when the page answers. A killed web process shows the crash page: active tab, hidden tab, tab in picture in
# picture. Read the PNGs: hang-bar, hang-back, hang-wait, hang-switch, crash-active, crash-hidden, crash-pip.
wait 3
open @PAGES@/hang.html
waitload
locate #go
wait 0.5
click @
# The page can't take this click: WebKit waits for an answer and marks the process unresponsive.
wait 0.5
click 600 500
wait 9
expect /active/unresponsive > 5
shot hang-bar
newtab @PAGES@/hello.html
waitload
assert document.title === 'Smoke page'
expect /active/unresponsive null
shot hang-other
cmd select 0
wait 1
expect /active/unresponsive > 5
shot hang-back
cmd hang_reload
waitload
wait 1
expect /active/unresponsive null
expect /active/crashed null
assert document.getElementById('state').textContent === 'Idle'
# Wait: the bar goes; once the page is done it answers again and the tab is marked responsive.
locate #go
wait 0.5
click @
wait 0.5
click 600 500
wait 9
expect /active/unresponsive > 5
cmd hang_wait
wait 1
shot hang-wait
waitstatus 30 /tabs/0/unresponsive null
assert document.getElementById('state').textContent === 'Done'
# Busy while hidden (nothing pokes it): turning to the tab checks it (App::ping_page), and the bar shows.
locate #go
wait 0.5
click @
newtab @PAGES@/hello.html
wait 2
cmd select 0
wait 7
expect /active/unresponsive > 4
shot hang-switch
waitstatus 30 /tabs/0/unresponsive null
cmd select 2
cmd close_tab
cmd select 0
wait 1
# Crash pages.
cmd kill_page
wait 2
expect /active/crashed "The page was stopped."
shot crash-active
cmd kill_page 1
wait 2
expect /tabs/1/crashed "The page was stopped."
cmd select 1
wait 1
shot crash-hidden
open @PAGES@/video.html
waitload
expect /active/crashed null
waitfor 10 document.getElementById('v').currentTime > 0.5
cmd pip
wait 2
expect /active/pip true
cmd kill_page
wait 2
expect /windows 1
expect /active/pip false
expect /active/crashed "The page was stopped."
expect /active/audible false
shot crash-pip
status done
quit
