Index: content/browser/web_contents/web_contents_impl_unittest.cc |
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc |
index a836b9dc5253356a25bcfe23d82ae63520589536..fdee01a2bd85176d12cb1f7a8af91ee9f0fcb23f 100644 |
--- a/content/browser/web_contents/web_contents_impl_unittest.cc |
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc |
@@ -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) { |