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

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

Issue 8872030: Removing MessageLoop::QuitTask() from content/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix escaping Created 9 years 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 707 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 TEST_F(RenderWidgetHostTest, DontPostponeHangMonitorTimeout) { 718 TEST_F(RenderWidgetHostTest, DontPostponeHangMonitorTimeout) {
719 // Start with a short timeout. 719 // Start with a short timeout.
720 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 720 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
721 721
722 // Immediately try to add a long 30 second timeout. 722 // Immediately try to add a long 30 second timeout.
723 EXPECT_FALSE(host_->unresponsive_timer_fired()); 723 EXPECT_FALSE(host_->unresponsive_timer_fired());
724 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(30000)); 724 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(30000));
725 725
726 // Wait long enough for first timeout and see if it fired. 726 // Wait long enough for first timeout and see if it fired.
727 MessageLoop::current()->PostDelayedTask(FROM_HERE, 727 MessageLoop::current()->PostDelayedTask(FROM_HERE,
728 new MessageLoop::QuitTask(), 10); 728 MessageLoop::QuitClosure(), 10);
729 MessageLoop::current()->Run(); 729 MessageLoop::current()->Run();
730 EXPECT_TRUE(host_->unresponsive_timer_fired()); 730 EXPECT_TRUE(host_->unresponsive_timer_fired());
731 } 731 }
732 732
733 // Test that the hang monitor timer expires properly if it is started, stopped, 733 // Test that the hang monitor timer expires properly if it is started, stopped,
734 // and then started again. 734 // and then started again.
735 TEST_F(RenderWidgetHostTest, StopAndStartHangMonitorTimeout) { 735 TEST_F(RenderWidgetHostTest, StopAndStartHangMonitorTimeout) {
736 // Start with a short timeout, then stop it. 736 // Start with a short timeout, then stop it.
737 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 737 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
738 host_->StopHangMonitorTimeout(); 738 host_->StopHangMonitorTimeout();
739 739
740 // Start it again to ensure it still works. 740 // Start it again to ensure it still works.
741 EXPECT_FALSE(host_->unresponsive_timer_fired()); 741 EXPECT_FALSE(host_->unresponsive_timer_fired());
742 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10)); 742 host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds(10));
743 743
744 // Wait long enough for first timeout and see if it fired. 744 // Wait long enough for first timeout and see if it fired.
745 MessageLoop::current()->PostDelayedTask(FROM_HERE, 745 MessageLoop::current()->PostDelayedTask(FROM_HERE,
746 new MessageLoop::QuitTask(), 40); 746 MessageLoop::QuitClosure(), 40);
747 MessageLoop::current()->Run(); 747 MessageLoop::current()->Run();
748 EXPECT_TRUE(host_->unresponsive_timer_fired()); 748 EXPECT_TRUE(host_->unresponsive_timer_fired());
749 } 749 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698