| 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 #ifndef COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ | 6 #define COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 class MockContentSettingsClient; | 48 class MockContentSettingsClient; |
| 49 class MockCredentialManagerClient; | 49 class MockCredentialManagerClient; |
| 50 class MockScreenOrientationClient; | 50 class MockScreenOrientationClient; |
| 51 class MockWebSpeechRecognizer; | 51 class MockWebSpeechRecognizer; |
| 52 class MockWebUserMediaClient; | 52 class MockWebUserMediaClient; |
| 53 class SpellCheckClient; | 53 class SpellCheckClient; |
| 54 class TestInterfaces; | 54 class TestInterfaces; |
| 55 class TestRunnerForSpecificView; | 55 class TestRunnerForSpecificView; |
| 56 class WebTestDelegate; | 56 class WebTestDelegate; |
| 57 class MockColorChooser; |
| 57 | 58 |
| 58 // TestRunner class currently has dual purpose: | 59 // TestRunner class currently has dual purpose: |
| 59 // 1. It implements |testRunner| javascript bindings for "global" / "ambient". | 60 // 1. It implements |testRunner| javascript bindings for "global" / "ambient". |
| 60 // Examples: | 61 // Examples: |
| 61 // - testRunner.dumpAsText (test flag affecting test behavior) | 62 // - testRunner.dumpAsText (test flag affecting test behavior) |
| 62 // - testRunner.setAllowRunningOfInsecureContent (test flag affecting product | 63 // - testRunner.setAllowRunningOfInsecureContent (test flag affecting product |
| 63 // behavior) | 64 // behavior) |
| 64 // - testRunner.setTextSubpixelPositioning (directly interacts with product). | 65 // - testRunner.setTextSubpixelPositioning (directly interacts with product). |
| 65 // Note that "per-view" (non-"global") bindings are handled by | 66 // Note that "per-view" (non-"global") bindings are handled by |
| 66 // instances of TestRunnerForSpecificView class. | 67 // instances of TestRunnerForSpecificView class. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 bool policyDelegateEnabled() const; | 162 bool policyDelegateEnabled() const; |
| 162 bool policyDelegateIsPermissive() const; | 163 bool policyDelegateIsPermissive() const; |
| 163 bool policyDelegateShouldNotifyDone() const; | 164 bool policyDelegateShouldNotifyDone() const; |
| 164 void setToolTipText(const blink::WebString&); | 165 void setToolTipText(const blink::WebString&); |
| 165 void setDragImage(const blink::WebImage& drag_image); | 166 void setDragImage(const blink::WebImage& drag_image); |
| 166 bool shouldDumpNavigationPolicy() const; | 167 bool shouldDumpNavigationPolicy() const; |
| 167 | 168 |
| 168 midi::mojom::Result midiAccessorResult(); | 169 midi::mojom::Result midiAccessorResult(); |
| 169 | 170 |
| 170 // Methods used by MockColorChooser: | 171 // Methods used by MockColorChooser: |
| 171 void DidOpenChooser(); | 172 void DidOpenChooser(MockColorChooser*); |
| 172 void DidCloseChooser(); | 173 void DidCloseChooser(MockColorChooser*); |
| 173 | 174 |
| 174 bool ShouldDumpConsoleMessages() const; | 175 bool ShouldDumpConsoleMessages() const; |
| 175 bool ShouldDumpJavaScriptDialogs() const; | 176 bool ShouldDumpJavaScriptDialogs() const; |
| 176 | 177 |
| 177 blink::WebEffectiveConnectionType effective_connection_type() const { | 178 blink::WebEffectiveConnectionType effective_connection_type() const { |
| 178 return effective_connection_type_; | 179 return effective_connection_type_; |
| 179 } | 180 } |
| 180 | 181 |
| 181 // A single item in the work queue. | 182 // A single item in the work queue. |
| 182 class WorkItem { | 183 class WorkItem { |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 // provisional load for that navigation is started. Note that when | 635 // provisional load for that navigation is started. Note that when |
| 635 // browser-side navigation is enabled there is an arbitrary gap between these | 636 // browser-side navigation is enabled there is an arbitrary gap between these |
| 636 // two events. | 637 // two events. |
| 637 bool will_navigate_; | 638 bool will_navigate_; |
| 638 | 639 |
| 639 std::unique_ptr<MockCredentialManagerClient> credential_manager_client_; | 640 std::unique_ptr<MockCredentialManagerClient> credential_manager_client_; |
| 640 std::unique_ptr<MockScreenOrientationClient> mock_screen_orientation_client_; | 641 std::unique_ptr<MockScreenOrientationClient> mock_screen_orientation_client_; |
| 641 std::unique_ptr<MockWebSpeechRecognizer> speech_recognizer_; | 642 std::unique_ptr<MockWebSpeechRecognizer> speech_recognizer_; |
| 642 std::unique_ptr<MockWebUserMediaClient> user_media_client_; | 643 std::unique_ptr<MockWebUserMediaClient> user_media_client_; |
| 643 std::unique_ptr<SpellCheckClient> spellcheck_; | 644 std::unique_ptr<SpellCheckClient> spellcheck_; |
| 644 | 645 std::set<MockColorChooser*> active_color_choosers_; |
| 645 // Number of currently active color choosers. | |
| 646 int chooser_count_; | |
| 647 | 646 |
| 648 // Captured drag image. | 647 // Captured drag image. |
| 649 blink::WebImage drag_image_; | 648 blink::WebImage drag_image_; |
| 650 | 649 |
| 651 // View that was focused by a previous call to TestRunner::SetFocus method. | 650 // View that was focused by a previous call to TestRunner::SetFocus method. |
| 652 // Note - this can be a dangling pointer to an already destroyed WebView (this | 651 // Note - this can be a dangling pointer to an already destroyed WebView (this |
| 653 // is ok, because this is taken care of in WebTestDelegate::SetFocus). | 652 // is ok, because this is taken care of in WebTestDelegate::SetFocus). |
| 654 blink::WebView* previously_focused_view_; | 653 blink::WebView* previously_focused_view_; |
| 655 | 654 |
| 656 // True if we run a test in LayoutTests/imported/{csswg-test,wpt}/. | 655 // True if we run a test in LayoutTests/imported/{csswg-test,wpt}/. |
| 657 bool is_web_platform_tests_mode_; | 656 bool is_web_platform_tests_mode_; |
| 658 | 657 |
| 659 // An effective connection type settable by layout tests. | 658 // An effective connection type settable by layout tests. |
| 660 blink::WebEffectiveConnectionType effective_connection_type_; | 659 blink::WebEffectiveConnectionType effective_connection_type_; |
| 661 | 660 |
| 662 // Forces v8 compilation cache to be disabled (used for inspector tests). | 661 // Forces v8 compilation cache to be disabled (used for inspector tests). |
| 663 bool disable_v8_cache_ = false; | 662 bool disable_v8_cache_ = false; |
| 664 | 663 |
| 665 base::WeakPtrFactory<TestRunner> weak_factory_; | 664 base::WeakPtrFactory<TestRunner> weak_factory_; |
| 666 | 665 |
| 667 DISALLOW_COPY_AND_ASSIGN(TestRunner); | 666 DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 668 }; | 667 }; |
| 669 | 668 |
| 670 } // namespace test_runner | 669 } // namespace test_runner |
| 671 | 670 |
| 672 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ | 671 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| OLD | NEW |