Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: components/test_runner/test_runner.cc

Issue 1737443002: Make DeviceOrientationEvent.prototype.absolute non-nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) { 987 void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) {
988 if (!runner_) 988 if (!runner_)
989 return; 989 return;
990 990
991 bool has_alpha = false; 991 bool has_alpha = false;
992 double alpha = 0.0; 992 double alpha = 0.0;
993 bool has_beta = false; 993 bool has_beta = false;
994 double beta = 0.0; 994 double beta = 0.0;
995 bool has_gamma = false; 995 bool has_gamma = false;
996 double gamma = 0.0; 996 double gamma = 0.0;
997 bool has_absolute = false;
998 bool absolute = false; 997 bool absolute = false;
999 998
1000 args->GetNext(&has_alpha); 999 args->GetNext(&has_alpha);
1001 args->GetNext(&alpha); 1000 args->GetNext(&alpha);
1002 args->GetNext(&has_beta); 1001 args->GetNext(&has_beta);
1003 args->GetNext(&beta); 1002 args->GetNext(&beta);
1004 args->GetNext(&has_gamma); 1003 args->GetNext(&has_gamma);
1005 args->GetNext(&gamma); 1004 args->GetNext(&gamma);
1006 args->GetNext(&has_absolute);
1007 args->GetNext(&absolute); 1005 args->GetNext(&absolute);
timvolodine 2016/03/01 22:46:01 oh hold on, actually don't think this is fixed in
philipj_slow 2016/03/02 07:30:42 Oops. I've updated the other instances, and indeed
1008 1006
1009 runner_->SetMockDeviceOrientation(has_alpha, alpha, 1007 runner_->SetMockDeviceOrientation(has_alpha, alpha,
1010 has_beta, beta, 1008 has_beta, beta,
1011 has_gamma, gamma, 1009 has_gamma, gamma,
1012 has_absolute, absolute); 1010 absolute);
1013 } 1011 }
1014 1012
1015 void TestRunnerBindings::SetMockScreenOrientation( 1013 void TestRunnerBindings::SetMockScreenOrientation(
1016 const std::string& orientation) { 1014 const std::string& orientation) {
1017 if (!runner_) 1015 if (!runner_)
1018 return; 1016 return;
1019 1017
1020 runner_->SetMockScreenOrientation(orientation); 1018 runner_->SetMockScreenOrientation(orientation);
1021 } 1019 }
1022 1020
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 2524
2527 // interval 2525 // interval
2528 motion.interval = interval; 2526 motion.interval = interval;
2529 2527
2530 delegate_->SetDeviceMotionData(motion); 2528 delegate_->SetDeviceMotionData(motion);
2531 } 2529 }
2532 2530
2533 void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha, 2531 void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha,
2534 bool has_beta, double beta, 2532 bool has_beta, double beta,
2535 bool has_gamma, double gamma, 2533 bool has_gamma, double gamma,
2536 bool has_absolute, bool absolute) { 2534 bool absolute) {
2537 WebDeviceOrientationData orientation; 2535 WebDeviceOrientationData orientation;
2538 2536
2539 // alpha 2537 // alpha
2540 orientation.hasAlpha = has_alpha; 2538 orientation.hasAlpha = has_alpha;
2541 orientation.alpha = alpha; 2539 orientation.alpha = alpha;
2542 2540
2543 // beta 2541 // beta
2544 orientation.hasBeta = has_beta; 2542 orientation.hasBeta = has_beta;
2545 orientation.beta = beta; 2543 orientation.beta = beta;
2546 2544
2547 // gamma 2545 // gamma
2548 orientation.hasGamma = has_gamma; 2546 orientation.hasGamma = has_gamma;
2549 orientation.gamma = gamma; 2547 orientation.gamma = gamma;
2550 2548
2551 // absolute 2549 // absolute
2552 orientation.hasAbsolute = has_absolute;
2553 orientation.absolute = absolute; 2550 orientation.absolute = absolute;
2554 2551
2555 delegate_->SetDeviceOrientationData(orientation); 2552 delegate_->SetDeviceOrientationData(orientation);
2556 } 2553 }
2557 2554
2558 void TestRunner::SetMockScreenOrientation(const std::string& orientation_str) { 2555 void TestRunner::SetMockScreenOrientation(const std::string& orientation_str) {
2559 blink::WebScreenOrientationType orientation; 2556 blink::WebScreenOrientationType orientation;
2560 2557
2561 if (orientation_str == "portrait-primary") { 2558 if (orientation_str == "portrait-primary") {
2562 orientation = WebScreenOrientationPortraitPrimary; 2559 orientation = WebScreenOrientationPortraitPrimary;
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
3241 } 3238 }
3242 3239
3243 void TestRunner::DidLosePointerLockInternal() { 3240 void TestRunner::DidLosePointerLockInternal() {
3244 bool was_locked = pointer_locked_; 3241 bool was_locked = pointer_locked_;
3245 pointer_locked_ = false; 3242 pointer_locked_ = false;
3246 if (was_locked) 3243 if (was_locked)
3247 web_view_->didLosePointerLock(); 3244 web_view_->didLosePointerLock();
3248 } 3245 }
3249 3246
3250 } // namespace test_runner 3247 } // namespace test_runner
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698