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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 const std::string& origin, | 234 const std::string& origin, |
235 const std::string& embedding_origin); | 235 const std::string& embedding_origin); |
236 void SetPluginsAllowed(bool allowed); | 236 void SetPluginsAllowed(bool allowed); |
237 void SetPluginsEnabled(bool enabled); | 237 void SetPluginsEnabled(bool enabled); |
238 void SetPointerLockWillFailSynchronously(); | 238 void SetPointerLockWillFailSynchronously(); |
239 void SetPointerLockWillRespondAsynchronously(); | 239 void SetPointerLockWillRespondAsynchronously(); |
240 void SetPopupBlockingEnabled(bool block_popups); | 240 void SetPopupBlockingEnabled(bool block_popups); |
241 void SetPrinting(); | 241 void SetPrinting(); |
242 void SetScriptsAllowed(bool allowed); | 242 void SetScriptsAllowed(bool allowed); |
243 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); | 243 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); |
| 244 void SetSpellCheckResolvedCallback(v8::Local<v8::Function> callback); |
244 void SetStorageAllowed(bool allowed); | 245 void SetStorageAllowed(bool allowed); |
245 void SetTabKeyCyclesThroughElements(bool tab_key_cycles_through_elements); | 246 void SetTabKeyCyclesThroughElements(bool tab_key_cycles_through_elements); |
246 void SetTextDirection(const std::string& direction_name); | 247 void SetTextDirection(const std::string& direction_name); |
247 void SetTextSubpixelPositioning(bool value); | 248 void SetTextSubpixelPositioning(bool value); |
248 void SetUseMockTheme(bool use); | 249 void SetUseMockTheme(bool use); |
249 void SetViewSourceForFrame(const std::string& name, bool enabled); | 250 void SetViewSourceForFrame(const std::string& name, bool enabled); |
250 void SetWillSendRequestClearHeader(const std::string& header); | 251 void SetWillSendRequestClearHeader(const std::string& header); |
251 void SetWindowIsKey(bool value); | 252 void SetWindowIsKey(bool value); |
252 void SetXSSAuditorEnabled(bool enabled); | 253 void SetXSSAuditorEnabled(bool enabled); |
253 void ShowWebInspector(gin::Arguments* args); | 254 void ShowWebInspector(gin::Arguments* args); |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
553 .SetMethod("setPointerLockWillRespondAsynchronously", | 554 .SetMethod("setPointerLockWillRespondAsynchronously", |
554 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously) | 555 &TestRunnerBindings::SetPointerLockWillRespondAsynchronously) |
555 .SetMethod("setPopupBlockingEnabled", | 556 .SetMethod("setPopupBlockingEnabled", |
556 &TestRunnerBindings::SetPopupBlockingEnabled) | 557 &TestRunnerBindings::SetPopupBlockingEnabled) |
557 .SetMethod("setPrinting", &TestRunnerBindings::SetPrinting) | 558 .SetMethod("setPrinting", &TestRunnerBindings::SetPrinting) |
558 .SetMethod("setScriptsAllowed", &TestRunnerBindings::SetScriptsAllowed) | 559 .SetMethod("setScriptsAllowed", &TestRunnerBindings::SetScriptsAllowed) |
559 .SetMethod("setScrollbarPolicy", &TestRunnerBindings::NotImplemented) | 560 .SetMethod("setScrollbarPolicy", &TestRunnerBindings::NotImplemented) |
560 .SetMethod( | 561 .SetMethod( |
561 "setShouldStayOnPageAfterHandlingBeforeUnload", | 562 "setShouldStayOnPageAfterHandlingBeforeUnload", |
562 &TestRunnerBindings::SetShouldStayOnPageAfterHandlingBeforeUnload) | 563 &TestRunnerBindings::SetShouldStayOnPageAfterHandlingBeforeUnload) |
| 564 .SetMethod("setSpellCheckResolvedCallback", |
| 565 &TestRunnerBindings::SetSpellCheckResolvedCallback) |
563 .SetMethod("setStorageAllowed", &TestRunnerBindings::SetStorageAllowed) | 566 .SetMethod("setStorageAllowed", &TestRunnerBindings::SetStorageAllowed) |
564 .SetMethod("setTabKeyCyclesThroughElements", | 567 .SetMethod("setTabKeyCyclesThroughElements", |
565 &TestRunnerBindings::SetTabKeyCyclesThroughElements) | 568 &TestRunnerBindings::SetTabKeyCyclesThroughElements) |
566 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection) | 569 .SetMethod("setTextDirection", &TestRunnerBindings::SetTextDirection) |
567 .SetMethod("setTextSubpixelPositioning", | 570 .SetMethod("setTextSubpixelPositioning", |
568 &TestRunnerBindings::SetTextSubpixelPositioning) | 571 &TestRunnerBindings::SetTextSubpixelPositioning) |
569 .SetMethod("setUseDashboardCompatibilityMode", | 572 .SetMethod("setUseDashboardCompatibilityMode", |
570 &TestRunnerBindings::NotImplemented) | 573 &TestRunnerBindings::NotImplemented) |
571 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) | 574 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) |
572 .SetMethod("setViewSourceForFrame", | 575 .SetMethod("setViewSourceForFrame", |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 | 744 |
742 if (runner_) | 745 if (runner_) |
743 runner_->SetEffectiveConnectionType(web_type); | 746 runner_->SetEffectiveConnectionType(web_type); |
744 } | 747 } |
745 | 748 |
746 void TestRunnerBindings::SetMockSpellCheckerEnabled(bool enabled) { | 749 void TestRunnerBindings::SetMockSpellCheckerEnabled(bool enabled) { |
747 if (runner_) | 750 if (runner_) |
748 runner_->SetMockSpellCheckerEnabled(enabled); | 751 runner_->SetMockSpellCheckerEnabled(enabled); |
749 } | 752 } |
750 | 753 |
| 754 void TestRunnerBindings::SetSpellCheckResolvedCallback( |
| 755 v8::Local<v8::Function> callback) { |
| 756 if (runner_) |
| 757 runner_->spellcheck_->SetSpellCheckResolvedCallback(callback); |
| 758 } |
| 759 |
751 v8::Local<v8::Value> | 760 v8::Local<v8::Value> |
752 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( | 761 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( |
753 int world_id, const std::string& script) { | 762 int world_id, const std::string& script) { |
754 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) | 763 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) |
755 return v8::Local<v8::Value>(); | 764 return v8::Local<v8::Value>(); |
756 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, | 765 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, |
757 script); | 766 script); |
758 } | 767 } |
759 | 768 |
760 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( | 769 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1673 SetUseMockTheme(true); | 1682 SetUseMockTheme(true); |
1674 | 1683 |
1675 weak_factory_.InvalidateWeakPtrs(); | 1684 weak_factory_.InvalidateWeakPtrs(); |
1676 work_queue_.Reset(); | 1685 work_queue_.Reset(); |
1677 | 1686 |
1678 if (close_remaining_windows_ && delegate_) | 1687 if (close_remaining_windows_ && delegate_) |
1679 delegate_->CloseRemainingWindows(); | 1688 delegate_->CloseRemainingWindows(); |
1680 else | 1689 else |
1681 close_remaining_windows_ = true; | 1690 close_remaining_windows_ = true; |
1682 | 1691 |
1683 spellcheck_->SetEnabled(false); | 1692 spellcheck_->Reset(); |
1684 } | 1693 } |
1685 | 1694 |
1686 void TestRunner::SetTestIsRunning(bool running) { | 1695 void TestRunner::SetTestIsRunning(bool running) { |
1687 test_is_running_ = running; | 1696 test_is_running_ = running; |
1688 } | 1697 } |
1689 | 1698 |
1690 bool TestRunner::shouldDumpEditingCallbacks() const { | 1699 bool TestRunner::shouldDumpEditingCallbacks() const { |
1691 return layout_test_runtime_flags_.dump_editting_callbacks(); | 1700 return layout_test_runtime_flags_.dump_editting_callbacks(); |
1692 } | 1701 } |
1693 | 1702 |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2780 | 2789 |
2781 void TestRunner::NotifyDone() { | 2790 void TestRunner::NotifyDone() { |
2782 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2791 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2783 !will_navigate_ && work_queue_.is_empty()) | 2792 !will_navigate_ && work_queue_.is_empty()) |
2784 delegate_->TestFinished(); | 2793 delegate_->TestFinished(); |
2785 layout_test_runtime_flags_.set_wait_until_done(false); | 2794 layout_test_runtime_flags_.set_wait_until_done(false); |
2786 OnLayoutTestRuntimeFlagsChanged(); | 2795 OnLayoutTestRuntimeFlagsChanged(); |
2787 } | 2796 } |
2788 | 2797 |
2789 } // namespace test_runner | 2798 } // namespace test_runner |
OLD | NEW |