OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/test_runner/web_widget_test_client.h" | 5 #include "components/test_runner/web_widget_test_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 } | 31 } |
32 | 32 |
33 WebWidgetTestClient::~WebWidgetTestClient() {} | 33 WebWidgetTestClient::~WebWidgetTestClient() {} |
34 | 34 |
35 void WebWidgetTestClient::scheduleAnimation() { | 35 void WebWidgetTestClient::scheduleAnimation() { |
36 if (!test_runner()->TestIsRunning()) | 36 if (!test_runner()->TestIsRunning()) |
37 return; | 37 return; |
38 | 38 |
39 if (!animation_scheduled_) { | 39 if (!animation_scheduled_) { |
40 animation_scheduled_ = true; | 40 animation_scheduled_ = true; |
41 test_runner()->OnAnimationScheduled( | |
42 web_widget_test_proxy_base_->web_widget()); | |
43 | |
44 delegate()->PostDelayedTask(base::Bind(&WebWidgetTestClient::AnimateNow, | 41 delegate()->PostDelayedTask(base::Bind(&WebWidgetTestClient::AnimateNow, |
45 weak_factory_.GetWeakPtr()), | 42 weak_factory_.GetWeakPtr()), |
46 1); | 43 1); |
47 } | 44 } |
48 } | 45 } |
49 | 46 |
50 void WebWidgetTestClient::AnimateNow() { | 47 void WebWidgetTestClient::AnimateNow() { |
51 if (animation_scheduled_) { | 48 if (animation_scheduled_) { |
52 blink::WebWidget* web_widget = web_widget_test_proxy_base_->web_widget(); | 49 blink::WebWidget* web_widget = web_widget_test_proxy_base_->web_widget(); |
53 animation_scheduled_ = false; | 50 animation_scheduled_ = false; |
54 test_runner()->OnAnimationBegun(web_widget); | |
55 | |
56 base::TimeDelta animate_time = base::TimeTicks::Now() - base::TimeTicks(); | 51 base::TimeDelta animate_time = base::TimeTicks::Now() - base::TimeTicks(); |
57 web_widget->beginFrame(animate_time.InSecondsF()); | 52 web_widget->beginFrame(animate_time.InSecondsF()); |
58 web_widget->updateAllLifecyclePhases(); | 53 web_widget->updateAllLifecyclePhases(); |
59 if (blink::WebPagePopup* popup = web_widget->pagePopup()) { | 54 if (blink::WebPagePopup* popup = web_widget->pagePopup()) { |
60 popup->beginFrame(animate_time.InSecondsF()); | 55 popup->beginFrame(animate_time.InSecondsF()); |
61 popup->updateAllLifecyclePhases(); | 56 popup->updateAllLifecyclePhases(); |
62 } | 57 } |
63 } | 58 } |
64 } | 59 } |
65 | 60 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return web_widget_test_proxy_base_->web_view_test_proxy_base()->delegate(); | 112 return web_widget_test_proxy_base_->web_view_test_proxy_base()->delegate(); |
118 } | 113 } |
119 | 114 |
120 TestRunner* WebWidgetTestClient::test_runner() { | 115 TestRunner* WebWidgetTestClient::test_runner() { |
121 return web_widget_test_proxy_base_->web_view_test_proxy_base() | 116 return web_widget_test_proxy_base_->web_view_test_proxy_base() |
122 ->test_interfaces() | 117 ->test_interfaces() |
123 ->GetTestRunner(); | 118 ->GetTestRunner(); |
124 } | 119 } |
125 | 120 |
126 } // namespace test_runner | 121 } // namespace test_runner |
OLD | NEW |