Commit f738bdcb authored by tkent@chromium.org's avatar tkent@chromium.org

Form validation bubble should be closed when RenderView is terminated.

Blink closes it when a page is disposed. However, Blink can do nothing
when the renderer process is terminated. Chromium needs to close it in
such case.

BUG=355564

Review URL: https://codereview.chromium.org/385043002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282690 0039d316-1c4b-4281-b951-d872f2087c98
parent a533d9b8
......@@ -3394,6 +3394,9 @@ void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh,
if (dialog_manager_)
dialog_manager_->CancelActiveAndPendingDialogs(this);
if (delegate_)
delegate_->HideValidationMessage(this);
SetIsLoading(rvh, false, true, NULL);
NotifyDisconnected();
SetIsCrashed(status, error_code);
......
......@@ -314,6 +314,26 @@ class FakeFullscreenDelegate : public WebContentsDelegate {
DISALLOW_COPY_AND_ASSIGN(FakeFullscreenDelegate);
};
class FakeValidationMessageDelegate : public WebContentsDelegate {
public:
FakeValidationMessageDelegate()
: hide_validation_message_was_called_(false) {}
virtual ~FakeValidationMessageDelegate() {}
virtual void HideValidationMessage(WebContents* web_contents) OVERRIDE {
hide_validation_message_was_called_ = true;
}
bool hide_validation_message_was_called() const {
return hide_validation_message_was_called_;
}
private:
bool hide_validation_message_was_called_;
DISALLOW_COPY_AND_ASSIGN(FakeValidationMessageDelegate);
};
} // namespace
// Test to make sure that title updates get stripped of whitespace.
......@@ -1423,6 +1443,22 @@ TEST_F(WebContentsImplTest, HistoryNavigationExitsFullscreen) {
contents()->SetDelegate(NULL);
}
TEST_F(WebContentsImplTest, TerminateHidesValidationMessage) {
FakeValidationMessageDelegate fake_delegate;
contents()->SetDelegate(&fake_delegate);
EXPECT_FALSE(fake_delegate.hide_validation_message_was_called());
// Crash the renderer.
test_rvh()->OnMessageReceived(
ViewHostMsg_RenderProcessGone(
0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1));
// Confirm HideValidationMessage was called.
EXPECT_TRUE(fake_delegate.hide_validation_message_was_called());
contents()->SetDelegate(NULL);
}
// Tests that fullscreen is exited throughout the object hierarchy on a renderer
// crash.
TEST_F(WebContentsImplTest, CrashExitsFullscreen) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment