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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void SetCanOpenWindows(); | 205 void SetCanOpenWindows(); |
206 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); | 206 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); |
207 void SetColorProfile(const std::string& name, | 207 void SetColorProfile(const std::string& name, |
208 v8::Local<v8::Function> callback); | 208 v8::Local<v8::Function> callback); |
209 void SetCustomPolicyDelegate(gin::Arguments* args); | 209 void SetCustomPolicyDelegate(gin::Arguments* args); |
210 void SetCustomTextOutput(const std::string& output); | 210 void SetCustomTextOutput(const std::string& output); |
211 void SetDatabaseQuota(int quota); | 211 void SetDatabaseQuota(int quota); |
212 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, | 212 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, |
213 const std::string& scheme); | 213 const std::string& scheme); |
214 void SetImagesAllowed(bool allowed); | 214 void SetImagesAllowed(bool allowed); |
215 void SetInterceptPostMessage(bool value); | |
216 void SetIsolatedWorldContentSecurityPolicy(int world_id, | 215 void SetIsolatedWorldContentSecurityPolicy(int world_id, |
217 const std::string& policy); | 216 const std::string& policy); |
218 void SetIsolatedWorldSecurityOrigin(int world_id, | 217 void SetIsolatedWorldSecurityOrigin(int world_id, |
219 v8::Local<v8::Value> origin); | 218 v8::Local<v8::Value> origin); |
220 void SetJavaScriptCanAccessClipboard(bool can_access); | 219 void SetJavaScriptCanAccessClipboard(bool can_access); |
221 void SetMIDIAccessorResult(bool result); | 220 void SetMIDIAccessorResult(bool result); |
222 void SetMediaAllowed(bool allowed); | 221 void SetMediaAllowed(bool allowed); |
223 void SetMockDeviceLight(double value); | 222 void SetMockDeviceLight(double value); |
224 void SetMockDeviceMotion(gin::Arguments* args); | 223 void SetMockDeviceMotion(gin::Arguments* args); |
225 void SetMockDeviceOrientation(gin::Arguments* args); | 224 void SetMockDeviceOrientation(gin::Arguments* args); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 bool EnableAutoResizeMode(int min_width, | 266 bool EnableAutoResizeMode(int min_width, |
268 int min_height, | 267 int min_height, |
269 int max_width, | 268 int max_width, |
270 int max_height); | 269 int max_height); |
271 std::string EvaluateInWebInspectorOverlay(const std::string& script); | 270 std::string EvaluateInWebInspectorOverlay(const std::string& script); |
272 v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( | 271 v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( |
273 int world_id, const std::string& script); | 272 int world_id, const std::string& script); |
274 bool FindString(const std::string& search_text, | 273 bool FindString(const std::string& search_text, |
275 const std::vector<std::string>& options_array); | 274 const std::vector<std::string>& options_array); |
276 bool HasCustomPageSizeStyle(int page_index); | 275 bool HasCustomPageSizeStyle(int page_index); |
277 bool InterceptPostMessage(); | |
278 bool IsChooserShown(); | 276 bool IsChooserShown(); |
279 | 277 |
280 bool IsCommandEnabled(const std::string& command); | 278 bool IsCommandEnabled(const std::string& command); |
281 std::string PathToLocalResource(const std::string& path); | 279 std::string PathToLocalResource(const std::string& path); |
282 std::string PlatformName(); | 280 std::string PlatformName(); |
283 std::string SelectionAsMarkup(); | 281 std::string SelectionAsMarkup(); |
284 std::string TooltipText(); | 282 std::string TooltipText(); |
285 | 283 |
286 int WebHistoryItemCount(); | 284 int WebHistoryItemCount(); |
287 int WindowCount(); | 285 int WindowCount(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 &TestRunnerBindings::ForceRedSelectionColors) | 432 &TestRunnerBindings::ForceRedSelectionColors) |
435 | 433 |
436 // The Bluetooth functions are specified at | 434 // The Bluetooth functions are specified at |
437 // https://webbluetoothcg.github.io/web-bluetooth/tests/. | 435 // https://webbluetoothcg.github.io/web-bluetooth/tests/. |
438 .SetMethod("getBluetoothManualChooserEvents", | 436 .SetMethod("getBluetoothManualChooserEvents", |
439 &TestRunnerBindings::GetBluetoothManualChooserEvents) | 437 &TestRunnerBindings::GetBluetoothManualChooserEvents) |
440 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) | 438 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) |
441 .SetMethod("hasCustomPageSizeStyle", | 439 .SetMethod("hasCustomPageSizeStyle", |
442 &TestRunnerBindings::HasCustomPageSizeStyle) | 440 &TestRunnerBindings::HasCustomPageSizeStyle) |
443 .SetMethod("insertStyleSheet", &TestRunnerBindings::InsertStyleSheet) | 441 .SetMethod("insertStyleSheet", &TestRunnerBindings::InsertStyleSheet) |
444 .SetProperty("interceptPostMessage", | |
445 &TestRunnerBindings::InterceptPostMessage, | |
446 &TestRunnerBindings::SetInterceptPostMessage) | |
447 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) | 442 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) |
448 .SetMethod("isCommandEnabled", &TestRunnerBindings::IsCommandEnabled) | 443 .SetMethod("isCommandEnabled", &TestRunnerBindings::IsCommandEnabled) |
449 .SetMethod("keepWebHistory", &TestRunnerBindings::NotImplemented) | 444 .SetMethod("keepWebHistory", &TestRunnerBindings::NotImplemented) |
450 .SetMethod("layoutAndPaintAsync", | 445 .SetMethod("layoutAndPaintAsync", |
451 &TestRunnerBindings::LayoutAndPaintAsync) | 446 &TestRunnerBindings::LayoutAndPaintAsync) |
452 .SetMethod("layoutAndPaintAsyncThen", | 447 .SetMethod("layoutAndPaintAsyncThen", |
453 &TestRunnerBindings::LayoutAndPaintAsyncThen) | 448 &TestRunnerBindings::LayoutAndPaintAsyncThen) |
454 .SetMethod("logToStderr", &TestRunnerBindings::LogToStderr) | 449 .SetMethod("logToStderr", &TestRunnerBindings::LogToStderr) |
455 .SetMethod("notifyDone", &TestRunnerBindings::NotifyDone) | 450 .SetMethod("notifyDone", &TestRunnerBindings::NotifyDone) |
456 .SetMethod("overridePreference", &TestRunnerBindings::OverridePreference) | 451 .SetMethod("overridePreference", &TestRunnerBindings::OverridePreference) |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 return runner_->tooltip_text_; | 1461 return runner_->tooltip_text_; |
1467 return std::string(); | 1462 return std::string(); |
1468 } | 1463 } |
1469 | 1464 |
1470 int TestRunnerBindings::WebHistoryItemCount() { | 1465 int TestRunnerBindings::WebHistoryItemCount() { |
1471 if (runner_) | 1466 if (runner_) |
1472 return runner_->web_history_item_count_; | 1467 return runner_->web_history_item_count_; |
1473 return false; | 1468 return false; |
1474 } | 1469 } |
1475 | 1470 |
1476 bool TestRunnerBindings::InterceptPostMessage() { | |
1477 if (runner_) | |
1478 return runner_->shouldInterceptPostMessage(); | |
1479 return false; | |
1480 } | |
1481 | |
1482 void TestRunnerBindings::SetInterceptPostMessage(bool value) { | |
1483 if (runner_) { | |
1484 runner_->layout_test_runtime_flags_.set_intercept_post_message(value); | |
1485 runner_->OnLayoutTestRuntimeFlagsChanged(); | |
1486 } | |
1487 } | |
1488 | |
1489 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { | 1471 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { |
1490 if (view_runner_) | 1472 if (view_runner_) |
1491 view_runner_->ForceNextWebGLContextCreationToFail(); | 1473 view_runner_->ForceNextWebGLContextCreationToFail(); |
1492 } | 1474 } |
1493 | 1475 |
1494 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { | 1476 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { |
1495 if (view_runner_) | 1477 if (view_runner_) |
1496 view_runner_->ForceNextDrawingBufferCreationToFail(); | 1478 view_runner_->ForceNextDrawingBufferCreationToFail(); |
1497 } | 1479 } |
1498 | 1480 |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1892 } | 1874 } |
1893 | 1875 |
1894 bool TestRunner::policyDelegateIsPermissive() const { | 1876 bool TestRunner::policyDelegateIsPermissive() const { |
1895 return layout_test_runtime_flags_.policy_delegate_is_permissive(); | 1877 return layout_test_runtime_flags_.policy_delegate_is_permissive(); |
1896 } | 1878 } |
1897 | 1879 |
1898 bool TestRunner::policyDelegateShouldNotifyDone() const { | 1880 bool TestRunner::policyDelegateShouldNotifyDone() const { |
1899 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); | 1881 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); |
1900 } | 1882 } |
1901 | 1883 |
1902 bool TestRunner::shouldInterceptPostMessage() const { | |
1903 return layout_test_runtime_flags_.intercept_post_message(); | |
1904 } | |
1905 | |
1906 bool TestRunner::shouldDumpResourcePriorities() const { | 1884 bool TestRunner::shouldDumpResourcePriorities() const { |
1907 return layout_test_runtime_flags_.dump_resource_priorities(); | 1885 return layout_test_runtime_flags_.dump_resource_priorities(); |
1908 } | 1886 } |
1909 | 1887 |
1910 void TestRunner::setToolTipText(const WebString& text) { | 1888 void TestRunner::setToolTipText(const WebString& text) { |
1911 tooltip_text_ = text.utf8(); | 1889 tooltip_text_ = text.utf8(); |
1912 } | 1890 } |
1913 | 1891 |
1914 void TestRunner::setDragImage( | 1892 void TestRunner::setDragImage( |
1915 const blink::WebImage& drag_image) { | 1893 const blink::WebImage& drag_image) { |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2740 | 2718 |
2741 void TestRunner::CompleteNotifyDone() { | 2719 void TestRunner::CompleteNotifyDone() { |
2742 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2720 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2743 work_queue_.is_empty()) | 2721 work_queue_.is_empty()) |
2744 delegate_->TestFinished(); | 2722 delegate_->TestFinished(); |
2745 layout_test_runtime_flags_.set_wait_until_done(false); | 2723 layout_test_runtime_flags_.set_wait_until_done(false); |
2746 OnLayoutTestRuntimeFlagsChanged(); | 2724 OnLayoutTestRuntimeFlagsChanged(); |
2747 } | 2725 } |
2748 | 2726 |
2749 } // namespace test_runner | 2727 } // namespace test_runner |
OLD | NEW |