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

Side by Side Diff: content/shell/renderer/test_runner/test_runner.cc

Issue 336823002: [DeviceLight] Add Layout support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 6 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 "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/shell/common/test_runner/test_preferences.h" 10 #include "content/shell/common/test_runner/test_preferences.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 std::string SelectionAsMarkup(); 186 std::string SelectionAsMarkup();
187 void SetTextSubpixelPositioning(bool value); 187 void SetTextSubpixelPositioning(bool value);
188 void SetPageVisibility(const std::string& new_visibility); 188 void SetPageVisibility(const std::string& new_visibility);
189 void SetTextDirection(const std::string& direction_name); 189 void SetTextDirection(const std::string& direction_name);
190 void UseUnfortunateSynchronousResizeMode(); 190 void UseUnfortunateSynchronousResizeMode();
191 bool EnableAutoResizeMode(int min_width, 191 bool EnableAutoResizeMode(int min_width,
192 int min_height, 192 int min_height,
193 int max_width, 193 int max_width,
194 int max_height); 194 int max_height);
195 bool DisableAutoResizeMode(int new_width, int new_height); 195 bool DisableAutoResizeMode(int new_width, int new_height);
196 void SetMockDeviceLight(gin::Arguments* args);
196 void SetMockDeviceMotion(gin::Arguments* args); 197 void SetMockDeviceMotion(gin::Arguments* args);
197 void SetMockDeviceOrientation(gin::Arguments* args); 198 void SetMockDeviceOrientation(gin::Arguments* args);
198 void SetMockScreenOrientation(const std::string& orientation); 199 void SetMockScreenOrientation(const std::string& orientation);
199 void DidChangeBatteryStatus(bool charging, 200 void DidChangeBatteryStatus(bool charging,
200 double chargingTime, 201 double chargingTime,
201 double dischargingTime, 202 double dischargingTime,
202 double level); 203 double level);
203 void ResetBatteryStatus(); 204 void ResetBatteryStatus();
204 void DidAcquirePointerLock(); 205 void DidAcquirePointerLock();
205 void DidNotAcquirePointerLock(); 206 void DidNotAcquirePointerLock();
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 .SetMethod("setTextSubpixelPositioning", 389 .SetMethod("setTextSubpixelPositioning",
389 &TestRunnerBindings::SetTextSubpixelPositioning) 390 &TestRunnerBindings::SetTextSubpixelPositioning)
390 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility) 391 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility)
391 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection) 392 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection)
392 .SetMethod("useUnfortunateSynchronousResizeMode", 393 .SetMethod("useUnfortunateSynchronousResizeMode",
393 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) 394 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode)
394 .SetMethod("enableAutoResizeMode", 395 .SetMethod("enableAutoResizeMode",
395 &TestRunnerBindings::EnableAutoResizeMode) 396 &TestRunnerBindings::EnableAutoResizeMode)
396 .SetMethod("disableAutoResizeMode", 397 .SetMethod("disableAutoResizeMode",
397 &TestRunnerBindings::DisableAutoResizeMode) 398 &TestRunnerBindings::DisableAutoResizeMode)
399 .SetMethod("setMockDeviceLight", &TestRunnerBindings::SetMockDeviceLight)
398 .SetMethod("setMockDeviceMotion", 400 .SetMethod("setMockDeviceMotion",
399 &TestRunnerBindings::SetMockDeviceMotion) 401 &TestRunnerBindings::SetMockDeviceMotion)
400 .SetMethod("setMockDeviceOrientation", 402 .SetMethod("setMockDeviceOrientation",
401 &TestRunnerBindings::SetMockDeviceOrientation) 403 &TestRunnerBindings::SetMockDeviceOrientation)
402 .SetMethod("setMockScreenOrientation", 404 .SetMethod("setMockScreenOrientation",
403 &TestRunnerBindings::SetMockScreenOrientation) 405 &TestRunnerBindings::SetMockScreenOrientation)
404 .SetMethod("didChangeBatteryStatus", 406 .SetMethod("didChangeBatteryStatus",
405 &TestRunnerBindings::DidChangeBatteryStatus) 407 &TestRunnerBindings::DidChangeBatteryStatus)
406 .SetMethod("resetBatteryStatus", 408 .SetMethod("resetBatteryStatus", &TestRunnerBindings::ResetBatteryStatus)
jochen (gone - plz use gerrit) 2014/06/26 14:59:14 unrelated to your change?
riju_ 2014/06/28 00:20:07 Yes, unrelated, but i ran git cl format, and that
407 &TestRunnerBindings::ResetBatteryStatus)
408 .SetMethod("didAcquirePointerLock", 409 .SetMethod("didAcquirePointerLock",
409 &TestRunnerBindings::DidAcquirePointerLock) 410 &TestRunnerBindings::DidAcquirePointerLock)
410 .SetMethod("didNotAcquirePointerLock", 411 .SetMethod("didNotAcquirePointerLock",
411 &TestRunnerBindings::DidNotAcquirePointerLock) 412 &TestRunnerBindings::DidNotAcquirePointerLock)
412 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock) 413 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock)
413 .SetMethod("setPointerLockWillFailSynchronously", 414 .SetMethod("setPointerLockWillFailSynchronously",
414 &TestRunnerBindings::SetPointerLockWillFailSynchronously) 415 &TestRunnerBindings::SetPointerLockWillFailSynchronously)
415 .SetMethod("setPointerLockWillRespondAsynchronously", 416 .SetMethod("setPointerLockWillRespondAsynchronously",
416 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously) 417 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously)
417 .SetMethod("setPopupBlockingEnabled", 418 .SetMethod("setPopupBlockingEnabled",
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 &TestRunnerBindings::EvaluateInWebInspector) 496 &TestRunnerBindings::EvaluateInWebInspector)
496 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) 497 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases)
497 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) 498 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota)
498 .SetMethod("setAlwaysAcceptCookies", 499 .SetMethod("setAlwaysAcceptCookies",
499 &TestRunnerBindings::SetAlwaysAcceptCookies) 500 &TestRunnerBindings::SetAlwaysAcceptCookies)
500 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) 501 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey)
501 .SetMethod("pathToLocalResource", 502 .SetMethod("pathToLocalResource",
502 &TestRunnerBindings::PathToLocalResource) 503 &TestRunnerBindings::PathToLocalResource)
503 .SetMethod("setBackingScaleFactor", 504 .SetMethod("setBackingScaleFactor",
504 &TestRunnerBindings::SetBackingScaleFactor) 505 &TestRunnerBindings::SetBackingScaleFactor)
505 .SetMethod("setColorProfile", 506 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile)
506 &TestRunnerBindings::SetColorProfile)
507 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) 507 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale)
508 .SetMethod("setMIDIAccessorResult", 508 .SetMethod("setMIDIAccessorResult",
509 &TestRunnerBindings::SetMIDIAccessorResult) 509 &TestRunnerBindings::SetMIDIAccessorResult)
510 .SetMethod("setMIDISysexPermission", 510 .SetMethod("setMIDISysexPermission",
511 &TestRunnerBindings::SetMIDISysexPermission) 511 &TestRunnerBindings::SetMIDISysexPermission)
512 .SetMethod("grantWebNotificationPermission", 512 .SetMethod("grantWebNotificationPermission",
513 &TestRunnerBindings::GrantWebNotificationPermission) 513 &TestRunnerBindings::GrantWebNotificationPermission)
514 .SetMethod("simulateWebNotificationClick", 514 .SetMethod("simulateWebNotificationClick",
515 &TestRunnerBindings::SimulateWebNotificationClick) 515 &TestRunnerBindings::SimulateWebNotificationClick)
516 .SetMethod("addMockSpeechRecognitionResult", 516 .SetMethod("addMockSpeechRecognitionResult",
517 &TestRunnerBindings::AddMockSpeechRecognitionResult) 517 &TestRunnerBindings::AddMockSpeechRecognitionResult)
518 .SetMethod("setMockSpeechRecognitionError", 518 .SetMethod("setMockSpeechRecognitionError",
519 &TestRunnerBindings::SetMockSpeechRecognitionError) 519 &TestRunnerBindings::SetMockSpeechRecognitionError)
520 .SetMethod("wasMockSpeechRecognitionAborted", 520 .SetMethod("wasMockSpeechRecognitionAborted",
521 &TestRunnerBindings::WasMockSpeechRecognitionAborted) 521 &TestRunnerBindings::WasMockSpeechRecognitionAborted)
522 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) 522 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay)
523 .SetMethod("removeWebPageOverlay", 523 .SetMethod("removeWebPageOverlay",
524 &TestRunnerBindings::RemoveWebPageOverlay) 524 &TestRunnerBindings::RemoveWebPageOverlay)
525 .SetMethod("displayAsync", &TestRunnerBindings::DisplayAsync) 525 .SetMethod("displayAsync", &TestRunnerBindings::DisplayAsync)
526 .SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen) 526 .SetMethod("displayAsyncThen", &TestRunnerBindings::DisplayAsyncThen)
527 .SetMethod("capturePixelsAsyncThen", &TestRunnerBindings::CapturePixelsAsy ncThen) 527 .SetMethod("capturePixelsAsyncThen",
528 &TestRunnerBindings::CapturePixelsAsyncThen)
528 .SetMethod("setCustomTextOutput", 529 .SetMethod("setCustomTextOutput",
529 &TestRunnerBindings::SetCustomTextOutput) 530 &TestRunnerBindings::SetCustomTextOutput)
530 .SetMethod("setViewSourceForFrame", 531 .SetMethod("setViewSourceForFrame",
531 &TestRunnerBindings::SetViewSourceForFrame) 532 &TestRunnerBindings::SetViewSourceForFrame)
532 .SetMethod("setMockPushClientSuccess", 533 .SetMethod("setMockPushClientSuccess",
533 &TestRunnerBindings::setMockPushClientSuccess) 534 &TestRunnerBindings::setMockPushClientSuccess)
534 .SetMethod("setMockPushClientError", 535 .SetMethod("setMockPushClientError",
535 &TestRunnerBindings::setMockPushClientError) 536 &TestRunnerBindings::setMockPushClientError)
536 537
537 // Properties. 538 // Properties.
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 } 816 }
816 return false; 817 return false;
817 } 818 }
818 819
819 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { 820 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) {
820 if (runner_) 821 if (runner_)
821 return runner_->DisableAutoResizeMode(new_width, new_height); 822 return runner_->DisableAutoResizeMode(new_width, new_height);
822 return false; 823 return false;
823 } 824 }
824 825
826 void TestRunnerBindings::SetMockDeviceLight(gin::Arguments* args) {
jochen (gone - plz use gerrit) 2014/06/26 14:59:14 just use double as argument, then gin will do the
riju_ 2014/06/28 00:20:07 Done.
827 if (!runner_)
828 return;
829 double value;
830 args->GetNext(&value);
831 runner_->SetMockDeviceLight(value);
832 }
833
825 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) { 834 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) {
826 if (!runner_) 835 if (!runner_)
827 return; 836 return;
828 837
829 bool has_acceleration_x; 838 bool has_acceleration_x;
830 double acceleration_x; 839 double acceleration_x;
831 bool has_acceleration_y; 840 bool has_acceleration_y;
832 double acceleration_y; 841 double acceleration_y;
833 bool has_acceleration_z; 842 bool has_acceleration_z;
834 double acceleration_z; 843 double acceleration_z;
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 delegate_->enableAutoResizeMode(min_size, max_size); 2272 delegate_->enableAutoResizeMode(min_size, max_size);
2264 return true; 2273 return true;
2265 } 2274 }
2266 2275
2267 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { 2276 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) {
2268 WebSize new_size(new_width, new_height); 2277 WebSize new_size(new_width, new_height);
2269 delegate_->disableAutoResizeMode(new_size); 2278 delegate_->disableAutoResizeMode(new_size);
2270 return true; 2279 return true;
2271 } 2280 }
2272 2281
2282 void TestRunner::SetMockDeviceLight(double value) {
2283 delegate_->setDeviceLightData(value);
2284 }
2285
2273 void TestRunner::SetMockDeviceMotion( 2286 void TestRunner::SetMockDeviceMotion(
2274 bool has_acceleration_x, double acceleration_x, 2287 bool has_acceleration_x, double acceleration_x,
2275 bool has_acceleration_y, double acceleration_y, 2288 bool has_acceleration_y, double acceleration_y,
2276 bool has_acceleration_z, double acceleration_z, 2289 bool has_acceleration_z, double acceleration_z,
2277 bool has_acceleration_including_gravity_x, 2290 bool has_acceleration_including_gravity_x,
2278 double acceleration_including_gravity_x, 2291 double acceleration_including_gravity_x,
2279 bool has_acceleration_including_gravity_y, 2292 bool has_acceleration_including_gravity_y,
2280 double acceleration_including_gravity_y, 2293 double acceleration_including_gravity_y,
2281 bool has_acceleration_including_gravity_z, 2294 bool has_acceleration_including_gravity_z,
2282 double acceleration_including_gravity_z, 2295 double acceleration_including_gravity_z,
(...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
2865 } 2878 }
2866 2879
2867 void TestRunner::DidLosePointerLockInternal() { 2880 void TestRunner::DidLosePointerLockInternal() {
2868 bool was_locked = pointer_locked_; 2881 bool was_locked = pointer_locked_;
2869 pointer_locked_ = false; 2882 pointer_locked_ = false;
2870 if (was_locked) 2883 if (was_locked)
2871 web_view_->didLosePointerLock(); 2884 web_view_->didLosePointerLock();
2872 } 2885 }
2873 2886
2874 } // namespace content 2887 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.h ('k') | content/shell/renderer/webkit_test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698