Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2975)

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 385043002: Form validation bubble should be closed when RenderView is terminated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add a test Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698