OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/shell/renderer/test_runner/test_runner.h" | 5 #include "content/shell/renderer/test_runner/test_runner.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "content/shell/common/test_runner/test_preferences.h" | 10 #include "content/shell/common/test_runner/test_preferences.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 std::string SelectionAsMarkup(); | 186 std::string SelectionAsMarkup(); |
187 void SetTextSubpixelPositioning(bool value); | 187 void SetTextSubpixelPositioning(bool value); |
188 void SetPageVisibility(const std::string& new_visibility); | 188 void SetPageVisibility(const std::string& new_visibility); |
189 void SetTextDirection(const std::string& direction_name); | 189 void SetTextDirection(const std::string& direction_name); |
190 void UseUnfortunateSynchronousResizeMode(); | 190 void UseUnfortunateSynchronousResizeMode(); |
191 bool EnableAutoResizeMode(int min_width, | 191 bool EnableAutoResizeMode(int min_width, |
192 int min_height, | 192 int min_height, |
193 int max_width, | 193 int max_width, |
194 int max_height); | 194 int max_height); |
195 bool DisableAutoResizeMode(int new_width, int new_height); | 195 bool DisableAutoResizeMode(int new_width, int new_height); |
| 196 void SetMockDeviceLight(double value); |
| 197 void ResetDeviceLight(); |
196 void SetMockDeviceMotion(gin::Arguments* args); | 198 void SetMockDeviceMotion(gin::Arguments* args); |
197 void SetMockDeviceOrientation(gin::Arguments* args); | 199 void SetMockDeviceOrientation(gin::Arguments* args); |
198 void SetMockScreenOrientation(const std::string& orientation); | 200 void SetMockScreenOrientation(const std::string& orientation); |
199 void DidChangeBatteryStatus(bool charging, | 201 void DidChangeBatteryStatus(bool charging, |
200 double chargingTime, | 202 double chargingTime, |
201 double dischargingTime, | 203 double dischargingTime, |
202 double level); | 204 double level); |
203 void ResetBatteryStatus(); | 205 void ResetBatteryStatus(); |
204 void DidAcquirePointerLock(); | 206 void DidAcquirePointerLock(); |
205 void DidNotAcquirePointerLock(); | 207 void DidNotAcquirePointerLock(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 .SetMethod("setTextSubpixelPositioning", | 390 .SetMethod("setTextSubpixelPositioning", |
389 &TestRunnerBindings::SetTextSubpixelPositioning) | 391 &TestRunnerBindings::SetTextSubpixelPositioning) |
390 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility) | 392 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility) |
391 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection) | 393 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection) |
392 .SetMethod("useUnfortunateSynchronousResizeMode", | 394 .SetMethod("useUnfortunateSynchronousResizeMode", |
393 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) | 395 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) |
394 .SetMethod("enableAutoResizeMode", | 396 .SetMethod("enableAutoResizeMode", |
395 &TestRunnerBindings::EnableAutoResizeMode) | 397 &TestRunnerBindings::EnableAutoResizeMode) |
396 .SetMethod("disableAutoResizeMode", | 398 .SetMethod("disableAutoResizeMode", |
397 &TestRunnerBindings::DisableAutoResizeMode) | 399 &TestRunnerBindings::DisableAutoResizeMode) |
| 400 .SetMethod("setMockDeviceLight", &TestRunnerBindings::SetMockDeviceLight) |
| 401 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) |
398 .SetMethod("setMockDeviceMotion", | 402 .SetMethod("setMockDeviceMotion", |
399 &TestRunnerBindings::SetMockDeviceMotion) | 403 &TestRunnerBindings::SetMockDeviceMotion) |
400 .SetMethod("setMockDeviceOrientation", | 404 .SetMethod("setMockDeviceOrientation", |
401 &TestRunnerBindings::SetMockDeviceOrientation) | 405 &TestRunnerBindings::SetMockDeviceOrientation) |
402 .SetMethod("setMockScreenOrientation", | 406 .SetMethod("setMockScreenOrientation", |
403 &TestRunnerBindings::SetMockScreenOrientation) | 407 &TestRunnerBindings::SetMockScreenOrientation) |
404 .SetMethod("didChangeBatteryStatus", | 408 .SetMethod("didChangeBatteryStatus", |
405 &TestRunnerBindings::DidChangeBatteryStatus) | 409 &TestRunnerBindings::DidChangeBatteryStatus) |
406 .SetMethod("resetBatteryStatus", | 410 .SetMethod("resetBatteryStatus", |
407 &TestRunnerBindings::ResetBatteryStatus) | 411 &TestRunnerBindings::ResetBatteryStatus) |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 } | 819 } |
816 return false; | 820 return false; |
817 } | 821 } |
818 | 822 |
819 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { | 823 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { |
820 if (runner_) | 824 if (runner_) |
821 return runner_->DisableAutoResizeMode(new_width, new_height); | 825 return runner_->DisableAutoResizeMode(new_width, new_height); |
822 return false; | 826 return false; |
823 } | 827 } |
824 | 828 |
| 829 void TestRunnerBindings::SetMockDeviceLight(double value) { |
| 830 if (!runner_) |
| 831 return; |
| 832 runner_->SetMockDeviceLight(value); |
| 833 } |
| 834 |
| 835 void TestRunnerBindings::ResetDeviceLight() { |
| 836 if (runner_) |
| 837 runner_->ResetDeviceLight(); |
| 838 } |
| 839 |
825 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) { | 840 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) { |
826 if (!runner_) | 841 if (!runner_) |
827 return; | 842 return; |
828 | 843 |
829 bool has_acceleration_x; | 844 bool has_acceleration_x; |
830 double acceleration_x; | 845 double acceleration_x; |
831 bool has_acceleration_y; | 846 bool has_acceleration_y; |
832 double acceleration_y; | 847 double acceleration_y; |
833 bool has_acceleration_z; | 848 bool has_acceleration_z; |
834 double acceleration_z; | 849 double acceleration_z; |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1558 delegate_->setDatabaseQuota(5 * 1024 * 1024); | 1573 delegate_->setDatabaseQuota(5 * 1024 * 1024); |
1559 delegate_->setDeviceColorProfile("sRGB"); | 1574 delegate_->setDeviceColorProfile("sRGB"); |
1560 delegate_->setDeviceScaleFactor(1); | 1575 delegate_->setDeviceScaleFactor(1); |
1561 delegate_->setAcceptAllCookies(false); | 1576 delegate_->setAcceptAllCookies(false); |
1562 delegate_->setLocale(""); | 1577 delegate_->setLocale(""); |
1563 delegate_->useUnfortunateSynchronousResizeMode(false); | 1578 delegate_->useUnfortunateSynchronousResizeMode(false); |
1564 delegate_->disableAutoResizeMode(WebSize()); | 1579 delegate_->disableAutoResizeMode(WebSize()); |
1565 delegate_->deleteAllCookies(); | 1580 delegate_->deleteAllCookies(); |
1566 delegate_->resetScreenOrientation(); | 1581 delegate_->resetScreenOrientation(); |
1567 ResetBatteryStatus(); | 1582 ResetBatteryStatus(); |
| 1583 ResetDeviceLight(); |
1568 } | 1584 } |
1569 | 1585 |
1570 dump_editting_callbacks_ = false; | 1586 dump_editting_callbacks_ = false; |
1571 dump_as_text_ = false; | 1587 dump_as_text_ = false; |
1572 dump_as_markup_ = false; | 1588 dump_as_markup_ = false; |
1573 generate_pixel_results_ = true; | 1589 generate_pixel_results_ = true; |
1574 dump_child_frame_scroll_positions_ = false; | 1590 dump_child_frame_scroll_positions_ = false; |
1575 dump_child_frames_as_markup_ = false; | 1591 dump_child_frames_as_markup_ = false; |
1576 dump_child_frames_as_text_ = false; | 1592 dump_child_frames_as_text_ = false; |
1577 dump_icon_changes_ = false; | 1593 dump_icon_changes_ = false; |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 delegate_->enableAutoResizeMode(min_size, max_size); | 2279 delegate_->enableAutoResizeMode(min_size, max_size); |
2264 return true; | 2280 return true; |
2265 } | 2281 } |
2266 | 2282 |
2267 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { | 2283 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { |
2268 WebSize new_size(new_width, new_height); | 2284 WebSize new_size(new_width, new_height); |
2269 delegate_->disableAutoResizeMode(new_size); | 2285 delegate_->disableAutoResizeMode(new_size); |
2270 return true; | 2286 return true; |
2271 } | 2287 } |
2272 | 2288 |
| 2289 void TestRunner::SetMockDeviceLight(double value) { |
| 2290 delegate_->setDeviceLightData(value); |
| 2291 } |
| 2292 |
| 2293 void TestRunner::ResetDeviceLight() { |
| 2294 delegate_->setDeviceLightData(-1); |
| 2295 } |
| 2296 |
2273 void TestRunner::SetMockDeviceMotion( | 2297 void TestRunner::SetMockDeviceMotion( |
2274 bool has_acceleration_x, double acceleration_x, | 2298 bool has_acceleration_x, double acceleration_x, |
2275 bool has_acceleration_y, double acceleration_y, | 2299 bool has_acceleration_y, double acceleration_y, |
2276 bool has_acceleration_z, double acceleration_z, | 2300 bool has_acceleration_z, double acceleration_z, |
2277 bool has_acceleration_including_gravity_x, | 2301 bool has_acceleration_including_gravity_x, |
2278 double acceleration_including_gravity_x, | 2302 double acceleration_including_gravity_x, |
2279 bool has_acceleration_including_gravity_y, | 2303 bool has_acceleration_including_gravity_y, |
2280 double acceleration_including_gravity_y, | 2304 double acceleration_including_gravity_y, |
2281 bool has_acceleration_including_gravity_z, | 2305 bool has_acceleration_including_gravity_z, |
2282 double acceleration_including_gravity_z, | 2306 double acceleration_including_gravity_z, |
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2865 } | 2889 } |
2866 | 2890 |
2867 void TestRunner::DidLosePointerLockInternal() { | 2891 void TestRunner::DidLosePointerLockInternal() { |
2868 bool was_locked = pointer_locked_; | 2892 bool was_locked = pointer_locked_; |
2869 pointer_locked_ = false; | 2893 pointer_locked_ = false; |
2870 if (was_locked) | 2894 if (was_locked) |
2871 web_view_->didLosePointerLock(); | 2895 web_view_->didLosePointerLock(); |
2872 } | 2896 } |
2873 | 2897 |
2874 } // namespace content | 2898 } // namespace content |
OLD | NEW |