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