| 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/public/test/layouttest_support.h" | 10 #include "content/public/test/layouttest_support.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 void SetMockDeviceLight(double value); | 197 void SetMockDeviceLight(double value); |
| 198 void ResetDeviceLight(); | 198 void ResetDeviceLight(); |
| 199 void SetMockDeviceMotion(gin::Arguments* args); | 199 void SetMockDeviceMotion(gin::Arguments* args); |
| 200 void SetMockDeviceOrientation(gin::Arguments* args); | 200 void SetMockDeviceOrientation(gin::Arguments* args); |
| 201 void SetMockScreenOrientation(const std::string& orientation); | 201 void SetMockScreenOrientation(const std::string& orientation); |
| 202 void DidChangeBatteryStatus(bool charging, | 202 void DidChangeBatteryStatus(bool charging, |
| 203 double chargingTime, | 203 double chargingTime, |
| 204 double dischargingTime, | 204 double dischargingTime, |
| 205 double level); | 205 double level); |
| 206 void ResetBatteryStatus(); | 206 void ResetBatteryStatus(); |
| 207 void SetMockScreenAvailability(bool available); |
| 207 void DidAcquirePointerLock(); | 208 void DidAcquirePointerLock(); |
| 208 void DidNotAcquirePointerLock(); | 209 void DidNotAcquirePointerLock(); |
| 209 void DidLosePointerLock(); | 210 void DidLosePointerLock(); |
| 210 void SetPointerLockWillFailSynchronously(); | 211 void SetPointerLockWillFailSynchronously(); |
| 211 void SetPointerLockWillRespondAsynchronously(); | 212 void SetPointerLockWillRespondAsynchronously(); |
| 212 void SetPopupBlockingEnabled(bool block_popups); | 213 void SetPopupBlockingEnabled(bool block_popups); |
| 213 void SetJavaScriptCanAccessClipboard(bool can_access); | 214 void SetJavaScriptCanAccessClipboard(bool can_access); |
| 214 void SetXSSAuditorEnabled(bool enabled); | 215 void SetXSSAuditorEnabled(bool enabled); |
| 215 void SetAllowUniversalAccessFromFileURLs(bool allow); | 216 void SetAllowUniversalAccessFromFileURLs(bool allow); |
| 216 void SetAllowFileAccessFromFileURLs(bool allow); | 217 void SetAllowFileAccessFromFileURLs(bool allow); |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) | 405 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) |
| 405 .SetMethod("setMockDeviceMotion", | 406 .SetMethod("setMockDeviceMotion", |
| 406 &TestRunnerBindings::SetMockDeviceMotion) | 407 &TestRunnerBindings::SetMockDeviceMotion) |
| 407 .SetMethod("setMockDeviceOrientation", | 408 .SetMethod("setMockDeviceOrientation", |
| 408 &TestRunnerBindings::SetMockDeviceOrientation) | 409 &TestRunnerBindings::SetMockDeviceOrientation) |
| 409 .SetMethod("setMockScreenOrientation", | 410 .SetMethod("setMockScreenOrientation", |
| 410 &TestRunnerBindings::SetMockScreenOrientation) | 411 &TestRunnerBindings::SetMockScreenOrientation) |
| 411 .SetMethod("didChangeBatteryStatus", | 412 .SetMethod("didChangeBatteryStatus", |
| 412 &TestRunnerBindings::DidChangeBatteryStatus) | 413 &TestRunnerBindings::DidChangeBatteryStatus) |
| 413 .SetMethod("resetBatteryStatus", &TestRunnerBindings::ResetBatteryStatus) | 414 .SetMethod("resetBatteryStatus", &TestRunnerBindings::ResetBatteryStatus) |
| 415 .SetMethod("setMockScreenAvailability", |
| 416 &TestRunnerBindings::SetMockScreenAvailability) |
| 414 .SetMethod("didAcquirePointerLock", | 417 .SetMethod("didAcquirePointerLock", |
| 415 &TestRunnerBindings::DidAcquirePointerLock) | 418 &TestRunnerBindings::DidAcquirePointerLock) |
| 416 .SetMethod("didNotAcquirePointerLock", | 419 .SetMethod("didNotAcquirePointerLock", |
| 417 &TestRunnerBindings::DidNotAcquirePointerLock) | 420 &TestRunnerBindings::DidNotAcquirePointerLock) |
| 418 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock) | 421 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock) |
| 419 .SetMethod("setPointerLockWillFailSynchronously", | 422 .SetMethod("setPointerLockWillFailSynchronously", |
| 420 &TestRunnerBindings::SetPointerLockWillFailSynchronously) | 423 &TestRunnerBindings::SetPointerLockWillFailSynchronously) |
| 421 .SetMethod("setPointerLockWillRespondAsynchronously", | 424 .SetMethod("setPointerLockWillRespondAsynchronously", |
| 422 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously) | 425 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously) |
| 423 .SetMethod("setPopupBlockingEnabled", | 426 .SetMethod("setPopupBlockingEnabled", |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 959 runner_->DidChangeBatteryStatus(charging, chargingTime, | 962 runner_->DidChangeBatteryStatus(charging, chargingTime, |
| 960 dischargingTime, level); | 963 dischargingTime, level); |
| 961 } | 964 } |
| 962 } | 965 } |
| 963 | 966 |
| 964 void TestRunnerBindings::ResetBatteryStatus() { | 967 void TestRunnerBindings::ResetBatteryStatus() { |
| 965 if (runner_) | 968 if (runner_) |
| 966 runner_->ResetBatteryStatus(); | 969 runner_->ResetBatteryStatus(); |
| 967 } | 970 } |
| 968 | 971 |
| 972 void TestRunnerBindings::SetMockScreenAvailability(bool available) { |
| 973 if (runner_) |
| 974 runner_->SetMockScreenAvailability(available); |
| 975 } |
| 976 |
| 969 void TestRunnerBindings::DidAcquirePointerLock() { | 977 void TestRunnerBindings::DidAcquirePointerLock() { |
| 970 if (runner_) | 978 if (runner_) |
| 971 runner_->DidAcquirePointerLock(); | 979 runner_->DidAcquirePointerLock(); |
| 972 } | 980 } |
| 973 | 981 |
| 974 void TestRunnerBindings::DidNotAcquirePointerLock() { | 982 void TestRunnerBindings::DidNotAcquirePointerLock() { |
| 975 if (runner_) | 983 if (runner_) |
| 976 runner_->DidNotAcquirePointerLock(); | 984 runner_->DidNotAcquirePointerLock(); |
| 977 } | 985 } |
| 978 | 986 |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 delegate_->SetDeviceColorProfile("reset"); | 1640 delegate_->SetDeviceColorProfile("reset"); |
| 1633 delegate_->SetDeviceScaleFactor(1); | 1641 delegate_->SetDeviceScaleFactor(1); |
| 1634 delegate_->SetAcceptAllCookies(false); | 1642 delegate_->SetAcceptAllCookies(false); |
| 1635 delegate_->SetLocale(""); | 1643 delegate_->SetLocale(""); |
| 1636 delegate_->UseUnfortunateSynchronousResizeMode(false); | 1644 delegate_->UseUnfortunateSynchronousResizeMode(false); |
| 1637 delegate_->DisableAutoResizeMode(WebSize()); | 1645 delegate_->DisableAutoResizeMode(WebSize()); |
| 1638 delegate_->DeleteAllCookies(); | 1646 delegate_->DeleteAllCookies(); |
| 1639 delegate_->ResetScreenOrientation(); | 1647 delegate_->ResetScreenOrientation(); |
| 1640 delegate_->SetBluetoothMockDataSet(""); | 1648 delegate_->SetBluetoothMockDataSet(""); |
| 1641 delegate_->ClearGeofencingMockProvider(); | 1649 delegate_->ClearGeofencingMockProvider(); |
| 1650 delegate_->ResetPresentationService(); |
| 1642 ResetBatteryStatus(); | 1651 ResetBatteryStatus(); |
| 1643 ResetDeviceLight(); | 1652 ResetDeviceLight(); |
| 1644 } | 1653 } |
| 1645 | 1654 |
| 1646 dump_editting_callbacks_ = false; | 1655 dump_editting_callbacks_ = false; |
| 1647 dump_as_text_ = false; | 1656 dump_as_text_ = false; |
| 1648 dump_as_markup_ = false; | 1657 dump_as_markup_ = false; |
| 1649 generate_pixel_results_ = true; | 1658 generate_pixel_results_ = true; |
| 1650 dump_child_frame_scroll_positions_ = false; | 1659 dump_child_frame_scroll_positions_ = false; |
| 1651 dump_child_frames_as_markup_ = false; | 1660 dump_child_frames_as_markup_ = false; |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2452 status.dischargingTime = dischargingTime; | 2461 status.dischargingTime = dischargingTime; |
| 2453 status.level = level; | 2462 status.level = level; |
| 2454 delegate_->DidChangeBatteryStatus(status); | 2463 delegate_->DidChangeBatteryStatus(status); |
| 2455 } | 2464 } |
| 2456 | 2465 |
| 2457 void TestRunner::ResetBatteryStatus() { | 2466 void TestRunner::ResetBatteryStatus() { |
| 2458 blink::WebBatteryStatus status; | 2467 blink::WebBatteryStatus status; |
| 2459 delegate_->DidChangeBatteryStatus(status); | 2468 delegate_->DidChangeBatteryStatus(status); |
| 2460 } | 2469 } |
| 2461 | 2470 |
| 2471 void TestRunner::SetMockScreenAvailability(bool available) { |
| 2472 delegate_->SetScreenAvailability(available); |
| 2473 } |
| 2474 |
| 2462 void TestRunner::DidAcquirePointerLock() { | 2475 void TestRunner::DidAcquirePointerLock() { |
| 2463 DidAcquirePointerLockInternal(); | 2476 DidAcquirePointerLockInternal(); |
| 2464 } | 2477 } |
| 2465 | 2478 |
| 2466 void TestRunner::DidNotAcquirePointerLock() { | 2479 void TestRunner::DidNotAcquirePointerLock() { |
| 2467 DidNotAcquirePointerLockInternal(); | 2480 DidNotAcquirePointerLockInternal(); |
| 2468 } | 2481 } |
| 2469 | 2482 |
| 2470 void TestRunner::DidLosePointerLock() { | 2483 void TestRunner::DidLosePointerLock() { |
| 2471 DidLosePointerLockInternal(); | 2484 DidLosePointerLockInternal(); |
| (...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3021 } | 3034 } |
| 3022 | 3035 |
| 3023 void TestRunner::DidLosePointerLockInternal() { | 3036 void TestRunner::DidLosePointerLockInternal() { |
| 3024 bool was_locked = pointer_locked_; | 3037 bool was_locked = pointer_locked_; |
| 3025 pointer_locked_ = false; | 3038 pointer_locked_ = false; |
| 3026 if (was_locked) | 3039 if (was_locked) |
| 3027 web_view_->didLosePointerLock(); | 3040 web_view_->didLosePointerLock(); |
| 3028 } | 3041 } |
| 3029 | 3042 |
| 3030 } // namespace content | 3043 } // namespace content |
| OLD | NEW |