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

Side by Side Diff: components/test_runner/test_runner.cc

Issue 2270293003: Add a switch to TestRunner to enable/disable mock spell checker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use in-class initialization Created 4 years, 3 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
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 "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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SetDisallowedSubresourcePathSuffixes( 212 void SetDisallowedSubresourcePathSuffixes(
213 const std::vector<std::string>& suffixes); 213 const std::vector<std::string>& suffixes);
214 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, 214 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden,
215 const std::string& scheme); 215 const std::string& scheme);
216 void SetDumpConsoleMessages(bool value); 216 void SetDumpConsoleMessages(bool value);
217 void SetMockSpellCheckerEnabled(bool enabled);
217 void SetImagesAllowed(bool allowed); 218 void SetImagesAllowed(bool allowed);
218 void SetIsolatedWorldContentSecurityPolicy(int world_id, 219 void SetIsolatedWorldContentSecurityPolicy(int world_id,
219 const std::string& policy); 220 const std::string& policy);
220 void SetIsolatedWorldSecurityOrigin(int world_id, 221 void SetIsolatedWorldSecurityOrigin(int world_id,
221 v8::Local<v8::Value> origin); 222 v8::Local<v8::Value> origin);
222 void SetJavaScriptCanAccessClipboard(bool can_access); 223 void SetJavaScriptCanAccessClipboard(bool can_access);
223 void SetMIDIAccessorResult(bool result); 224 void SetMIDIAccessorResult(bool result);
224 void SetMockDeviceLight(double value); 225 void SetMockDeviceLight(double value);
225 void SetMockDeviceMotion(gin::Arguments* args); 226 void SetMockDeviceMotion(gin::Arguments* args);
226 void SetMockDeviceOrientation(gin::Arguments* args); 227 void SetMockDeviceOrientation(gin::Arguments* args);
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) 508 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile)
508 .SetMethod("setCustomPolicyDelegate", 509 .SetMethod("setCustomPolicyDelegate",
509 &TestRunnerBindings::SetCustomPolicyDelegate) 510 &TestRunnerBindings::SetCustomPolicyDelegate)
510 .SetMethod("setCustomTextOutput", 511 .SetMethod("setCustomTextOutput",
511 &TestRunnerBindings::SetCustomTextOutput) 512 &TestRunnerBindings::SetCustomTextOutput)
512 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) 513 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota)
513 .SetMethod("setDomainRelaxationForbiddenForURLScheme", 514 .SetMethod("setDomainRelaxationForbiddenForURLScheme",
514 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) 515 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme)
515 .SetMethod("setDumpConsoleMessages", 516 .SetMethod("setDumpConsoleMessages",
516 &TestRunnerBindings::SetDumpConsoleMessages) 517 &TestRunnerBindings::SetDumpConsoleMessages)
518 .SetMethod("setMockSpellCheckerEnabled",
519 &TestRunnerBindings::SetMockSpellCheckerEnabled)
517 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) 520 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented)
518 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) 521 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed)
519 .SetMethod("setIsolatedWorldContentSecurityPolicy", 522 .SetMethod("setIsolatedWorldContentSecurityPolicy",
520 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) 523 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy)
521 .SetMethod("setIsolatedWorldSecurityOrigin", 524 .SetMethod("setIsolatedWorldSecurityOrigin",
522 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) 525 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin)
523 .SetMethod("setJavaScriptCanAccessClipboard", 526 .SetMethod("setJavaScriptCanAccessClipboard",
524 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) 527 &TestRunnerBindings::SetJavaScriptCanAccessClipboard)
525 .SetMethod("setMIDIAccessorResult", 528 .SetMethod("setMIDIAccessorResult",
526 &TestRunnerBindings::SetMIDIAccessorResult) 529 &TestRunnerBindings::SetMIDIAccessorResult)
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 bool forbidden, const std::string& scheme) { 701 bool forbidden, const std::string& scheme) {
699 if (view_runner_) 702 if (view_runner_)
700 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); 703 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
701 } 704 }
702 705
703 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) { 706 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) {
704 if (runner_) 707 if (runner_)
705 runner_->SetDumpConsoleMessages(enabled); 708 runner_->SetDumpConsoleMessages(enabled);
706 } 709 }
707 710
711 void TestRunnerBindings::SetMockSpellCheckerEnabled(bool enabled) {
712 if (runner_)
713 runner_->SetMockSpellCheckerEnabled(enabled);
714 }
715
708 v8::Local<v8::Value> 716 v8::Local<v8::Value>
709 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( 717 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue(
710 int world_id, const std::string& script) { 718 int world_id, const std::string& script) {
711 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) 719 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29))
712 return v8::Local<v8::Value>(); 720 return v8::Local<v8::Value>();
713 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, 721 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id,
714 script); 722 script);
715 } 723 }
716 724
717 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( 725 void TestRunnerBindings::EvaluateScriptInIsolatedWorld(
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 1630
1623 SetUseMockTheme(true); 1631 SetUseMockTheme(true);
1624 1632
1625 weak_factory_.InvalidateWeakPtrs(); 1633 weak_factory_.InvalidateWeakPtrs();
1626 work_queue_.Reset(); 1634 work_queue_.Reset();
1627 1635
1628 if (close_remaining_windows_ && delegate_) 1636 if (close_remaining_windows_ && delegate_)
1629 delegate_->CloseRemainingWindows(); 1637 delegate_->CloseRemainingWindows();
1630 else 1638 else
1631 close_remaining_windows_ = true; 1639 close_remaining_windows_ = true;
1640
1641 spellcheck_->SetEnabled(false);
1632 } 1642 }
1633 1643
1634 void TestRunner::SetTestIsRunning(bool running) { 1644 void TestRunner::SetTestIsRunning(bool running) {
1635 test_is_running_ = running; 1645 test_is_running_ = running;
1636 } 1646 }
1637 1647
1638 bool TestRunner::shouldDumpEditingCallbacks() const { 1648 bool TestRunner::shouldDumpEditingCallbacks() const {
1639 return layout_test_runtime_flags_.dump_editting_callbacks(); 1649 return layout_test_runtime_flags_.dump_editting_callbacks();
1640 } 1650 }
1641 1651
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
2563 void TestRunner::DumpNavigationPolicy() { 2573 void TestRunner::DumpNavigationPolicy() {
2564 layout_test_runtime_flags_.set_dump_navigation_policy(true); 2574 layout_test_runtime_flags_.set_dump_navigation_policy(true);
2565 OnLayoutTestRuntimeFlagsChanged(); 2575 OnLayoutTestRuntimeFlagsChanged();
2566 } 2576 }
2567 2577
2568 void TestRunner::SetDumpConsoleMessages(bool value) { 2578 void TestRunner::SetDumpConsoleMessages(bool value) {
2569 layout_test_runtime_flags_.set_dump_console_messages(value); 2579 layout_test_runtime_flags_.set_dump_console_messages(value);
2570 OnLayoutTestRuntimeFlagsChanged(); 2580 OnLayoutTestRuntimeFlagsChanged();
2571 } 2581 }
2572 2582
2583 void TestRunner::SetMockSpellCheckerEnabled(bool enabled) {
2584 spellcheck_->SetEnabled(enabled);
2585 }
2586
2573 bool TestRunner::ShouldDumpConsoleMessages() const { 2587 bool TestRunner::ShouldDumpConsoleMessages() const {
2574 return layout_test_runtime_flags_.dump_console_messages(); 2588 return layout_test_runtime_flags_.dump_console_messages();
2575 } 2589 }
2576 2590
2577 void TestRunner::CloseWebInspector() { 2591 void TestRunner::CloseWebInspector() {
2578 delegate_->CloseDevTools(); 2592 delegate_->CloseDevTools();
2579 } 2593 }
2580 2594
2581 bool TestRunner::IsChooserShown() { 2595 bool TestRunner::IsChooserShown() {
2582 return 0 < chooser_count_; 2596 return 0 < chooser_count_;
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2727 2741
2728 void TestRunner::NotifyDone() { 2742 void TestRunner::NotifyDone() {
2729 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && 2743 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() &&
2730 !will_navigate_ && work_queue_.is_empty()) 2744 !will_navigate_ && work_queue_.is_empty())
2731 delegate_->TestFinished(); 2745 delegate_->TestFinished();
2732 layout_test_runtime_flags_.set_wait_until_done(false); 2746 layout_test_runtime_flags_.set_wait_until_done(false);
2733 OnLayoutTestRuntimeFlagsChanged(); 2747 OnLayoutTestRuntimeFlagsChanged();
2734 } 2748 }
2735 2749
2736 } // namespace test_runner 2750 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/test_runner.h ('k') | third_party/WebKit/LayoutTests/accessibility/misspellings.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698