| 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 "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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 void SetColorProfile(const std::string& name, | 208 void SetColorProfile(const std::string& name, |
| 209 v8::Local<v8::Function> callback); | 209 v8::Local<v8::Function> callback); |
| 210 void SetCustomPolicyDelegate(gin::Arguments* args); | 210 void SetCustomPolicyDelegate(gin::Arguments* args); |
| 211 void SetCustomTextOutput(const std::string& output); | 211 void SetCustomTextOutput(const std::string& output); |
| 212 void SetDatabaseQuota(int quota); | 212 void SetDatabaseQuota(int quota); |
| 213 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, | 213 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, |
| 214 const std::string& scheme); | 214 const std::string& scheme); |
| 215 void SetGeofencingMockPosition(double latitude, double longitude); | 215 void SetGeofencingMockPosition(double latitude, double longitude); |
| 216 void SetGeofencingMockProvider(bool service_available); | 216 void SetGeofencingMockProvider(bool service_available); |
| 217 void SetImagesAllowed(bool allowed); | 217 void SetImagesAllowed(bool allowed); |
| 218 void SetInterceptPostMessage(bool value); | |
| 219 void SetIsolatedWorldContentSecurityPolicy(int world_id, | 218 void SetIsolatedWorldContentSecurityPolicy(int world_id, |
| 220 const std::string& policy); | 219 const std::string& policy); |
| 221 void SetIsolatedWorldSecurityOrigin(int world_id, | 220 void SetIsolatedWorldSecurityOrigin(int world_id, |
| 222 v8::Local<v8::Value> origin); | 221 v8::Local<v8::Value> origin); |
| 223 void SetJavaScriptCanAccessClipboard(bool can_access); | 222 void SetJavaScriptCanAccessClipboard(bool can_access); |
| 224 void SetMIDIAccessorResult(bool result); | 223 void SetMIDIAccessorResult(bool result); |
| 225 void SetMediaAllowed(bool allowed); | 224 void SetMediaAllowed(bool allowed); |
| 226 void SetMockDeviceLight(double value); | 225 void SetMockDeviceLight(double value); |
| 227 void SetMockDeviceMotion(gin::Arguments* args); | 226 void SetMockDeviceMotion(gin::Arguments* args); |
| 228 void SetMockDeviceOrientation(gin::Arguments* args); | 227 void SetMockDeviceOrientation(gin::Arguments* args); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 bool EnableAutoResizeMode(int min_width, | 269 bool EnableAutoResizeMode(int min_width, |
| 271 int min_height, | 270 int min_height, |
| 272 int max_width, | 271 int max_width, |
| 273 int max_height); | 272 int max_height); |
| 274 std::string EvaluateInWebInspectorOverlay(const std::string& script); | 273 std::string EvaluateInWebInspectorOverlay(const std::string& script); |
| 275 v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( | 274 v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( |
| 276 int world_id, const std::string& script); | 275 int world_id, const std::string& script); |
| 277 bool FindString(const std::string& search_text, | 276 bool FindString(const std::string& search_text, |
| 278 const std::vector<std::string>& options_array); | 277 const std::vector<std::string>& options_array); |
| 279 bool HasCustomPageSizeStyle(int page_index); | 278 bool HasCustomPageSizeStyle(int page_index); |
| 280 bool InterceptPostMessage(); | |
| 281 bool IsChooserShown(); | 279 bool IsChooserShown(); |
| 282 | 280 |
| 283 bool IsCommandEnabled(const std::string& command); | 281 bool IsCommandEnabled(const std::string& command); |
| 284 std::string PathToLocalResource(const std::string& path); | 282 std::string PathToLocalResource(const std::string& path); |
| 285 std::string PlatformName(); | 283 std::string PlatformName(); |
| 286 std::string SelectionAsMarkup(); | 284 std::string SelectionAsMarkup(); |
| 287 std::string TooltipText(); | 285 std::string TooltipText(); |
| 288 | 286 |
| 289 int WebHistoryItemCount(); | 287 int WebHistoryItemCount(); |
| 290 int WindowCount(); | 288 int WindowCount(); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 &TestRunnerBindings::ForceRedSelectionColors) | 437 &TestRunnerBindings::ForceRedSelectionColors) |
| 440 | 438 |
| 441 // The Bluetooth functions are specified at | 439 // The Bluetooth functions are specified at |
| 442 // https://webbluetoothcg.github.io/web-bluetooth/tests/. | 440 // https://webbluetoothcg.github.io/web-bluetooth/tests/. |
| 443 .SetMethod("getBluetoothManualChooserEvents", | 441 .SetMethod("getBluetoothManualChooserEvents", |
| 444 &TestRunnerBindings::GetBluetoothManualChooserEvents) | 442 &TestRunnerBindings::GetBluetoothManualChooserEvents) |
| 445 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) | 443 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) |
| 446 .SetMethod("hasCustomPageSizeStyle", | 444 .SetMethod("hasCustomPageSizeStyle", |
| 447 &TestRunnerBindings::HasCustomPageSizeStyle) | 445 &TestRunnerBindings::HasCustomPageSizeStyle) |
| 448 .SetMethod("insertStyleSheet", &TestRunnerBindings::InsertStyleSheet) | 446 .SetMethod("insertStyleSheet", &TestRunnerBindings::InsertStyleSheet) |
| 449 .SetProperty("interceptPostMessage", | |
| 450 &TestRunnerBindings::InterceptPostMessage, | |
| 451 &TestRunnerBindings::SetInterceptPostMessage) | |
| 452 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) | 447 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) |
| 453 .SetMethod("isCommandEnabled", &TestRunnerBindings::IsCommandEnabled) | 448 .SetMethod("isCommandEnabled", &TestRunnerBindings::IsCommandEnabled) |
| 454 .SetMethod("keepWebHistory", &TestRunnerBindings::NotImplemented) | 449 .SetMethod("keepWebHistory", &TestRunnerBindings::NotImplemented) |
| 455 .SetMethod("layoutAndPaintAsync", | 450 .SetMethod("layoutAndPaintAsync", |
| 456 &TestRunnerBindings::LayoutAndPaintAsync) | 451 &TestRunnerBindings::LayoutAndPaintAsync) |
| 457 .SetMethod("layoutAndPaintAsyncThen", | 452 .SetMethod("layoutAndPaintAsyncThen", |
| 458 &TestRunnerBindings::LayoutAndPaintAsyncThen) | 453 &TestRunnerBindings::LayoutAndPaintAsyncThen) |
| 459 .SetMethod("logToStderr", &TestRunnerBindings::LogToStderr) | 454 .SetMethod("logToStderr", &TestRunnerBindings::LogToStderr) |
| 460 .SetMethod("notifyDone", &TestRunnerBindings::NotifyDone) | 455 .SetMethod("notifyDone", &TestRunnerBindings::NotifyDone) |
| 461 .SetMethod("overridePreference", &TestRunnerBindings::OverridePreference) | 456 .SetMethod("overridePreference", &TestRunnerBindings::OverridePreference) |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1491 return runner_->tooltip_text_; | 1486 return runner_->tooltip_text_; |
| 1492 return std::string(); | 1487 return std::string(); |
| 1493 } | 1488 } |
| 1494 | 1489 |
| 1495 int TestRunnerBindings::WebHistoryItemCount() { | 1490 int TestRunnerBindings::WebHistoryItemCount() { |
| 1496 if (runner_) | 1491 if (runner_) |
| 1497 return runner_->web_history_item_count_; | 1492 return runner_->web_history_item_count_; |
| 1498 return false; | 1493 return false; |
| 1499 } | 1494 } |
| 1500 | 1495 |
| 1501 bool TestRunnerBindings::InterceptPostMessage() { | |
| 1502 if (runner_) | |
| 1503 return runner_->shouldInterceptPostMessage(); | |
| 1504 return false; | |
| 1505 } | |
| 1506 | |
| 1507 void TestRunnerBindings::SetInterceptPostMessage(bool value) { | |
| 1508 if (runner_) { | |
| 1509 runner_->layout_test_runtime_flags_.set_intercept_post_message(value); | |
| 1510 runner_->OnLayoutTestRuntimeFlagsChanged(); | |
| 1511 } | |
| 1512 } | |
| 1513 | |
| 1514 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { | 1496 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { |
| 1515 if (view_runner_) | 1497 if (view_runner_) |
| 1516 view_runner_->ForceNextWebGLContextCreationToFail(); | 1498 view_runner_->ForceNextWebGLContextCreationToFail(); |
| 1517 } | 1499 } |
| 1518 | 1500 |
| 1519 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { | 1501 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { |
| 1520 if (view_runner_) | 1502 if (view_runner_) |
| 1521 view_runner_->ForceNextDrawingBufferCreationToFail(); | 1503 view_runner_->ForceNextDrawingBufferCreationToFail(); |
| 1522 } | 1504 } |
| 1523 | 1505 |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1918 } | 1900 } |
| 1919 | 1901 |
| 1920 bool TestRunner::policyDelegateIsPermissive() const { | 1902 bool TestRunner::policyDelegateIsPermissive() const { |
| 1921 return layout_test_runtime_flags_.policy_delegate_is_permissive(); | 1903 return layout_test_runtime_flags_.policy_delegate_is_permissive(); |
| 1922 } | 1904 } |
| 1923 | 1905 |
| 1924 bool TestRunner::policyDelegateShouldNotifyDone() const { | 1906 bool TestRunner::policyDelegateShouldNotifyDone() const { |
| 1925 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); | 1907 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); |
| 1926 } | 1908 } |
| 1927 | 1909 |
| 1928 bool TestRunner::shouldInterceptPostMessage() const { | |
| 1929 return layout_test_runtime_flags_.intercept_post_message(); | |
| 1930 } | |
| 1931 | |
| 1932 bool TestRunner::shouldDumpResourcePriorities() const { | 1910 bool TestRunner::shouldDumpResourcePriorities() const { |
| 1933 return layout_test_runtime_flags_.dump_resource_priorities(); | 1911 return layout_test_runtime_flags_.dump_resource_priorities(); |
| 1934 } | 1912 } |
| 1935 | 1913 |
| 1936 void TestRunner::setToolTipText(const WebString& text) { | 1914 void TestRunner::setToolTipText(const WebString& text) { |
| 1937 tooltip_text_ = text.utf8(); | 1915 tooltip_text_ = text.utf8(); |
| 1938 } | 1916 } |
| 1939 | 1917 |
| 1940 void TestRunner::setDragImage( | 1918 void TestRunner::setDragImage( |
| 1941 const blink::WebImage& drag_image) { | 1919 const blink::WebImage& drag_image) { |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2778 | 2756 |
| 2779 void TestRunner::CompleteNotifyDone() { | 2757 void TestRunner::CompleteNotifyDone() { |
| 2780 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2758 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
| 2781 work_queue_.is_empty()) | 2759 work_queue_.is_empty()) |
| 2782 delegate_->TestFinished(); | 2760 delegate_->TestFinished(); |
| 2783 layout_test_runtime_flags_.set_wait_until_done(false); | 2761 layout_test_runtime_flags_.set_wait_until_done(false); |
| 2784 OnLayoutTestRuntimeFlagsChanged(); | 2762 OnLayoutTestRuntimeFlagsChanged(); |
| 2785 } | 2763 } |
| 2786 | 2764 |
| 2787 } // namespace test_runner | 2765 } // namespace test_runner |
| OLD | NEW |