OLD | NEW |
---|---|
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/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1099 } | 1099 } |
1100 | 1100 |
1101 // Test that the rendering timeout for newly loaded content fires | 1101 // Test that the rendering timeout for newly loaded content fires |
1102 // when enough time passes without receiving a new compositor frame. | 1102 // when enough time passes without receiving a new compositor frame. |
1103 TEST_F(RenderWidgetHostTest, NewContentRenderingTimeout) { | 1103 TEST_F(RenderWidgetHostTest, NewContentRenderingTimeout) { |
1104 host_->set_new_content_rendering_delay_for_testing( | 1104 host_->set_new_content_rendering_delay_for_testing( |
1105 base::TimeDelta::FromMicroseconds(10)); | 1105 base::TimeDelta::FromMicroseconds(10)); |
1106 | 1106 |
1107 // Test immediate start and stop, ensuring that the timeout doesn't fire. | 1107 // Test immediate start and stop, ensuring that the timeout doesn't fire. |
1108 host_->StartNewContentRenderingTimeout(); | 1108 host_->StartNewContentRenderingTimeout(); |
1109 host_->StopNewContentRenderingTimeout(); | 1109 host_->OnFirstPaintAfterLoad(); |
1110 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1110 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1111 FROM_HERE, base::MessageLoop::QuitClosure(), | 1111 FROM_HERE, base::MessageLoop::QuitClosure(), |
1112 TimeDelta::FromMicroseconds(20)); | 1112 TimeDelta::FromMicroseconds(20)); |
esprehn
2015/10/02 05:58:15
Why wait 20 microseconds? This usually produces fl
kenrb
2015/10/02 13:24:40
I used the same values as the hung renderer test,
| |
1113 base::MessageLoop::current()->Run(); | |
1114 | |
1115 EXPECT_FALSE(host_->new_content_rendering_timeout_fired()); | |
1116 | |
1117 // Test that the timer doesn't fire if it receives a stop before | |
1118 // a start. | |
1119 host_->OnFirstPaintAfterLoad(); | |
1120 host_->StartNewContentRenderingTimeout(); | |
1121 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
1122 FROM_HERE, base::MessageLoop::QuitClosure(), | |
1123 TimeDelta::FromMicroseconds(20)); | |
1113 base::MessageLoop::current()->Run(); | 1124 base::MessageLoop::current()->Run(); |
1114 | 1125 |
1115 EXPECT_FALSE(host_->new_content_rendering_timeout_fired()); | 1126 EXPECT_FALSE(host_->new_content_rendering_timeout_fired()); |
1116 | 1127 |
1117 // Test with a long delay to ensure that it does fire this time. | 1128 // Test with a long delay to ensure that it does fire this time. |
1118 host_->StartNewContentRenderingTimeout(); | 1129 host_->StartNewContentRenderingTimeout(); |
1119 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1130 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1120 FROM_HERE, base::MessageLoop::QuitClosure(), | 1131 FROM_HERE, base::MessageLoop::QuitClosure(), |
1121 TimeDelta::FromMicroseconds(20)); | 1132 TimeDelta::FromMicroseconds(20)); |
1122 base::MessageLoop::current()->Run(); | 1133 base::MessageLoop::current()->Run(); |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1579 // Having an initial size set means that the size information had been sent | 1590 // Having an initial size set means that the size information had been sent |
1580 // with the reqiest to new up the RenderView and so subsequent WasResized | 1591 // with the reqiest to new up the RenderView and so subsequent WasResized |
1581 // calls should not result in new IPC (unless the size has actually changed). | 1592 // calls should not result in new IPC (unless the size has actually changed). |
1582 host_->WasResized(); | 1593 host_->WasResized(); |
1583 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); | 1594 EXPECT_FALSE(process_->sink().GetUniqueMessageMatching(ViewMsg_Resize::ID)); |
1584 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); | 1595 EXPECT_EQ(initial_size_, host_->old_resize_params_->new_size); |
1585 EXPECT_TRUE(host_->resize_ack_pending_); | 1596 EXPECT_TRUE(host_->resize_ack_pending_); |
1586 } | 1597 } |
1587 | 1598 |
1588 } // namespace content | 1599 } // namespace content |
OLD | NEW |