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

Side by Side Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 10381073: Revert 132407 - Fixing a problem, where a hung renderer process is not killed when navigating away (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1130/src/
Patch Set: Created 8 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/shared_memory.h" 7 #include "base/shared_memory.h"
8 #include "base/timer.h" 8 #include "base/timer.h"
9 #include "content/browser/browser_thread_impl.h" 9 #include "content/browser/browser_thread_impl.h"
10 #include "content/browser/renderer_host/backing_store.h" 10 #include "content/browser/renderer_host/backing_store.h"
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 EXPECT_FALSE(host_->unresponsive_timer_fired()); 774 EXPECT_FALSE(host_->unresponsive_timer_fired());
775 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 775 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
776 776
777 // Wait long enough for first timeout and see if it fired. 777 // Wait long enough for first timeout and see if it fired.
778 MessageLoop::current()->PostDelayedTask( 778 MessageLoop::current()->PostDelayedTask(
779 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40)); 779 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40));
780 MessageLoop::current()->Run(); 780 MessageLoop::current()->Run();
781 EXPECT_TRUE(host_->unresponsive_timer_fired()); 781 EXPECT_TRUE(host_->unresponsive_timer_fired());
782 } 782 }
783 783
784 // Test that the hang monitor timer expires properly if it is started, then
785 // updated to a shorter duration.
786 TEST_F(RenderWidgetHostTest, ShorterDelayHangMonitorTimeout) {
787 // Start with a timeout.
788 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(100));
789
790 // Start it again with shorter delay.
791 EXPECT_FALSE(host_->unresponsive_timer_fired());
792 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(20));
793
794 // Wait long enough for first timeout and see if it fired.
795 MessageLoop::current()->PostDelayedTask(
796 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(25));
797 MessageLoop::current()->Run();
798 EXPECT_TRUE(host_->unresponsive_timer_fired());
799 }
800
801 // Test that the hang monitor catches two input events but only one ack. 784 // Test that the hang monitor catches two input events but only one ack.
802 // This can happen if the second input event causes the renderer to hang. 785 // This can happen if the second input event causes the renderer to hang.
803 // This test will catch a regression of crbug.com/111185. 786 // This test will catch a regression of crbug.com/111185.
804 TEST_F(RenderWidgetHostTest, MultipleInputEvents) { 787 TEST_F(RenderWidgetHostTest, MultipleInputEvents) {
805 // Configure the host to wait 10ms before considering 788 // Configure the host to wait 10ms before considering
806 // the renderer hung. 789 // the renderer hung.
807 host_->set_hung_renderer_delay_ms(10); 790 host_->set_hung_renderer_delay_ms(10);
808 791
809 // Send two events but only one ack. 792 // Send two events but only one ack.
810 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); 793 SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
811 SimulateKeyboardEvent(WebInputEvent::RawKeyDown); 794 SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
812 SendInputEventACK(WebInputEvent::RawKeyDown, true); 795 SendInputEventACK(WebInputEvent::RawKeyDown, true);
813 796
814 // Wait long enough for first timeout and see if it fired. 797 // Wait long enough for first timeout and see if it fired.
815 MessageLoop::current()->PostDelayedTask( 798 MessageLoop::current()->PostDelayedTask(
816 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40)); 799 FROM_HERE, MessageLoop::QuitClosure(), TimeDelta::FromMilliseconds(40));
817 MessageLoop::current()->Run(); 800 MessageLoop::current()->Run();
818 EXPECT_TRUE(host_->unresponsive_timer_fired()); 801 EXPECT_TRUE(host_->unresponsive_timer_fired());
819 } 802 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698