| 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 "components/test_runner/test_runner.h" | 5 #include "components/test_runner/test_runner.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) { | 981 void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) { |
| 982 if (!runner_) | 982 if (!runner_) |
| 983 return; | 983 return; |
| 984 | 984 |
| 985 bool has_alpha = false; | 985 bool has_alpha = false; |
| 986 double alpha = 0.0; | 986 double alpha = 0.0; |
| 987 bool has_beta = false; | 987 bool has_beta = false; |
| 988 double beta = 0.0; | 988 double beta = 0.0; |
| 989 bool has_gamma = false; | 989 bool has_gamma = false; |
| 990 double gamma = 0.0; | 990 double gamma = 0.0; |
| 991 bool has_absolute = false; | |
| 992 bool absolute = false; | 991 bool absolute = false; |
| 993 | 992 |
| 994 args->GetNext(&has_alpha); | 993 args->GetNext(&has_alpha); |
| 995 args->GetNext(&alpha); | 994 args->GetNext(&alpha); |
| 996 args->GetNext(&has_beta); | 995 args->GetNext(&has_beta); |
| 997 args->GetNext(&beta); | 996 args->GetNext(&beta); |
| 998 args->GetNext(&has_gamma); | 997 args->GetNext(&has_gamma); |
| 999 args->GetNext(&gamma); | 998 args->GetNext(&gamma); |
| 1000 args->GetNext(&has_absolute); | |
| 1001 args->GetNext(&absolute); | 999 args->GetNext(&absolute); |
| 1002 | 1000 |
| 1003 runner_->SetMockDeviceOrientation(has_alpha, alpha, | 1001 runner_->SetMockDeviceOrientation(has_alpha, alpha, |
| 1004 has_beta, beta, | 1002 has_beta, beta, |
| 1005 has_gamma, gamma, | 1003 has_gamma, gamma, |
| 1006 has_absolute, absolute); | 1004 absolute); |
| 1007 } | 1005 } |
| 1008 | 1006 |
| 1009 void TestRunnerBindings::SetMockScreenOrientation( | 1007 void TestRunnerBindings::SetMockScreenOrientation( |
| 1010 const std::string& orientation) { | 1008 const std::string& orientation) { |
| 1011 if (!runner_) | 1009 if (!runner_) |
| 1012 return; | 1010 return; |
| 1013 | 1011 |
| 1014 runner_->SetMockScreenOrientation(orientation); | 1012 runner_->SetMockScreenOrientation(orientation); |
| 1015 } | 1013 } |
| 1016 | 1014 |
| (...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2481 | 2479 |
| 2482 // interval | 2480 // interval |
| 2483 motion.interval = interval; | 2481 motion.interval = interval; |
| 2484 | 2482 |
| 2485 delegate_->SetDeviceMotionData(motion); | 2483 delegate_->SetDeviceMotionData(motion); |
| 2486 } | 2484 } |
| 2487 | 2485 |
| 2488 void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha, | 2486 void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha, |
| 2489 bool has_beta, double beta, | 2487 bool has_beta, double beta, |
| 2490 bool has_gamma, double gamma, | 2488 bool has_gamma, double gamma, |
| 2491 bool has_absolute, bool absolute) { | 2489 bool absolute) { |
| 2492 WebDeviceOrientationData orientation; | 2490 WebDeviceOrientationData orientation; |
| 2493 | 2491 |
| 2494 // alpha | 2492 // alpha |
| 2495 orientation.hasAlpha = has_alpha; | 2493 orientation.hasAlpha = has_alpha; |
| 2496 orientation.alpha = alpha; | 2494 orientation.alpha = alpha; |
| 2497 | 2495 |
| 2498 // beta | 2496 // beta |
| 2499 orientation.hasBeta = has_beta; | 2497 orientation.hasBeta = has_beta; |
| 2500 orientation.beta = beta; | 2498 orientation.beta = beta; |
| 2501 | 2499 |
| 2502 // gamma | 2500 // gamma |
| 2503 orientation.hasGamma = has_gamma; | 2501 orientation.hasGamma = has_gamma; |
| 2504 orientation.gamma = gamma; | 2502 orientation.gamma = gamma; |
| 2505 | 2503 |
| 2506 // absolute | 2504 // absolute |
| 2507 orientation.hasAbsolute = has_absolute; | |
| 2508 orientation.absolute = absolute; | 2505 orientation.absolute = absolute; |
| 2509 | 2506 |
| 2510 delegate_->SetDeviceOrientationData(orientation); | 2507 delegate_->SetDeviceOrientationData(orientation); |
| 2511 } | 2508 } |
| 2512 | 2509 |
| 2513 void TestRunner::SetMockScreenOrientation(const std::string& orientation_str) { | 2510 void TestRunner::SetMockScreenOrientation(const std::string& orientation_str) { |
| 2514 blink::WebScreenOrientationType orientation; | 2511 blink::WebScreenOrientationType orientation; |
| 2515 | 2512 |
| 2516 if (orientation_str == "portrait-primary") { | 2513 if (orientation_str == "portrait-primary") { |
| 2517 orientation = WebScreenOrientationPortraitPrimary; | 2514 orientation = WebScreenOrientationPortraitPrimary; |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3183 } | 3180 } |
| 3184 | 3181 |
| 3185 void TestRunner::DidLosePointerLockInternal() { | 3182 void TestRunner::DidLosePointerLockInternal() { |
| 3186 bool was_locked = pointer_locked_; | 3183 bool was_locked = pointer_locked_; |
| 3187 pointer_locked_ = false; | 3184 pointer_locked_ = false; |
| 3188 if (was_locked) | 3185 if (was_locked) |
| 3189 web_view_->didLosePointerLock(); | 3186 web_view_->didLosePointerLock(); |
| 3190 } | 3187 } |
| 3191 | 3188 |
| 3192 } // namespace test_runner | 3189 } // namespace test_runner |
| OLD | NEW |