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 "content/shell/common/test_runner/WebPreferences.h" | 9 #include "content/shell/common/test_runner/WebPreferences.h" |
10 #include "content/shell/renderer/test_runner/MockWebSpeechInputController.h" | 10 #include "content/shell/renderer/test_runner/MockWebSpeechInputController.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 std::string SelectionAsMarkup(); | 165 std::string SelectionAsMarkup(); |
166 void SetTextSubpixelPositioning(bool value); | 166 void SetTextSubpixelPositioning(bool value); |
167 void SetPageVisibility(const std::string& new_visibility); | 167 void SetPageVisibility(const std::string& new_visibility); |
168 void SetTextDirection(const std::string& direction_name); | 168 void SetTextDirection(const std::string& direction_name); |
169 void UseUnfortunateSynchronousResizeMode(); | 169 void UseUnfortunateSynchronousResizeMode(); |
170 bool EnableAutoResizeMode(int min_width, | 170 bool EnableAutoResizeMode(int min_width, |
171 int min_height, | 171 int min_height, |
172 int max_width, | 172 int max_width, |
173 int max_height); | 173 int max_height); |
174 bool DisableAutoResizeMode(int new_width, int new_height); | 174 bool DisableAutoResizeMode(int new_width, int new_height); |
| 175 void SetMockDeviceLight(gin::Arguments* args); |
175 void SetMockDeviceMotion(gin::Arguments* args); | 176 void SetMockDeviceMotion(gin::Arguments* args); |
176 void SetMockDeviceOrientation(gin::Arguments* args); | 177 void SetMockDeviceOrientation(gin::Arguments* args); |
177 void SetMockScreenOrientation(const std::string& orientation); | 178 void SetMockScreenOrientation(const std::string& orientation); |
178 void DidAcquirePointerLock(); | 179 void DidAcquirePointerLock(); |
179 void DidNotAcquirePointerLock(); | 180 void DidNotAcquirePointerLock(); |
180 void DidLosePointerLock(); | 181 void DidLosePointerLock(); |
181 void SetPointerLockWillFailSynchronously(); | 182 void SetPointerLockWillFailSynchronously(); |
182 void SetPointerLockWillRespondAsynchronously(); | 183 void SetPointerLockWillRespondAsynchronously(); |
183 void SetPopupBlockingEnabled(bool block_popups); | 184 void SetPopupBlockingEnabled(bool block_popups); |
184 void SetJavaScriptCanAccessClipboard(bool can_access); | 185 void SetJavaScriptCanAccessClipboard(bool can_access); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 .SetMethod("setTextSubpixelPositioning", | 353 .SetMethod("setTextSubpixelPositioning", |
353 &TestRunnerBindings::SetTextSubpixelPositioning) | 354 &TestRunnerBindings::SetTextSubpixelPositioning) |
354 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility) | 355 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility) |
355 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection) | 356 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection) |
356 .SetMethod("useUnfortunateSynchronousResizeMode", | 357 .SetMethod("useUnfortunateSynchronousResizeMode", |
357 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) | 358 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) |
358 .SetMethod("enableAutoResizeMode", | 359 .SetMethod("enableAutoResizeMode", |
359 &TestRunnerBindings::EnableAutoResizeMode) | 360 &TestRunnerBindings::EnableAutoResizeMode) |
360 .SetMethod("disableAutoResizeMode", | 361 .SetMethod("disableAutoResizeMode", |
361 &TestRunnerBindings::DisableAutoResizeMode) | 362 &TestRunnerBindings::DisableAutoResizeMode) |
| 363 .SetMethod("setMockDeviceLight", |
| 364 &TestRunnerBindings::SetMockDeviceLight) |
362 .SetMethod("setMockDeviceMotion", | 365 .SetMethod("setMockDeviceMotion", |
363 &TestRunnerBindings::SetMockDeviceMotion) | 366 &TestRunnerBindings::SetMockDeviceMotion) |
364 .SetMethod("setMockDeviceOrientation", | 367 .SetMethod("setMockDeviceOrientation", |
365 &TestRunnerBindings::SetMockDeviceOrientation) | 368 &TestRunnerBindings::SetMockDeviceOrientation) |
366 .SetMethod("setMockScreenOrientation", | 369 .SetMethod("setMockScreenOrientation", |
367 &TestRunnerBindings::SetMockScreenOrientation) | 370 &TestRunnerBindings::SetMockScreenOrientation) |
368 .SetMethod("didAcquirePointerLock", | 371 .SetMethod("didAcquirePointerLock", |
369 &TestRunnerBindings::DidAcquirePointerLock) | 372 &TestRunnerBindings::DidAcquirePointerLock) |
370 .SetMethod("didNotAcquirePointerLock", | 373 .SetMethod("didNotAcquirePointerLock", |
371 &TestRunnerBindings::DidNotAcquirePointerLock) | 374 &TestRunnerBindings::DidNotAcquirePointerLock) |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 } | 763 } |
761 return false; | 764 return false; |
762 } | 765 } |
763 | 766 |
764 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { | 767 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { |
765 if (runner_) | 768 if (runner_) |
766 return runner_->DisableAutoResizeMode(new_width, new_height); | 769 return runner_->DisableAutoResizeMode(new_width, new_height); |
767 return false; | 770 return false; |
768 } | 771 } |
769 | 772 |
| 773 void TestRunnerBindings::SetMockDeviceLight(gin::Arguments* args) { |
| 774 if (!runner_) |
| 775 return; |
| 776 double value; |
| 777 args->GetData(&value); |
| 778 runner_->SetMockDeviceLight(value); |
| 779 } |
| 780 |
770 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) { | 781 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) { |
771 if (!runner_) | 782 if (!runner_) |
772 return; | 783 return; |
773 | 784 |
774 bool has_acceleration_x; | 785 bool has_acceleration_x; |
775 double acceleration_x; | 786 double acceleration_x; |
776 bool has_acceleration_y; | 787 bool has_acceleration_y; |
777 double acceleration_y; | 788 double acceleration_y; |
778 bool has_acceleration_z; | 789 bool has_acceleration_z; |
779 double acceleration_z; | 790 double acceleration_z; |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 delegate_->enableAutoResizeMode(min_size, max_size); | 2127 delegate_->enableAutoResizeMode(min_size, max_size); |
2117 return true; | 2128 return true; |
2118 } | 2129 } |
2119 | 2130 |
2120 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { | 2131 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { |
2121 WebSize new_size(new_width, new_height); | 2132 WebSize new_size(new_width, new_height); |
2122 delegate_->disableAutoResizeMode(new_size); | 2133 delegate_->disableAutoResizeMode(new_size); |
2123 return true; | 2134 return true; |
2124 } | 2135 } |
2125 | 2136 |
| 2137 void TestRunner::SetMockDeviceLight( |
| 2138 double value) { |
| 2139 delegate_->setDeviceLightData(value); |
| 2140 } |
| 2141 |
2126 void TestRunner::SetMockDeviceMotion( | 2142 void TestRunner::SetMockDeviceMotion( |
2127 bool has_acceleration_x, double acceleration_x, | 2143 bool has_acceleration_x, double acceleration_x, |
2128 bool has_acceleration_y, double acceleration_y, | 2144 bool has_acceleration_y, double acceleration_y, |
2129 bool has_acceleration_z, double acceleration_z, | 2145 bool has_acceleration_z, double acceleration_z, |
2130 bool has_acceleration_including_gravity_x, | 2146 bool has_acceleration_including_gravity_x, |
2131 double acceleration_including_gravity_x, | 2147 double acceleration_including_gravity_x, |
2132 bool has_acceleration_including_gravity_y, | 2148 bool has_acceleration_including_gravity_y, |
2133 double acceleration_including_gravity_y, | 2149 double acceleration_including_gravity_y, |
2134 bool has_acceleration_including_gravity_z, | 2150 bool has_acceleration_including_gravity_z, |
2135 double acceleration_including_gravity_z, | 2151 double acceleration_including_gravity_z, |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 } | 2644 } |
2629 | 2645 |
2630 void TestRunner::DidLosePointerLockInternal() { | 2646 void TestRunner::DidLosePointerLockInternal() { |
2631 bool was_locked = pointer_locked_; | 2647 bool was_locked = pointer_locked_; |
2632 pointer_locked_ = false; | 2648 pointer_locked_ = false; |
2633 if (was_locked) | 2649 if (was_locked) |
2634 web_view_->didLosePointerLock(); | 2650 web_view_->didLosePointerLock(); |
2635 } | 2651 } |
2636 | 2652 |
2637 } // namespace content | 2653 } // namespace content |
OLD | NEW |