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