Index: ui/aura/root_window.cc |
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc |
index 7ff474f23f7a43b4abc033c9a8b640e1c28af8c1..68de1bf5bfd0bfe3634d5e376227a5fdea20e854 100644 |
--- a/ui/aura/root_window.cc |
+++ b/ui/aura/root_window.cc |
@@ -430,6 +430,10 @@ gfx::Point RootWindow::GetLastMouseLocationInRoot() const { |
return location; |
} |
+void RootWindow::DelayDrawsForTesting(base::TimeDelta delay) { |
+ draw_scheduling_delay_for_testing_ = delay; |
+} |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// RootWindow, Window overrides: |
@@ -463,11 +467,19 @@ ui::EventTarget* RootWindow::GetParentTarget() { |
// RootWindow, ui::CompositorDelegate implementation: |
void RootWindow::ScheduleDraw() { |
- if (!defer_draw_scheduling_) { |
- defer_draw_scheduling_ = true; |
+ if (defer_draw_scheduling_) |
+ return; |
+ |
+ defer_draw_scheduling_ = true; |
+ if (draw_scheduling_delay_for_testing_ == base::TimeDelta()) { |
MessageLoop::current()->PostTask( |
FROM_HERE, |
base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr())); |
+ } else { |
+ MessageLoop::current()->PostDelayedTask( |
+ FROM_HERE, |
+ base::Bind(&RootWindow::Draw, schedule_paint_factory_.GetWeakPtr()), |
+ draw_scheduling_delay_for_testing_); |
} |
} |