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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) | 404 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) |
404 .SetMethod("setMockDeviceMotion", | 405 .SetMethod("setMockDeviceMotion", |
405 &TestRunnerBindings::SetMockDeviceMotion) | 406 &TestRunnerBindings::SetMockDeviceMotion) |
406 .SetMethod("setMockDeviceOrientation", | 407 .SetMethod("setMockDeviceOrientation", |
407 &TestRunnerBindings::SetMockDeviceOrientation) | 408 &TestRunnerBindings::SetMockDeviceOrientation) |
408 .SetMethod("setMockScreenOrientation", | 409 .SetMethod("setMockScreenOrientation", |
409 &TestRunnerBindings::SetMockScreenOrientation) | 410 &TestRunnerBindings::SetMockScreenOrientation) |
410 .SetMethod("didChangeBatteryStatus", | 411 .SetMethod("didChangeBatteryStatus", |
411 &TestRunnerBindings::DidChangeBatteryStatus) | 412 &TestRunnerBindings::DidChangeBatteryStatus) |
412 .SetMethod("resetBatteryStatus", &TestRunnerBindings::ResetBatteryStatus) | 413 .SetMethod("resetBatteryStatus", &TestRunnerBindings::ResetBatteryStatus) |
| 414 .SetMethod("setMockScreenAvailability", |
| 415 &TestRunnerBindings::SetMockScreenAvailability) |
413 .SetMethod("didAcquirePointerLock", | 416 .SetMethod("didAcquirePointerLock", |
414 &TestRunnerBindings::DidAcquirePointerLock) | 417 &TestRunnerBindings::DidAcquirePointerLock) |
415 .SetMethod("didNotAcquirePointerLock", | 418 .SetMethod("didNotAcquirePointerLock", |
416 &TestRunnerBindings::DidNotAcquirePointerLock) | 419 &TestRunnerBindings::DidNotAcquirePointerLock) |
417 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock) | 420 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock) |
418 .SetMethod("setPointerLockWillFailSynchronously", | 421 .SetMethod("setPointerLockWillFailSynchronously", |
419 &TestRunnerBindings::SetPointerLockWillFailSynchronously) | 422 &TestRunnerBindings::SetPointerLockWillFailSynchronously) |
420 .SetMethod("setPointerLockWillRespondAsynchronously", | 423 .SetMethod("setPointerLockWillRespondAsynchronously", |
421 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously) | 424 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously) |
422 .SetMethod("setPopupBlockingEnabled", | 425 .SetMethod("setPopupBlockingEnabled", |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
957 runner_->DidChangeBatteryStatus(charging, chargingTime, | 960 runner_->DidChangeBatteryStatus(charging, chargingTime, |
958 dischargingTime, level); | 961 dischargingTime, level); |
959 } | 962 } |
960 } | 963 } |
961 | 964 |
962 void TestRunnerBindings::ResetBatteryStatus() { | 965 void TestRunnerBindings::ResetBatteryStatus() { |
963 if (runner_) | 966 if (runner_) |
964 runner_->ResetBatteryStatus(); | 967 runner_->ResetBatteryStatus(); |
965 } | 968 } |
966 | 969 |
| 970 void TestRunnerBindings::SetMockScreenAvailability(bool available) { |
| 971 if (runner_) |
| 972 runner_->SetMockScreenAvailability(available); |
| 973 } |
| 974 |
967 void TestRunnerBindings::DidAcquirePointerLock() { | 975 void TestRunnerBindings::DidAcquirePointerLock() { |
968 if (runner_) | 976 if (runner_) |
969 runner_->DidAcquirePointerLock(); | 977 runner_->DidAcquirePointerLock(); |
970 } | 978 } |
971 | 979 |
972 void TestRunnerBindings::DidNotAcquirePointerLock() { | 980 void TestRunnerBindings::DidNotAcquirePointerLock() { |
973 if (runner_) | 981 if (runner_) |
974 runner_->DidNotAcquirePointerLock(); | 982 runner_->DidNotAcquirePointerLock(); |
975 } | 983 } |
976 | 984 |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2440 status.dischargingTime = dischargingTime; | 2448 status.dischargingTime = dischargingTime; |
2441 status.level = level; | 2449 status.level = level; |
2442 delegate_->DidChangeBatteryStatus(status); | 2450 delegate_->DidChangeBatteryStatus(status); |
2443 } | 2451 } |
2444 | 2452 |
2445 void TestRunner::ResetBatteryStatus() { | 2453 void TestRunner::ResetBatteryStatus() { |
2446 blink::WebBatteryStatus status; | 2454 blink::WebBatteryStatus status; |
2447 delegate_->DidChangeBatteryStatus(status); | 2455 delegate_->DidChangeBatteryStatus(status); |
2448 } | 2456 } |
2449 | 2457 |
| 2458 void TestRunner::SetMockScreenAvailability(bool available) { |
| 2459 delegate_->SetScreenAvailability(available); |
| 2460 } |
| 2461 |
2450 void TestRunner::DidAcquirePointerLock() { | 2462 void TestRunner::DidAcquirePointerLock() { |
2451 DidAcquirePointerLockInternal(); | 2463 DidAcquirePointerLockInternal(); |
2452 } | 2464 } |
2453 | 2465 |
2454 void TestRunner::DidNotAcquirePointerLock() { | 2466 void TestRunner::DidNotAcquirePointerLock() { |
2455 DidNotAcquirePointerLockInternal(); | 2467 DidNotAcquirePointerLockInternal(); |
2456 } | 2468 } |
2457 | 2469 |
2458 void TestRunner::DidLosePointerLock() { | 2470 void TestRunner::DidLosePointerLock() { |
2459 DidLosePointerLockInternal(); | 2471 DidLosePointerLockInternal(); |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 } | 3016 } |
3005 | 3017 |
3006 void TestRunner::DidLosePointerLockInternal() { | 3018 void TestRunner::DidLosePointerLockInternal() { |
3007 bool was_locked = pointer_locked_; | 3019 bool was_locked = pointer_locked_; |
3008 pointer_locked_ = false; | 3020 pointer_locked_ = false; |
3009 if (was_locked) | 3021 if (was_locked) |
3010 web_view_->didLosePointerLock(); | 3022 web_view_->didLosePointerLock(); |
3011 } | 3023 } |
3012 | 3024 |
3013 } // namespace content | 3025 } // namespace content |
OLD | NEW |