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

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

Issue 2845763002: Remove DeviceLightEvent implementation (Closed)
Patch Set: same as previous patch Created 3 years, 7 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
« no previous file with comments | « content/shell/test_runner/test_runner.h ('k') | content/shell/test_runner/web_test_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test_runner/test_runner.h" 5 #include "content/shell/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 void QueueLoad(gin::Arguments* args); 177 void QueueLoad(gin::Arguments* args);
178 void QueueLoadingScript(const std::string& script); 178 void QueueLoadingScript(const std::string& script);
179 void QueueNonLoadingScript(const std::string& script); 179 void QueueNonLoadingScript(const std::string& script);
180 void QueueReload(); 180 void QueueReload();
181 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, 181 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin,
182 const std::string& destination_protocol, 182 const std::string& destination_protocol,
183 const std::string& destination_host, 183 const std::string& destination_host,
184 bool allow_destination_subdomains); 184 bool allow_destination_subdomains);
185 void RemoveSpellCheckResolvedCallback(); 185 void RemoveSpellCheckResolvedCallback();
186 void RemoveWebPageOverlay(); 186 void RemoveWebPageOverlay();
187 void ResetDeviceLight();
188 void ResetTestHelperControllers(); 187 void ResetTestHelperControllers();
189 void ResolveBeforeInstallPromptPromise(const std::string& platform); 188 void ResolveBeforeInstallPromptPromise(const std::string& platform);
190 void RunIdleTasks(v8::Local<v8::Function> callback); 189 void RunIdleTasks(v8::Local<v8::Function> callback);
191 void SendBluetoothManualChooserEvent(const std::string& event, 190 void SendBluetoothManualChooserEvent(const std::string& event,
192 const std::string& argument); 191 const std::string& argument);
193 void SetAcceptLanguages(const std::string& accept_languages); 192 void SetAcceptLanguages(const std::string& accept_languages);
194 void SetAllowFileAccessFromFileURLs(bool allow); 193 void SetAllowFileAccessFromFileURLs(bool allow);
195 void SetAllowRunningOfInsecureContent(bool allowed); 194 void SetAllowRunningOfInsecureContent(bool allowed);
196 void SetAutoplayAllowed(bool allowed); 195 void SetAutoplayAllowed(bool allowed);
197 void SetAllowUniversalAccessFromFileURLs(bool allow); 196 void SetAllowUniversalAccessFromFileURLs(bool allow);
(...skipping 18 matching lines...) Expand all
216 void SetDumpJavaScriptDialogs(bool value); 215 void SetDumpJavaScriptDialogs(bool value);
217 void SetEffectiveConnectionType(const std::string& connection_type); 216 void SetEffectiveConnectionType(const std::string& connection_type);
218 void SetMockSpellCheckerEnabled(bool enabled); 217 void SetMockSpellCheckerEnabled(bool enabled);
219 void SetImagesAllowed(bool allowed); 218 void SetImagesAllowed(bool allowed);
220 void SetIsolatedWorldContentSecurityPolicy(int world_id, 219 void SetIsolatedWorldContentSecurityPolicy(int world_id,
221 const std::string& policy); 220 const std::string& policy);
222 void SetIsolatedWorldSecurityOrigin(int world_id, 221 void SetIsolatedWorldSecurityOrigin(int world_id,
223 v8::Local<v8::Value> origin); 222 v8::Local<v8::Value> origin);
224 void SetJavaScriptCanAccessClipboard(bool can_access); 223 void SetJavaScriptCanAccessClipboard(bool can_access);
225 void SetMIDIAccessorResult(bool result); 224 void SetMIDIAccessorResult(bool result);
226 void SetMockDeviceLight(double value);
227 void SetMockDeviceMotion(gin::Arguments* args); 225 void SetMockDeviceMotion(gin::Arguments* args);
228 void SetMockDeviceOrientation(gin::Arguments* args); 226 void SetMockDeviceOrientation(gin::Arguments* args);
229 void SetMockScreenOrientation(const std::string& orientation); 227 void SetMockScreenOrientation(const std::string& orientation);
230 void SetMockSpeechRecognitionError(const std::string& error, 228 void SetMockSpeechRecognitionError(const std::string& error,
231 const std::string& message); 229 const std::string& message);
232 void SetPOSIXLocale(const std::string& locale); 230 void SetPOSIXLocale(const std::string& locale);
233 void SetPageVisibility(const std::string& new_visibility); 231 void SetPageVisibility(const std::string& new_visibility);
234 void SetPermission(const std::string& name, 232 void SetPermission(const std::string& name,
235 const std::string& value, 233 const std::string& value,
236 const std::string& origin, 234 const std::string& origin,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 .SetMethod("queueLoadingScript", &TestRunnerBindings::QueueLoadingScript) 497 .SetMethod("queueLoadingScript", &TestRunnerBindings::QueueLoadingScript)
500 .SetMethod("queueNonLoadingScript", 498 .SetMethod("queueNonLoadingScript",
501 &TestRunnerBindings::QueueNonLoadingScript) 499 &TestRunnerBindings::QueueNonLoadingScript)
502 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) 500 .SetMethod("queueReload", &TestRunnerBindings::QueueReload)
503 .SetMethod("removeOriginAccessWhitelistEntry", 501 .SetMethod("removeOriginAccessWhitelistEntry",
504 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) 502 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry)
505 .SetMethod("removeSpellCheckResolvedCallback", 503 .SetMethod("removeSpellCheckResolvedCallback",
506 &TestRunnerBindings::RemoveSpellCheckResolvedCallback) 504 &TestRunnerBindings::RemoveSpellCheckResolvedCallback)
507 .SetMethod("removeWebPageOverlay", 505 .SetMethod("removeWebPageOverlay",
508 &TestRunnerBindings::RemoveWebPageOverlay) 506 &TestRunnerBindings::RemoveWebPageOverlay)
509 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight)
510 .SetMethod("resetTestHelperControllers", 507 .SetMethod("resetTestHelperControllers",
511 &TestRunnerBindings::ResetTestHelperControllers) 508 &TestRunnerBindings::ResetTestHelperControllers)
512 .SetMethod("resolveBeforeInstallPromptPromise", 509 .SetMethod("resolveBeforeInstallPromptPromise",
513 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) 510 &TestRunnerBindings::ResolveBeforeInstallPromptPromise)
514 .SetMethod("runIdleTasks", &TestRunnerBindings::RunIdleTasks) 511 .SetMethod("runIdleTasks", &TestRunnerBindings::RunIdleTasks)
515 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) 512 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup)
516 513
517 // The Bluetooth functions are specified at 514 // The Bluetooth functions are specified at
518 // https://webbluetoothcg.github.io/web-bluetooth/tests/. 515 // https://webbluetoothcg.github.io/web-bluetooth/tests/.
519 .SetMethod("sendBluetoothManualChooserEvent", 516 .SetMethod("sendBluetoothManualChooserEvent",
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 .SetMethod("setIsolatedWorldContentSecurityPolicy", 559 .SetMethod("setIsolatedWorldContentSecurityPolicy",
563 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) 560 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy)
564 .SetMethod("setIsolatedWorldSecurityOrigin", 561 .SetMethod("setIsolatedWorldSecurityOrigin",
565 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) 562 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin)
566 .SetMethod("setJavaScriptCanAccessClipboard", 563 .SetMethod("setJavaScriptCanAccessClipboard",
567 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) 564 &TestRunnerBindings::SetJavaScriptCanAccessClipboard)
568 .SetMethod("setMIDIAccessorResult", 565 .SetMethod("setMIDIAccessorResult",
569 &TestRunnerBindings::SetMIDIAccessorResult) 566 &TestRunnerBindings::SetMIDIAccessorResult)
570 .SetMethod("setMainFrameIsFirstResponder", 567 .SetMethod("setMainFrameIsFirstResponder",
571 &TestRunnerBindings::NotImplemented) 568 &TestRunnerBindings::NotImplemented)
572 .SetMethod("setMockDeviceLight", &TestRunnerBindings::SetMockDeviceLight)
573 .SetMethod("setMockDeviceMotion", 569 .SetMethod("setMockDeviceMotion",
574 &TestRunnerBindings::SetMockDeviceMotion) 570 &TestRunnerBindings::SetMockDeviceMotion)
575 .SetMethod("setMockDeviceOrientation", 571 .SetMethod("setMockDeviceOrientation",
576 &TestRunnerBindings::SetMockDeviceOrientation) 572 &TestRunnerBindings::SetMockDeviceOrientation)
577 .SetMethod("setMockScreenOrientation", 573 .SetMethod("setMockScreenOrientation",
578 &TestRunnerBindings::SetMockScreenOrientation) 574 &TestRunnerBindings::SetMockScreenOrientation)
579 .SetMethod("setMockSpeechRecognitionError", 575 .SetMethod("setMockSpeechRecognitionError",
580 &TestRunnerBindings::SetMockSpeechRecognitionError) 576 &TestRunnerBindings::SetMockSpeechRecognitionError)
581 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) 577 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale)
582 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility) 578 .SetMethod("setPageVisibility", &TestRunnerBindings::SetPageVisibility)
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
912 } 908 }
913 return false; 909 return false;
914 } 910 }
915 911
916 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { 912 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) {
917 if (runner_) 913 if (runner_)
918 return runner_->DisableAutoResizeMode(new_width, new_height); 914 return runner_->DisableAutoResizeMode(new_width, new_height);
919 return false; 915 return false;
920 } 916 }
921 917
922 void TestRunnerBindings::SetMockDeviceLight(double value) {
923 if (!runner_)
924 return;
925 runner_->SetMockDeviceLight(value);
926 }
927
928 void TestRunnerBindings::ResetDeviceLight() {
929 if (runner_)
930 runner_->ResetDeviceLight();
931 }
932
933 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) { 918 void TestRunnerBindings::SetMockDeviceMotion(gin::Arguments* args) {
934 if (!runner_) 919 if (!runner_)
935 return; 920 return;
936 921
937 bool has_acceleration_x = false; 922 bool has_acceleration_x = false;
938 double acceleration_x = 0.0; 923 double acceleration_x = 0.0;
939 bool has_acceleration_y = false; 924 bool has_acceleration_y = false;
940 double acceleration_y = 0.0; 925 double acceleration_y = 0.0;
941 bool has_acceleration_z = false; 926 bool has_acceleration_z = false;
942 double acceleration_z = 0.0; 927 double acceleration_z = 0.0;
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
1692 delegate_->SetDatabaseQuota(5 * 1024 * 1024); 1677 delegate_->SetDatabaseQuota(5 * 1024 * 1024);
1693 delegate_->SetDeviceColorProfile("reset"); 1678 delegate_->SetDeviceColorProfile("reset");
1694 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); 1679 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor());
1695 delegate_->SetBlockThirdPartyCookies(true); 1680 delegate_->SetBlockThirdPartyCookies(true);
1696 delegate_->SetLocale(""); 1681 delegate_->SetLocale("");
1697 delegate_->UseUnfortunateSynchronousResizeMode(false); 1682 delegate_->UseUnfortunateSynchronousResizeMode(false);
1698 delegate_->DisableAutoResizeMode(WebSize()); 1683 delegate_->DisableAutoResizeMode(WebSize());
1699 delegate_->DeleteAllCookies(); 1684 delegate_->DeleteAllCookies();
1700 delegate_->SetBluetoothManualChooser(false); 1685 delegate_->SetBluetoothManualChooser(false);
1701 delegate_->ResetPermissions(); 1686 delegate_->ResetPermissions();
1702 ResetDeviceLight();
1703 } 1687 }
1704 1688
1705 dump_as_audio_ = false; 1689 dump_as_audio_ = false;
1706 dump_back_forward_list_ = false; 1690 dump_back_forward_list_ = false;
1707 test_repaint_ = false; 1691 test_repaint_ = false;
1708 sweep_horizontally_ = false; 1692 sweep_horizontally_ = false;
1709 midi_accessor_result_ = midi::mojom::Result::OK; 1693 midi_accessor_result_ = midi::mojom::Result::OK;
1710 1694
1711 http_headers_to_clear_.clear(); 1695 http_headers_to_clear_.clear();
1712 1696
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 delegate_->EnableAutoResizeMode(min_size, max_size); 2192 delegate_->EnableAutoResizeMode(min_size, max_size);
2209 return true; 2193 return true;
2210 } 2194 }
2211 2195
2212 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { 2196 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) {
2213 WebSize new_size(new_width, new_height); 2197 WebSize new_size(new_width, new_height);
2214 delegate_->DisableAutoResizeMode(new_size); 2198 delegate_->DisableAutoResizeMode(new_size);
2215 return true; 2199 return true;
2216 } 2200 }
2217 2201
2218 void TestRunner::SetMockDeviceLight(double value) {
2219 delegate_->SetDeviceLightData(value);
2220 }
2221
2222 void TestRunner::ResetDeviceLight() {
2223 delegate_->SetDeviceLightData(-1);
2224 }
2225
2226 void TestRunner::SetMockDeviceMotion(bool has_acceleration_x, 2202 void TestRunner::SetMockDeviceMotion(bool has_acceleration_x,
2227 double acceleration_x, 2203 double acceleration_x,
2228 bool has_acceleration_y, 2204 bool has_acceleration_y,
2229 double acceleration_y, 2205 double acceleration_y,
2230 bool has_acceleration_z, 2206 bool has_acceleration_z,
2231 double acceleration_z, 2207 double acceleration_z,
2232 bool has_acceleration_including_gravity_x, 2208 bool has_acceleration_including_gravity_x,
2233 double acceleration_including_gravity_x, 2209 double acceleration_including_gravity_x,
2234 bool has_acceleration_including_gravity_y, 2210 bool has_acceleration_including_gravity_y,
2235 double acceleration_including_gravity_y, 2211 double acceleration_including_gravity_y,
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 2815
2840 void TestRunner::NotifyDone() { 2816 void TestRunner::NotifyDone() {
2841 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && 2817 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() &&
2842 !will_navigate_ && work_queue_.is_empty()) 2818 !will_navigate_ && work_queue_.is_empty())
2843 delegate_->TestFinished(); 2819 delegate_->TestFinished();
2844 layout_test_runtime_flags_.set_wait_until_done(false); 2820 layout_test_runtime_flags_.set_wait_until_done(false);
2845 OnLayoutTestRuntimeFlagsChanged(); 2821 OnLayoutTestRuntimeFlagsChanged();
2846 } 2822 }
2847 2823
2848 } // namespace test_runner 2824 } // namespace test_runner
OLDNEW
« no previous file with comments | « content/shell/test_runner/test_runner.h ('k') | content/shell/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698