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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <tuple> | 9 #include <tuple> |
10 | 10 |
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 EXPECT_TRUE(delegate_->unresponsive_timer_fired()); | 1246 EXPECT_TRUE(delegate_->unresponsive_timer_fired()); |
1247 } | 1247 } |
1248 | 1248 |
1249 // Test that the rendering timeout for newly loaded content fires | 1249 // Test that the rendering timeout for newly loaded content fires |
1250 // when enough time passes without receiving a new compositor frame. | 1250 // when enough time passes without receiving a new compositor frame. |
1251 TEST_F(RenderWidgetHostTest, NewContentRenderingTimeout) { | 1251 TEST_F(RenderWidgetHostTest, NewContentRenderingTimeout) { |
1252 host_->set_new_content_rendering_delay_for_testing( | 1252 host_->set_new_content_rendering_delay_for_testing( |
1253 base::TimeDelta::FromMicroseconds(10)); | 1253 base::TimeDelta::FromMicroseconds(10)); |
1254 | 1254 |
1255 // Test immediate start and stop, ensuring that the timeout doesn't fire. | 1255 // Test immediate start and stop, ensuring that the timeout doesn't fire. |
1256 host_->StartNewContentRenderingTimeout(); | 1256 host_->StartNewContentRenderingTimeout(0); |
1257 host_->OnFirstPaintAfterLoad(); | 1257 host_->OnFirstPaintAfterLoad(); |
1258 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1258 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1259 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 1259 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
1260 TimeDelta::FromMicroseconds(20)); | 1260 TimeDelta::FromMicroseconds(20)); |
1261 base::RunLoop().Run(); | 1261 base::RunLoop().Run(); |
1262 | 1262 |
1263 EXPECT_FALSE(host_->new_content_rendering_timeout_fired()); | 1263 EXPECT_FALSE(host_->new_content_rendering_timeout_fired()); |
1264 | 1264 |
1265 // Test that the timer doesn't fire if it receives a stop before | 1265 // Test that the timer doesn't fire if it receives a stop before |
1266 // a start. | 1266 // a start. |
1267 host_->OnFirstPaintAfterLoad(); | 1267 host_->OnFirstPaintAfterLoad(); |
1268 host_->StartNewContentRenderingTimeout(); | 1268 host_->StartNewContentRenderingTimeout(0); |
1269 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1269 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1270 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 1270 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
1271 TimeDelta::FromMicroseconds(20)); | 1271 TimeDelta::FromMicroseconds(20)); |
1272 base::RunLoop().Run(); | 1272 base::RunLoop().Run(); |
1273 | 1273 |
1274 EXPECT_FALSE(host_->new_content_rendering_timeout_fired()); | 1274 EXPECT_FALSE(host_->new_content_rendering_timeout_fired()); |
1275 | 1275 |
1276 // Test with a long delay to ensure that it does fire this time. | 1276 // Test with a long delay to ensure that it does fire this time. |
1277 host_->StartNewContentRenderingTimeout(); | 1277 host_->StartNewContentRenderingTimeout(0); |
1278 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 1278 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
1279 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), | 1279 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), |
1280 TimeDelta::FromMicroseconds(20)); | 1280 TimeDelta::FromMicroseconds(20)); |
1281 base::RunLoop().Run(); | 1281 base::RunLoop().Run(); |
1282 EXPECT_TRUE(host_->new_content_rendering_timeout_fired()); | 1282 EXPECT_TRUE(host_->new_content_rendering_timeout_fired()); |
1283 } | 1283 } |
1284 | 1284 |
1285 TEST_F(RenderWidgetHostTest, TouchEmulator) { | 1285 TEST_F(RenderWidgetHostTest, TouchEmulator) { |
1286 simulated_event_time_delta_seconds_ = 0.1; | 1286 simulated_event_time_delta_seconds_ = 0.1; |
1287 // Immediately ack all touches instead of sending them to the renderer. | 1287 // Immediately ack all touches instead of sending them to the renderer. |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1743 ui::LatencyInfo()); | 1743 ui::LatencyInfo()); |
1744 | 1744 |
1745 | 1745 |
1746 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). | 1746 // Tests RWHI::ForwardWheelEventWithLatencyInfo(). |
1747 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); | 1747 SimulateWheelEventWithLatencyInfo(-5, 0, 0, true, ui::LatencyInfo()); |
1748 | 1748 |
1749 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); | 1749 ASSERT_FALSE(host_->input_router()->HasPendingEvents()); |
1750 } | 1750 } |
1751 | 1751 |
1752 } // namespace content | 1752 } // namespace content |
OLD | NEW |