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 "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 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/strings/nullable_string16.h" | 14 #include "base/strings/nullable_string16.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "components/test_runner/layout_and_paint_async_then.h" | 19 #include "content/shell/test_runner/layout_and_paint_async_then.h" |
20 #include "components/test_runner/layout_dump.h" | 20 #include "content/shell/test_runner/layout_dump.h" |
21 #include "components/test_runner/mock_content_settings_client.h" | 21 #include "content/shell/test_runner/mock_content_settings_client.h" |
22 #include "components/test_runner/mock_credential_manager_client.h" | 22 #include "content/shell/test_runner/mock_credential_manager_client.h" |
23 #include "components/test_runner/mock_screen_orientation_client.h" | 23 #include "content/shell/test_runner/mock_screen_orientation_client.h" |
24 #include "components/test_runner/mock_web_document_subresource_filter.h" | 24 #include "content/shell/test_runner/mock_web_document_subresource_filter.h" |
25 #include "components/test_runner/mock_web_speech_recognizer.h" | 25 #include "content/shell/test_runner/mock_web_speech_recognizer.h" |
26 #include "components/test_runner/mock_web_user_media_client.h" | 26 #include "content/shell/test_runner/mock_web_user_media_client.h" |
27 #include "components/test_runner/pixel_dump.h" | 27 #include "content/shell/test_runner/pixel_dump.h" |
28 #include "components/test_runner/spell_check_client.h" | 28 #include "content/shell/test_runner/spell_check_client.h" |
29 #include "components/test_runner/test_common.h" | 29 #include "content/shell/test_runner/test_common.h" |
30 #include "components/test_runner/test_interfaces.h" | 30 #include "content/shell/test_runner/test_interfaces.h" |
31 #include "components/test_runner/test_preferences.h" | 31 #include "content/shell/test_runner/test_preferences.h" |
32 #include "components/test_runner/test_runner_for_specific_view.h" | 32 #include "content/shell/test_runner/test_runner_for_specific_view.h" |
33 #include "components/test_runner/web_test_delegate.h" | 33 #include "content/shell/test_runner/web_test_delegate.h" |
34 #include "components/test_runner/web_view_test_proxy.h" | 34 #include "content/shell/test_runner/web_view_test_proxy.h" |
35 #include "gin/arguments.h" | 35 #include "gin/arguments.h" |
36 #include "gin/array_buffer.h" | 36 #include "gin/array_buffer.h" |
37 #include "gin/handle.h" | 37 #include "gin/handle.h" |
38 #include "gin/object_template_builder.h" | 38 #include "gin/object_template_builder.h" |
39 #include "gin/wrappable.h" | 39 #include "gin/wrappable.h" |
40 #include "third_party/WebKit/public/platform/WebCanvas.h" | 40 #include "third_party/WebKit/public/platform/WebCanvas.h" |
41 #include "third_party/WebKit/public/platform/WebData.h" | 41 #include "third_party/WebKit/public/platform/WebData.h" |
42 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" | 42 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" |
43 #include "third_party/WebKit/public/platform/WebPoint.h" | 43 #include "third_party/WebKit/public/platform/WebPoint.h" |
44 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 44 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 const std::string& password); | 269 const std::string& password); |
270 void ClearMockCredentialManagerResponse(); | 270 void ClearMockCredentialManagerResponse(); |
271 bool CallShouldCloseOnWebView(); | 271 bool CallShouldCloseOnWebView(); |
272 bool DisableAutoResizeMode(int new_width, int new_height); | 272 bool DisableAutoResizeMode(int new_width, int new_height); |
273 bool EnableAutoResizeMode(int min_width, | 273 bool EnableAutoResizeMode(int min_width, |
274 int min_height, | 274 int min_height, |
275 int max_width, | 275 int max_width, |
276 int max_height); | 276 int max_height); |
277 std::string EvaluateInWebInspectorOverlay(const std::string& script); | 277 std::string EvaluateInWebInspectorOverlay(const std::string& script); |
278 v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( | 278 v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( |
279 int world_id, const std::string& script); | 279 int world_id, |
| 280 const std::string& script); |
280 bool FindString(const std::string& search_text, | 281 bool FindString(const std::string& search_text, |
281 const std::vector<std::string>& options_array); | 282 const std::vector<std::string>& options_array); |
282 bool HasCustomPageSizeStyle(int page_index); | 283 bool HasCustomPageSizeStyle(int page_index); |
283 bool IsChooserShown(); | 284 bool IsChooserShown(); |
284 | 285 |
285 bool IsCommandEnabled(const std::string& command); | 286 bool IsCommandEnabled(const std::string& command); |
286 std::string PathToLocalResource(const std::string& path); | 287 std::string PathToLocalResource(const std::string& path); |
287 std::string PlatformName(); | 288 std::string PlatformName(); |
288 std::string SelectionAsMarkup(); | 289 std::string SelectionAsMarkup(); |
289 std::string TooltipText(); | 290 std::string TooltipText(); |
290 | 291 |
291 int WebHistoryItemCount(); | 292 int WebHistoryItemCount(); |
292 int WindowCount(); | 293 int WindowCount(); |
293 | 294 |
294 base::WeakPtr<TestRunner> runner_; | 295 base::WeakPtr<TestRunner> runner_; |
295 base::WeakPtr<TestRunnerForSpecificView> view_runner_; | 296 base::WeakPtr<TestRunnerForSpecificView> view_runner_; |
296 | 297 |
297 DISALLOW_COPY_AND_ASSIGN(TestRunnerBindings); | 298 DISALLOW_COPY_AND_ASSIGN(TestRunnerBindings); |
298 }; | 299 }; |
299 | 300 |
300 gin::WrapperInfo TestRunnerBindings::kWrapperInfo = { | 301 gin::WrapperInfo TestRunnerBindings::kWrapperInfo = {gin::kEmbedderNativeGin}; |
301 gin::kEmbedderNativeGin}; | |
302 | 302 |
303 // static | 303 // static |
304 void TestRunnerBindings::Install( | 304 void TestRunnerBindings::Install( |
305 base::WeakPtr<TestRunner> test_runner, | 305 base::WeakPtr<TestRunner> test_runner, |
306 base::WeakPtr<TestRunnerForSpecificView> view_test_runner, | 306 base::WeakPtr<TestRunnerForSpecificView> view_test_runner, |
307 WebLocalFrame* frame) { | 307 WebLocalFrame* frame) { |
308 v8::Isolate* isolate = blink::mainThreadIsolate(); | 308 v8::Isolate* isolate = blink::mainThreadIsolate(); |
309 v8::HandleScope handle_scope(isolate); | 309 v8::HandleScope handle_scope(isolate); |
310 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); | 310 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
311 if (context.IsEmpty()) | 311 if (context.IsEmpty()) |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 return false; | 704 return false; |
705 } | 705 } |
706 | 706 |
707 bool TestRunnerBindings::CallShouldCloseOnWebView() { | 707 bool TestRunnerBindings::CallShouldCloseOnWebView() { |
708 if (view_runner_) | 708 if (view_runner_) |
709 return view_runner_->CallShouldCloseOnWebView(); | 709 return view_runner_->CallShouldCloseOnWebView(); |
710 return false; | 710 return false; |
711 } | 711 } |
712 | 712 |
713 void TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme( | 713 void TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme( |
714 bool forbidden, const std::string& scheme) { | 714 bool forbidden, |
| 715 const std::string& scheme) { |
715 if (view_runner_) | 716 if (view_runner_) |
716 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); | 717 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); |
717 } | 718 } |
718 | 719 |
719 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) { | 720 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) { |
720 if (runner_) | 721 if (runner_) |
721 runner_->SetDumpConsoleMessages(enabled); | 722 runner_->SetDumpConsoleMessages(enabled); |
722 } | 723 } |
723 | 724 |
724 void TestRunnerBindings::SetDumpJavaScriptDialogs(bool enabled) { | 725 void TestRunnerBindings::SetDumpJavaScriptDialogs(bool enabled) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
760 runner_->spellcheck_->SetSpellCheckResolvedCallback(callback); | 761 runner_->spellcheck_->SetSpellCheckResolvedCallback(callback); |
761 } | 762 } |
762 | 763 |
763 void TestRunnerBindings::RemoveSpellCheckResolvedCallback() { | 764 void TestRunnerBindings::RemoveSpellCheckResolvedCallback() { |
764 if (runner_) | 765 if (runner_) |
765 runner_->spellcheck_->RemoveSpellCheckResolvedCallback(); | 766 runner_->spellcheck_->RemoveSpellCheckResolvedCallback(); |
766 } | 767 } |
767 | 768 |
768 v8::Local<v8::Value> | 769 v8::Local<v8::Value> |
769 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( | 770 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( |
770 int world_id, const std::string& script) { | 771 int world_id, |
| 772 const std::string& script) { |
771 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) | 773 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) |
772 return v8::Local<v8::Value>(); | 774 return v8::Local<v8::Value>(); |
773 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, | 775 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, |
774 script); | 776 script); |
775 } | 777 } |
776 | 778 |
777 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( | 779 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( |
778 int world_id, const std::string& script) { | 780 int world_id, |
| 781 const std::string& script) { |
779 if (view_runner_ && world_id > 0 && world_id < (1 << 29)) | 782 if (view_runner_ && world_id > 0 && world_id < (1 << 29)) |
780 view_runner_->EvaluateScriptInIsolatedWorld(world_id, script); | 783 view_runner_->EvaluateScriptInIsolatedWorld(world_id, script); |
781 } | 784 } |
782 | 785 |
783 void TestRunnerBindings::SetIsolatedWorldSecurityOrigin( | 786 void TestRunnerBindings::SetIsolatedWorldSecurityOrigin( |
784 int world_id, v8::Local<v8::Value> origin) { | 787 int world_id, |
| 788 v8::Local<v8::Value> origin) { |
785 if (view_runner_) | 789 if (view_runner_) |
786 view_runner_->SetIsolatedWorldSecurityOrigin(world_id, origin); | 790 view_runner_->SetIsolatedWorldSecurityOrigin(world_id, origin); |
787 } | 791 } |
788 | 792 |
789 void TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy( | 793 void TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy( |
790 int world_id, const std::string& policy) { | 794 int world_id, |
| 795 const std::string& policy) { |
791 if (view_runner_) | 796 if (view_runner_) |
792 view_runner_->SetIsolatedWorldContentSecurityPolicy(world_id, policy); | 797 view_runner_->SetIsolatedWorldContentSecurityPolicy(world_id, policy); |
793 } | 798 } |
794 | 799 |
795 void TestRunnerBindings::AddOriginAccessWhitelistEntry( | 800 void TestRunnerBindings::AddOriginAccessWhitelistEntry( |
796 const std::string& source_origin, | 801 const std::string& source_origin, |
797 const std::string& destination_protocol, | 802 const std::string& destination_protocol, |
798 const std::string& destination_host, | 803 const std::string& destination_host, |
799 bool allow_destination_subdomains) { | 804 bool allow_destination_subdomains) { |
800 if (runner_) { | 805 if (runner_) { |
801 runner_->AddOriginAccessWhitelistEntry(source_origin, | 806 runner_->AddOriginAccessWhitelistEntry(source_origin, destination_protocol, |
802 destination_protocol, | |
803 destination_host, | 807 destination_host, |
804 allow_destination_subdomains); | 808 allow_destination_subdomains); |
805 } | 809 } |
806 } | 810 } |
807 | 811 |
808 void TestRunnerBindings::RemoveOriginAccessWhitelistEntry( | 812 void TestRunnerBindings::RemoveOriginAccessWhitelistEntry( |
809 const std::string& source_origin, | 813 const std::string& source_origin, |
810 const std::string& destination_protocol, | 814 const std::string& destination_protocol, |
811 const std::string& destination_host, | 815 const std::string& destination_host, |
812 bool allow_destination_subdomains) { | 816 bool allow_destination_subdomains) { |
813 if (runner_) { | 817 if (runner_) { |
814 runner_->RemoveOriginAccessWhitelistEntry(source_origin, | 818 runner_->RemoveOriginAccessWhitelistEntry( |
815 destination_protocol, | 819 source_origin, destination_protocol, destination_host, |
816 destination_host, | 820 allow_destination_subdomains); |
817 allow_destination_subdomains); | |
818 } | 821 } |
819 } | 822 } |
820 | 823 |
821 bool TestRunnerBindings::HasCustomPageSizeStyle(int page_index) { | 824 bool TestRunnerBindings::HasCustomPageSizeStyle(int page_index) { |
822 if (view_runner_) | 825 if (view_runner_) |
823 return view_runner_->HasCustomPageSizeStyle(page_index); | 826 return view_runner_->HasCustomPageSizeStyle(page_index); |
824 return false; | 827 return false; |
825 } | 828 } |
826 | 829 |
827 void TestRunnerBindings::ForceRedSelectionColors() { | 830 void TestRunnerBindings::ForceRedSelectionColors() { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 void TestRunnerBindings::UseUnfortunateSynchronousResizeMode() { | 869 void TestRunnerBindings::UseUnfortunateSynchronousResizeMode() { |
867 if (runner_) | 870 if (runner_) |
868 runner_->UseUnfortunateSynchronousResizeMode(); | 871 runner_->UseUnfortunateSynchronousResizeMode(); |
869 } | 872 } |
870 | 873 |
871 bool TestRunnerBindings::EnableAutoResizeMode(int min_width, | 874 bool TestRunnerBindings::EnableAutoResizeMode(int min_width, |
872 int min_height, | 875 int min_height, |
873 int max_width, | 876 int max_width, |
874 int max_height) { | 877 int max_height) { |
875 if (runner_) { | 878 if (runner_) { |
876 return runner_->EnableAutoResizeMode(min_width, min_height, | 879 return runner_->EnableAutoResizeMode(min_width, min_height, max_width, |
877 max_width, max_height); | 880 max_height); |
878 } | 881 } |
879 return false; | 882 return false; |
880 } | 883 } |
881 | 884 |
882 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { | 885 bool TestRunnerBindings::DisableAutoResizeMode(int new_width, int new_height) { |
883 if (runner_) | 886 if (runner_) |
884 return runner_->DisableAutoResizeMode(new_width, new_height); | 887 return runner_->DisableAutoResizeMode(new_width, new_height); |
885 return false; | 888 return false; |
886 } | 889 } |
887 | 890 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 args->GetNext(&has_acceleration_including_gravity_z); | 936 args->GetNext(&has_acceleration_including_gravity_z); |
934 args->GetNext(&acceleration_including_gravity_z); | 937 args->GetNext(&acceleration_including_gravity_z); |
935 args->GetNext(&has_rotation_rate_alpha); | 938 args->GetNext(&has_rotation_rate_alpha); |
936 args->GetNext(&rotation_rate_alpha); | 939 args->GetNext(&rotation_rate_alpha); |
937 args->GetNext(&has_rotation_rate_beta); | 940 args->GetNext(&has_rotation_rate_beta); |
938 args->GetNext(&rotation_rate_beta); | 941 args->GetNext(&rotation_rate_beta); |
939 args->GetNext(&has_rotation_rate_gamma); | 942 args->GetNext(&has_rotation_rate_gamma); |
940 args->GetNext(&rotation_rate_gamma); | 943 args->GetNext(&rotation_rate_gamma); |
941 args->GetNext(&interval); | 944 args->GetNext(&interval); |
942 | 945 |
943 runner_->SetMockDeviceMotion(has_acceleration_x, acceleration_x, | 946 runner_->SetMockDeviceMotion( |
944 has_acceleration_y, acceleration_y, | 947 has_acceleration_x, acceleration_x, has_acceleration_y, acceleration_y, |
945 has_acceleration_z, acceleration_z, | 948 has_acceleration_z, acceleration_z, has_acceleration_including_gravity_x, |
946 has_acceleration_including_gravity_x, | 949 acceleration_including_gravity_x, has_acceleration_including_gravity_y, |
947 acceleration_including_gravity_x, | 950 acceleration_including_gravity_y, has_acceleration_including_gravity_z, |
948 has_acceleration_including_gravity_y, | 951 acceleration_including_gravity_z, has_rotation_rate_alpha, |
949 acceleration_including_gravity_y, | 952 rotation_rate_alpha, has_rotation_rate_beta, rotation_rate_beta, |
950 has_acceleration_including_gravity_z, | 953 has_rotation_rate_gamma, rotation_rate_gamma, interval); |
951 acceleration_including_gravity_z, | |
952 has_rotation_rate_alpha, | |
953 rotation_rate_alpha, | |
954 has_rotation_rate_beta, | |
955 rotation_rate_beta, | |
956 has_rotation_rate_gamma, | |
957 rotation_rate_gamma, | |
958 interval); | |
959 } | 954 } |
960 | 955 |
961 void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) { | 956 void TestRunnerBindings::SetMockDeviceOrientation(gin::Arguments* args) { |
962 if (!runner_) | 957 if (!runner_) |
963 return; | 958 return; |
964 | 959 |
965 bool has_alpha = false; | 960 bool has_alpha = false; |
966 double alpha = 0.0; | 961 double alpha = 0.0; |
967 bool has_beta = false; | 962 bool has_beta = false; |
968 double beta = 0.0; | 963 double beta = 0.0; |
969 bool has_gamma = false; | 964 bool has_gamma = false; |
970 double gamma = 0.0; | 965 double gamma = 0.0; |
971 bool absolute = false; | 966 bool absolute = false; |
972 | 967 |
973 args->GetNext(&has_alpha); | 968 args->GetNext(&has_alpha); |
974 args->GetNext(&alpha); | 969 args->GetNext(&alpha); |
975 args->GetNext(&has_beta); | 970 args->GetNext(&has_beta); |
976 args->GetNext(&beta); | 971 args->GetNext(&beta); |
977 args->GetNext(&has_gamma); | 972 args->GetNext(&has_gamma); |
978 args->GetNext(&gamma); | 973 args->GetNext(&gamma); |
979 args->GetNext(&absolute); | 974 args->GetNext(&absolute); |
980 | 975 |
981 runner_->SetMockDeviceOrientation(has_alpha, alpha, | 976 runner_->SetMockDeviceOrientation(has_alpha, alpha, has_beta, beta, has_gamma, |
982 has_beta, beta, | 977 gamma, absolute); |
983 has_gamma, gamma, | |
984 absolute); | |
985 } | 978 } |
986 | 979 |
987 void TestRunnerBindings::SetMockScreenOrientation( | 980 void TestRunnerBindings::SetMockScreenOrientation( |
988 const std::string& orientation) { | 981 const std::string& orientation) { |
989 if (!runner_) | 982 if (!runner_) |
990 return; | 983 return; |
991 | 984 |
992 runner_->SetMockScreenOrientation(orientation); | 985 runner_->SetMockScreenOrientation(orientation); |
993 } | 986 } |
994 | 987 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 view_runner_->SetWindowIsKey(value); | 1307 view_runner_->SetWindowIsKey(value); |
1315 } | 1308 } |
1316 | 1309 |
1317 std::string TestRunnerBindings::PathToLocalResource(const std::string& path) { | 1310 std::string TestRunnerBindings::PathToLocalResource(const std::string& path) { |
1318 if (runner_) | 1311 if (runner_) |
1319 return runner_->PathToLocalResource(path); | 1312 return runner_->PathToLocalResource(path); |
1320 return std::string(); | 1313 return std::string(); |
1321 } | 1314 } |
1322 | 1315 |
1323 void TestRunnerBindings::SetBackingScaleFactor( | 1316 void TestRunnerBindings::SetBackingScaleFactor( |
1324 double value, v8::Local<v8::Function> callback) { | 1317 double value, |
| 1318 v8::Local<v8::Function> callback) { |
1325 if (view_runner_) | 1319 if (view_runner_) |
1326 view_runner_->SetBackingScaleFactor(value, callback); | 1320 view_runner_->SetBackingScaleFactor(value, callback); |
1327 } | 1321 } |
1328 | 1322 |
1329 void TestRunnerBindings::EnableUseZoomForDSF( | 1323 void TestRunnerBindings::EnableUseZoomForDSF(v8::Local<v8::Function> callback) { |
1330 v8::Local<v8::Function> callback) { | |
1331 if (view_runner_) | 1324 if (view_runner_) |
1332 view_runner_->EnableUseZoomForDSF(callback); | 1325 view_runner_->EnableUseZoomForDSF(callback); |
1333 } | 1326 } |
1334 | 1327 |
1335 void TestRunnerBindings::SetColorProfile( | 1328 void TestRunnerBindings::SetColorProfile(const std::string& name, |
1336 const std::string& name, v8::Local<v8::Function> callback) { | 1329 v8::Local<v8::Function> callback) { |
1337 if (view_runner_) | 1330 if (view_runner_) |
1338 view_runner_->SetColorProfile(name, callback); | 1331 view_runner_->SetColorProfile(name, callback); |
1339 } | 1332 } |
1340 | 1333 |
1341 void TestRunnerBindings::SetBluetoothFakeAdapter( | 1334 void TestRunnerBindings::SetBluetoothFakeAdapter( |
1342 const std::string& adapter_name, | 1335 const std::string& adapter_name, |
1343 v8::Local<v8::Function> callback) { | 1336 v8::Local<v8::Function> callback) { |
1344 if (view_runner_) | 1337 if (view_runner_) |
1345 view_runner_->SetBluetoothFakeAdapter(adapter_name, callback); | 1338 view_runner_->SetBluetoothFakeAdapter(adapter_name, callback); |
1346 } | 1339 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1396 } | 1389 } |
1397 | 1390 |
1398 void TestRunnerBindings::SimulateWebNotificationClose(const std::string& title, | 1391 void TestRunnerBindings::SimulateWebNotificationClose(const std::string& title, |
1399 bool by_user) { | 1392 bool by_user) { |
1400 if (!runner_) | 1393 if (!runner_) |
1401 return; | 1394 return; |
1402 runner_->SimulateWebNotificationClose(title, by_user); | 1395 runner_->SimulateWebNotificationClose(title, by_user); |
1403 } | 1396 } |
1404 | 1397 |
1405 void TestRunnerBindings::AddMockSpeechRecognitionResult( | 1398 void TestRunnerBindings::AddMockSpeechRecognitionResult( |
1406 const std::string& transcript, double confidence) { | 1399 const std::string& transcript, |
| 1400 double confidence) { |
1407 if (runner_) | 1401 if (runner_) |
1408 runner_->AddMockSpeechRecognitionResult(transcript, confidence); | 1402 runner_->AddMockSpeechRecognitionResult(transcript, confidence); |
1409 } | 1403 } |
1410 | 1404 |
1411 void TestRunnerBindings::SetMockSpeechRecognitionError( | 1405 void TestRunnerBindings::SetMockSpeechRecognitionError( |
1412 const std::string& error, const std::string& message) { | 1406 const std::string& error, |
| 1407 const std::string& message) { |
1413 if (runner_) | 1408 if (runner_) |
1414 runner_->SetMockSpeechRecognitionError(error, message); | 1409 runner_->SetMockSpeechRecognitionError(error, message); |
1415 } | 1410 } |
1416 | 1411 |
1417 void TestRunnerBindings::SetMockCredentialManagerResponse( | 1412 void TestRunnerBindings::SetMockCredentialManagerResponse( |
1418 const std::string& id, | 1413 const std::string& id, |
1419 const std::string& name, | 1414 const std::string& name, |
1420 const std::string& avatar, | 1415 const std::string& avatar, |
1421 const std::string& password) { | 1416 const std::string& password) { |
1422 if (runner_) | 1417 if (runner_) |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1460 view_runner_->GetManifestThen(callback); | 1455 view_runner_->GetManifestThen(callback); |
1461 } | 1456 } |
1462 | 1457 |
1463 void TestRunnerBindings::CapturePixelsAsyncThen( | 1458 void TestRunnerBindings::CapturePixelsAsyncThen( |
1464 v8::Local<v8::Function> callback) { | 1459 v8::Local<v8::Function> callback) { |
1465 if (view_runner_) | 1460 if (view_runner_) |
1466 view_runner_->CapturePixelsAsyncThen(callback); | 1461 view_runner_->CapturePixelsAsyncThen(callback); |
1467 } | 1462 } |
1468 | 1463 |
1469 void TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen( | 1464 void TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen( |
1470 int x, int y, v8::Local<v8::Function> callback) { | 1465 int x, |
| 1466 int y, |
| 1467 v8::Local<v8::Function> callback) { |
1471 if (view_runner_) | 1468 if (view_runner_) |
1472 view_runner_->CopyImageAtAndCapturePixelsAsyncThen(x, y, callback); | 1469 view_runner_->CopyImageAtAndCapturePixelsAsyncThen(x, y, callback); |
1473 } | 1470 } |
1474 | 1471 |
1475 void TestRunnerBindings::SetCustomTextOutput(const std::string& output) { | 1472 void TestRunnerBindings::SetCustomTextOutput(const std::string& output) { |
1476 if (runner_) | 1473 if (runner_) |
1477 runner_->setCustomTextOutput(output); | 1474 runner_->setCustomTextOutput(output); |
1478 } | 1475 } |
1479 | 1476 |
1480 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name, | 1477 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name, |
1481 bool enabled) { | 1478 bool enabled) { |
1482 if (view_runner_) | 1479 if (view_runner_) |
1483 view_runner_->SetViewSourceForFrame(name, enabled); | 1480 view_runner_->SetViewSourceForFrame(name, enabled); |
1484 } | 1481 } |
1485 | 1482 |
1486 void TestRunnerBindings::SetPermission(const std::string& name, | 1483 void TestRunnerBindings::SetPermission(const std::string& name, |
1487 const std::string& value, | 1484 const std::string& value, |
1488 const std::string& origin, | 1485 const std::string& origin, |
1489 const std::string& embedding_origin) { | 1486 const std::string& embedding_origin) { |
1490 if (!runner_) | 1487 if (!runner_) |
1491 return; | 1488 return; |
1492 | 1489 |
1493 return runner_->SetPermission( | 1490 return runner_->SetPermission(name, value, GURL(origin), |
1494 name, value, GURL(origin), GURL(embedding_origin)); | 1491 GURL(embedding_origin)); |
1495 } | 1492 } |
1496 | 1493 |
1497 void TestRunnerBindings::DispatchBeforeInstallPromptEvent( | 1494 void TestRunnerBindings::DispatchBeforeInstallPromptEvent( |
1498 const std::vector<std::string>& event_platforms, | 1495 const std::vector<std::string>& event_platforms, |
1499 v8::Local<v8::Function> callback) { | 1496 v8::Local<v8::Function> callback) { |
1500 if (!view_runner_) | 1497 if (!view_runner_) |
1501 return; | 1498 return; |
1502 | 1499 |
1503 return view_runner_->DispatchBeforeInstallPromptEvent(event_platforms, | 1500 return view_runner_->DispatchBeforeInstallPromptEvent(event_platforms, |
1504 callback); | 1501 callback); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1539 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { | 1536 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { |
1540 if (view_runner_) | 1537 if (view_runner_) |
1541 view_runner_->ForceNextWebGLContextCreationToFail(); | 1538 view_runner_->ForceNextWebGLContextCreationToFail(); |
1542 } | 1539 } |
1543 | 1540 |
1544 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { | 1541 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { |
1545 if (view_runner_) | 1542 if (view_runner_) |
1546 view_runner_->ForceNextDrawingBufferCreationToFail(); | 1543 view_runner_->ForceNextDrawingBufferCreationToFail(); |
1547 } | 1544 } |
1548 | 1545 |
1549 void TestRunnerBindings::NotImplemented(const gin::Arguments& args) { | 1546 void TestRunnerBindings::NotImplemented(const gin::Arguments& args) {} |
1550 } | |
1551 | 1547 |
1552 TestRunner::WorkQueue::WorkQueue(TestRunner* controller) | 1548 TestRunner::WorkQueue::WorkQueue(TestRunner* controller) |
1553 : frozen_(false), controller_(controller), weak_factory_(this) {} | 1549 : frozen_(false), controller_(controller), weak_factory_(this) {} |
1554 | 1550 |
1555 TestRunner::WorkQueue::~WorkQueue() { | 1551 TestRunner::WorkQueue::~WorkQueue() { |
1556 Reset(); | 1552 Reset(); |
1557 } | 1553 } |
1558 | 1554 |
1559 void TestRunner::WorkQueue::ProcessWorkSoon() { | 1555 void TestRunner::WorkQueue::ProcessWorkSoon() { |
1560 if (controller_->topLoadingFrame()) | 1556 if (controller_->topLoadingFrame()) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 | 1730 |
1735 bool TestRunner::ShouldGeneratePixelResults() { | 1731 bool TestRunner::ShouldGeneratePixelResults() { |
1736 CheckResponseMimeType(); | 1732 CheckResponseMimeType(); |
1737 return layout_test_runtime_flags_.generate_pixel_results(); | 1733 return layout_test_runtime_flags_.generate_pixel_results(); |
1738 } | 1734 } |
1739 | 1735 |
1740 bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { | 1736 bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { |
1741 return layout_test_runtime_flags_.stay_on_page_after_handling_before_unload(); | 1737 return layout_test_runtime_flags_.stay_on_page_after_handling_before_unload(); |
1742 } | 1738 } |
1743 | 1739 |
1744 | |
1745 void TestRunner::setShouldGeneratePixelResults(bool value) { | 1740 void TestRunner::setShouldGeneratePixelResults(bool value) { |
1746 layout_test_runtime_flags_.set_generate_pixel_results(value); | 1741 layout_test_runtime_flags_.set_generate_pixel_results(value); |
1747 OnLayoutTestRuntimeFlagsChanged(); | 1742 OnLayoutTestRuntimeFlagsChanged(); |
1748 } | 1743 } |
1749 | 1744 |
1750 bool TestRunner::ShouldDumpAsAudio() const { | 1745 bool TestRunner::ShouldDumpAsAudio() const { |
1751 return dump_as_audio_; | 1746 return dump_as_audio_; |
1752 } | 1747 } |
1753 | 1748 |
1754 void TestRunner::GetAudioData(std::vector<unsigned char>* buffer_view) const { | 1749 void TestRunner::GetAudioData(std::vector<unsigned char>* buffer_view) const { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1960 } | 1955 } |
1961 | 1956 |
1962 bool TestRunner::policyDelegateShouldNotifyDone() const { | 1957 bool TestRunner::policyDelegateShouldNotifyDone() const { |
1963 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); | 1958 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); |
1964 } | 1959 } |
1965 | 1960 |
1966 void TestRunner::setToolTipText(const WebString& text) { | 1961 void TestRunner::setToolTipText(const WebString& text) { |
1967 tooltip_text_ = text.utf8(); | 1962 tooltip_text_ = text.utf8(); |
1968 } | 1963 } |
1969 | 1964 |
1970 void TestRunner::setDragImage( | 1965 void TestRunner::setDragImage(const blink::WebImage& drag_image) { |
1971 const blink::WebImage& drag_image) { | |
1972 if (layout_test_runtime_flags_.dump_drag_image()) { | 1966 if (layout_test_runtime_flags_.dump_drag_image()) { |
1973 if (drag_image_.isNull()) | 1967 if (drag_image_.isNull()) |
1974 drag_image_ = drag_image; | 1968 drag_image_ = drag_image; |
1975 } | 1969 } |
1976 } | 1970 } |
1977 | 1971 |
1978 bool TestRunner::shouldDumpNavigationPolicy() const { | 1972 bool TestRunner::shouldDumpNavigationPolicy() const { |
1979 return layout_test_runtime_flags_.dump_navigation_policy(); | 1973 return layout_test_runtime_flags_.dump_navigation_policy(); |
1980 } | 1974 } |
1981 | 1975 |
1982 midi::mojom::Result TestRunner::midiAccessorResult() { | 1976 midi::mojom::Result TestRunner::midiAccessorResult() { |
1983 return midi_accessor_result_; | 1977 return midi_accessor_result_; |
1984 } | 1978 } |
1985 | 1979 |
1986 void TestRunner::ClearDevToolsLocalStorage() { | 1980 void TestRunner::ClearDevToolsLocalStorage() { |
1987 delegate_->ClearDevToolsLocalStorage(); | 1981 delegate_->ClearDevToolsLocalStorage(); |
1988 } | 1982 } |
1989 | 1983 |
1990 void TestRunner::SetV8CacheDisabled(bool disabled) { | 1984 void TestRunner::SetV8CacheDisabled(bool disabled) { |
1991 if (!main_view_) { | 1985 if (!main_view_) { |
1992 disable_v8_cache_ = disabled; | 1986 disable_v8_cache_ = disabled; |
1993 return; | 1987 return; |
1994 } | 1988 } |
1995 main_view_->settings()->setV8CacheOptions(disabled ? | 1989 main_view_->settings()->setV8CacheOptions( |
1996 blink::WebSettings::V8CacheOptionsNone : | 1990 disabled ? blink::WebSettings::V8CacheOptionsNone |
1997 blink::WebSettings::V8CacheOptionsDefault); | 1991 : blink::WebSettings::V8CacheOptionsDefault); |
1998 } | 1992 } |
1999 | 1993 |
2000 void TestRunner::ShowDevTools(const std::string& settings, | 1994 void TestRunner::ShowDevTools(const std::string& settings, |
2001 const std::string& frontend_url) { | 1995 const std::string& frontend_url) { |
2002 delegate_->ShowDevTools(settings, frontend_url); | 1996 delegate_->ShowDevTools(settings, frontend_url); |
2003 } | 1997 } |
2004 | 1998 |
2005 class WorkItemBackForward : public TestRunner::WorkItem { | 1999 class WorkItemBackForward : public TestRunner::WorkItem { |
2006 public: | 2000 public: |
2007 WorkItemBackForward(int distance) : distance_(distance) {} | 2001 WorkItemBackForward(int distance) : distance_(distance) {} |
2008 | 2002 |
2009 bool Run(WebTestDelegate* delegate, WebView*) override { | 2003 bool Run(WebTestDelegate* delegate, WebView*) override { |
2010 delegate->GoToOffset(distance_); | 2004 delegate->GoToOffset(distance_); |
2011 return true; // FIXME: Did it really start a navigation? | 2005 return true; // FIXME: Did it really start a navigation? |
2012 } | 2006 } |
2013 | 2007 |
2014 private: | 2008 private: |
2015 int distance_; | 2009 int distance_; |
2016 }; | 2010 }; |
2017 | 2011 |
2018 void TestRunner::WaitUntilDone() { | 2012 void TestRunner::WaitUntilDone() { |
2019 layout_test_runtime_flags_.set_wait_until_done(true); | 2013 layout_test_runtime_flags_.set_wait_until_done(true); |
2020 OnLayoutTestRuntimeFlagsChanged(); | 2014 OnLayoutTestRuntimeFlagsChanged(); |
2021 } | 2015 } |
(...skipping 13 matching lines...) Expand all Loading... |
2035 return true; | 2029 return true; |
2036 } | 2030 } |
2037 }; | 2031 }; |
2038 | 2032 |
2039 void TestRunner::QueueReload() { | 2033 void TestRunner::QueueReload() { |
2040 work_queue_.AddWork(new WorkItemReload()); | 2034 work_queue_.AddWork(new WorkItemReload()); |
2041 } | 2035 } |
2042 | 2036 |
2043 class WorkItemLoadingScript : public TestRunner::WorkItem { | 2037 class WorkItemLoadingScript : public TestRunner::WorkItem { |
2044 public: | 2038 public: |
2045 WorkItemLoadingScript(const std::string& script) | 2039 WorkItemLoadingScript(const std::string& script) : script_(script) {} |
2046 : script_(script) {} | |
2047 | 2040 |
2048 bool Run(WebTestDelegate*, WebView* web_view) override { | 2041 bool Run(WebTestDelegate*, WebView* web_view) override { |
2049 web_view->mainFrame()->executeScript( | 2042 web_view->mainFrame()->executeScript( |
2050 WebScriptSource(WebString::fromUTF8(script_))); | 2043 WebScriptSource(WebString::fromUTF8(script_))); |
2051 return true; // FIXME: Did it really start a navigation? | 2044 return true; // FIXME: Did it really start a navigation? |
2052 } | 2045 } |
2053 | 2046 |
2054 private: | 2047 private: |
2055 std::string script_; | 2048 std::string script_; |
2056 }; | 2049 }; |
2057 | 2050 |
2058 void TestRunner::QueueLoadingScript(const std::string& script) { | 2051 void TestRunner::QueueLoadingScript(const std::string& script) { |
2059 work_queue_.AddWork(new WorkItemLoadingScript(script)); | 2052 work_queue_.AddWork(new WorkItemLoadingScript(script)); |
2060 } | 2053 } |
2061 | 2054 |
2062 class WorkItemNonLoadingScript : public TestRunner::WorkItem { | 2055 class WorkItemNonLoadingScript : public TestRunner::WorkItem { |
2063 public: | 2056 public: |
2064 WorkItemNonLoadingScript(const std::string& script) | 2057 WorkItemNonLoadingScript(const std::string& script) : script_(script) {} |
2065 : script_(script) {} | |
2066 | 2058 |
2067 bool Run(WebTestDelegate*, WebView* web_view) override { | 2059 bool Run(WebTestDelegate*, WebView* web_view) override { |
2068 web_view->mainFrame()->executeScript( | 2060 web_view->mainFrame()->executeScript( |
2069 WebScriptSource(WebString::fromUTF8(script_))); | 2061 WebScriptSource(WebString::fromUTF8(script_))); |
2070 return false; | 2062 return false; |
2071 } | 2063 } |
2072 | 2064 |
2073 private: | 2065 private: |
2074 std::string script_; | 2066 std::string script_; |
2075 }; | 2067 }; |
2076 | 2068 |
2077 void TestRunner::QueueNonLoadingScript(const std::string& script) { | 2069 void TestRunner::QueueNonLoadingScript(const std::string& script) { |
2078 work_queue_.AddWork(new WorkItemNonLoadingScript(script)); | 2070 work_queue_.AddWork(new WorkItemNonLoadingScript(script)); |
2079 } | 2071 } |
2080 | 2072 |
2081 class WorkItemLoad : public TestRunner::WorkItem { | 2073 class WorkItemLoad : public TestRunner::WorkItem { |
2082 public: | 2074 public: |
2083 WorkItemLoad(const WebURL& url, const std::string& target) | 2075 WorkItemLoad(const WebURL& url, const std::string& target) |
2084 : url_(url), target_(target) {} | 2076 : url_(url), target_(target) {} |
2085 | 2077 |
2086 bool Run(WebTestDelegate* delegate, WebView*) override { | 2078 bool Run(WebTestDelegate* delegate, WebView*) override { |
2087 delegate->LoadURLForFrame(url_, target_); | 2079 delegate->LoadURLForFrame(url_, target_); |
2088 return true; // FIXME: Did it really start a navigation? | 2080 return true; // FIXME: Did it really start a navigation? |
2089 } | 2081 } |
2090 | 2082 |
2091 private: | 2083 private: |
2092 WebURL url_; | 2084 WebURL url_; |
2093 std::string target_; | 2085 std::string target_; |
2094 }; | 2086 }; |
2095 | 2087 |
2096 void TestRunner::QueueLoad(const std::string& url, const std::string& target) { | 2088 void TestRunner::QueueLoad(const std::string& url, const std::string& target) { |
2097 if (!main_view_) | 2089 if (!main_view_) |
2098 return; | 2090 return; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2139 void TestRunner::AddOriginAccessWhitelistEntry( | 2131 void TestRunner::AddOriginAccessWhitelistEntry( |
2140 const std::string& source_origin, | 2132 const std::string& source_origin, |
2141 const std::string& destination_protocol, | 2133 const std::string& destination_protocol, |
2142 const std::string& destination_host, | 2134 const std::string& destination_host, |
2143 bool allow_destination_subdomains) { | 2135 bool allow_destination_subdomains) { |
2144 WebURL url((GURL(source_origin))); | 2136 WebURL url((GURL(source_origin))); |
2145 if (!url.isValid()) | 2137 if (!url.isValid()) |
2146 return; | 2138 return; |
2147 | 2139 |
2148 WebSecurityPolicy::addOriginAccessWhitelistEntry( | 2140 WebSecurityPolicy::addOriginAccessWhitelistEntry( |
2149 url, | 2141 url, WebString::fromUTF8(destination_protocol), |
2150 WebString::fromUTF8(destination_protocol), | 2142 WebString::fromUTF8(destination_host), allow_destination_subdomains); |
2151 WebString::fromUTF8(destination_host), | |
2152 allow_destination_subdomains); | |
2153 } | 2143 } |
2154 | 2144 |
2155 void TestRunner::RemoveOriginAccessWhitelistEntry( | 2145 void TestRunner::RemoveOriginAccessWhitelistEntry( |
2156 const std::string& source_origin, | 2146 const std::string& source_origin, |
2157 const std::string& destination_protocol, | 2147 const std::string& destination_protocol, |
2158 const std::string& destination_host, | 2148 const std::string& destination_host, |
2159 bool allow_destination_subdomains) { | 2149 bool allow_destination_subdomains) { |
2160 WebURL url((GURL(source_origin))); | 2150 WebURL url((GURL(source_origin))); |
2161 if (!url.isValid()) | 2151 if (!url.isValid()) |
2162 return; | 2152 return; |
2163 | 2153 |
2164 WebSecurityPolicy::removeOriginAccessWhitelistEntry( | 2154 WebSecurityPolicy::removeOriginAccessWhitelistEntry( |
2165 url, | 2155 url, WebString::fromUTF8(destination_protocol), |
2166 WebString::fromUTF8(destination_protocol), | 2156 WebString::fromUTF8(destination_host), allow_destination_subdomains); |
2167 WebString::fromUTF8(destination_host), | |
2168 allow_destination_subdomains); | |
2169 } | 2157 } |
2170 | 2158 |
2171 void TestRunner::SetTextSubpixelPositioning(bool value) { | 2159 void TestRunner::SetTextSubpixelPositioning(bool value) { |
2172 #if defined(__linux__) || defined(ANDROID) | 2160 #if defined(__linux__) || defined(ANDROID) |
2173 // Since FontConfig doesn't provide a variable to control subpixel | 2161 // Since FontConfig doesn't provide a variable to control subpixel |
2174 // positioning, we'll fall back to setting it globally for all fonts. | 2162 // positioning, we'll fall back to setting it globally for all fonts. |
2175 WebFontRendering::setSubpixelPositioning(value); | 2163 WebFontRendering::setSubpixelPositioning(value); |
2176 #endif | 2164 #endif |
2177 } | 2165 } |
2178 | 2166 |
(...skipping 18 matching lines...) Expand all Loading... |
2197 } | 2185 } |
2198 | 2186 |
2199 void TestRunner::SetMockDeviceLight(double value) { | 2187 void TestRunner::SetMockDeviceLight(double value) { |
2200 delegate_->SetDeviceLightData(value); | 2188 delegate_->SetDeviceLightData(value); |
2201 } | 2189 } |
2202 | 2190 |
2203 void TestRunner::ResetDeviceLight() { | 2191 void TestRunner::ResetDeviceLight() { |
2204 delegate_->SetDeviceLightData(-1); | 2192 delegate_->SetDeviceLightData(-1); |
2205 } | 2193 } |
2206 | 2194 |
2207 void TestRunner::SetMockDeviceMotion( | 2195 void TestRunner::SetMockDeviceMotion(bool has_acceleration_x, |
2208 bool has_acceleration_x, double acceleration_x, | 2196 double acceleration_x, |
2209 bool has_acceleration_y, double acceleration_y, | 2197 bool has_acceleration_y, |
2210 bool has_acceleration_z, double acceleration_z, | 2198 double acceleration_y, |
2211 bool has_acceleration_including_gravity_x, | 2199 bool has_acceleration_z, |
2212 double acceleration_including_gravity_x, | 2200 double acceleration_z, |
2213 bool has_acceleration_including_gravity_y, | 2201 bool has_acceleration_including_gravity_x, |
2214 double acceleration_including_gravity_y, | 2202 double acceleration_including_gravity_x, |
2215 bool has_acceleration_including_gravity_z, | 2203 bool has_acceleration_including_gravity_y, |
2216 double acceleration_including_gravity_z, | 2204 double acceleration_including_gravity_y, |
2217 bool has_rotation_rate_alpha, double rotation_rate_alpha, | 2205 bool has_acceleration_including_gravity_z, |
2218 bool has_rotation_rate_beta, double rotation_rate_beta, | 2206 double acceleration_including_gravity_z, |
2219 bool has_rotation_rate_gamma, double rotation_rate_gamma, | 2207 bool has_rotation_rate_alpha, |
2220 double interval) { | 2208 double rotation_rate_alpha, |
| 2209 bool has_rotation_rate_beta, |
| 2210 double rotation_rate_beta, |
| 2211 bool has_rotation_rate_gamma, |
| 2212 double rotation_rate_gamma, |
| 2213 double interval) { |
2221 WebDeviceMotionData motion; | 2214 WebDeviceMotionData motion; |
2222 | 2215 |
2223 // acceleration | 2216 // acceleration |
2224 motion.hasAccelerationX = has_acceleration_x; | 2217 motion.hasAccelerationX = has_acceleration_x; |
2225 motion.accelerationX = acceleration_x; | 2218 motion.accelerationX = acceleration_x; |
2226 motion.hasAccelerationY = has_acceleration_y; | 2219 motion.hasAccelerationY = has_acceleration_y; |
2227 motion.accelerationY = acceleration_y; | 2220 motion.accelerationY = acceleration_y; |
2228 motion.hasAccelerationZ = has_acceleration_z; | 2221 motion.hasAccelerationZ = has_acceleration_z; |
2229 motion.accelerationZ = acceleration_z; | 2222 motion.accelerationZ = acceleration_z; |
2230 | 2223 |
(...skipping 15 matching lines...) Expand all Loading... |
2246 motion.rotationRateBeta = rotation_rate_beta; | 2239 motion.rotationRateBeta = rotation_rate_beta; |
2247 motion.hasRotationRateGamma = has_rotation_rate_gamma; | 2240 motion.hasRotationRateGamma = has_rotation_rate_gamma; |
2248 motion.rotationRateGamma = rotation_rate_gamma; | 2241 motion.rotationRateGamma = rotation_rate_gamma; |
2249 | 2242 |
2250 // interval | 2243 // interval |
2251 motion.interval = interval; | 2244 motion.interval = interval; |
2252 | 2245 |
2253 delegate_->SetDeviceMotionData(motion); | 2246 delegate_->SetDeviceMotionData(motion); |
2254 } | 2247 } |
2255 | 2248 |
2256 void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha, | 2249 void TestRunner::SetMockDeviceOrientation(bool has_alpha, |
2257 bool has_beta, double beta, | 2250 double alpha, |
2258 bool has_gamma, double gamma, | 2251 bool has_beta, |
| 2252 double beta, |
| 2253 bool has_gamma, |
| 2254 double gamma, |
2259 bool absolute) { | 2255 bool absolute) { |
2260 WebDeviceOrientationData orientation; | 2256 WebDeviceOrientationData orientation; |
2261 | 2257 |
2262 // alpha | 2258 // alpha |
2263 orientation.hasAlpha = has_alpha; | 2259 orientation.hasAlpha = has_alpha; |
2264 orientation.alpha = alpha; | 2260 orientation.alpha = alpha; |
2265 | 2261 |
2266 // beta | 2262 // beta |
2267 orientation.hasBeta = has_beta; | 2263 orientation.hasBeta = has_beta; |
2268 orientation.beta = beta; | 2264 orientation.beta = beta; |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 | 2808 |
2813 void TestRunner::NotifyDone() { | 2809 void TestRunner::NotifyDone() { |
2814 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2810 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2815 !will_navigate_ && work_queue_.is_empty()) | 2811 !will_navigate_ && work_queue_.is_empty()) |
2816 delegate_->TestFinished(); | 2812 delegate_->TestFinished(); |
2817 layout_test_runtime_flags_.set_wait_until_done(false); | 2813 layout_test_runtime_flags_.set_wait_until_done(false); |
2818 OnLayoutTestRuntimeFlagsChanged(); | 2814 OnLayoutTestRuntimeFlagsChanged(); |
2819 } | 2815 } |
2820 | 2816 |
2821 } // namespace test_runner | 2817 } // namespace test_runner |
OLD | NEW |