| 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> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "components/test_runner/layout_test_runtime_flags.h" | 18 #include "components/test_runner/layout_test_runtime_flags.h" |
| 19 #include "components/test_runner/test_runner_export.h" | 19 #include "components/test_runner/test_runner_export.h" |
| 20 #include "components/test_runner/web_task.h" | 20 #include "components/test_runner/web_task.h" |
| 21 #include "components/test_runner/web_test_runner.h" | 21 #include "components/test_runner/web_test_runner.h" |
| 22 #include "third_party/WebKit/public/platform/WebImage.h" |
| 22 #include "v8/include/v8.h" | 23 #include "v8/include/v8.h" |
| 23 | 24 |
| 24 class GURL; | 25 class GURL; |
| 25 class SkBitmap; | 26 class SkBitmap; |
| 26 | 27 |
| 27 namespace blink { | 28 namespace blink { |
| 28 class WebContentSettingsClient; | 29 class WebContentSettingsClient; |
| 29 class WebFrame; | 30 class WebFrame; |
| 30 class WebMediaStream; | 31 class WebMediaStream; |
| 31 class WebString; | 32 class WebString; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 bool UseMockTheme() const { return use_mock_theme_; } | 70 bool UseMockTheme() const { return use_mock_theme_; } |
| 70 | 71 |
| 71 void InvokeCallback(scoped_ptr<InvokeCallbackTask> callback); | 72 void InvokeCallback(scoped_ptr<InvokeCallbackTask> callback); |
| 72 | 73 |
| 73 // WebTestRunner implementation. | 74 // WebTestRunner implementation. |
| 74 bool ShouldGeneratePixelResults() override; | 75 bool ShouldGeneratePixelResults() override; |
| 75 bool ShouldDumpAsAudio() const override; | 76 bool ShouldDumpAsAudio() const override; |
| 76 void GetAudioData(std::vector<unsigned char>* buffer_view) const override; | 77 void GetAudioData(std::vector<unsigned char>* buffer_view) const override; |
| 77 bool IsRecursiveLayoutDumpRequested() override; | 78 bool IsRecursiveLayoutDumpRequested() override; |
| 78 std::string DumpLayout(blink::WebLocalFrame* frame) override; | 79 std::string DumpLayout(blink::WebLocalFrame* frame) override; |
| 80 void DumpPixelsAsync( |
| 81 blink::WebView* web_view, |
| 82 const base::Callback<void(const SkBitmap&)>& callback) override; |
| 79 void ReplicateLayoutTestRuntimeFlagsChanges( | 83 void ReplicateLayoutTestRuntimeFlagsChanges( |
| 80 const base::DictionaryValue& changed_values) override; | 84 const base::DictionaryValue& changed_values) override; |
| 81 bool HasCustomTextDump(std::string* custom_text_dump) const override; | 85 bool HasCustomTextDump(std::string* custom_text_dump) const override; |
| 82 bool ShouldDumpBackForwardList() const override; | 86 bool ShouldDumpBackForwardList() const override; |
| 83 blink::WebContentSettingsClient* GetWebContentSettings() const override; | 87 blink::WebContentSettingsClient* GetWebContentSettings() const override; |
| 84 | 88 |
| 85 // Methods used by WebTestProxyBase and WebFrameTestClient. | 89 // Methods used by WebTestProxyBase and WebFrameTestClient. |
| 86 std::string GetAcceptLanguages() const; | 90 std::string GetAcceptLanguages() const; |
| 87 bool shouldStayOnPageAfterHandlingBeforeUnload() const; | 91 bool shouldStayOnPageAfterHandlingBeforeUnload() const; |
| 88 MockScreenOrientationClient* getMockScreenOrientationClient(); | 92 MockScreenOrientationClient* getMockScreenOrientationClient(); |
| 89 MockWebUserMediaClient* getMockWebUserMediaClient(); | 93 MockWebUserMediaClient* getMockWebUserMediaClient(); |
| 90 bool shouldDumpSelectionRect() const; | |
| 91 bool isPrinting() const; | 94 bool isPrinting() const; |
| 92 bool shouldDumpAsTextWithPixelResults(); | 95 bool shouldDumpAsTextWithPixelResults(); |
| 93 bool shouldDumpAsCustomText() const; | 96 bool shouldDumpAsCustomText() const; |
| 94 std:: string customDumpText() const; | 97 std:: string customDumpText() const; |
| 95 void ShowDevTools(const std::string& settings, | 98 void ShowDevTools(const std::string& settings, |
| 96 const std::string& frontend_url); | 99 const std::string& frontend_url); |
| 97 void ClearDevToolsLocalStorage(); | 100 void ClearDevToolsLocalStorage(); |
| 98 void setShouldDumpAsText(bool); | 101 void setShouldDumpAsText(bool); |
| 99 void setShouldDumpAsMarkup(bool); | 102 void setShouldDumpAsMarkup(bool); |
| 100 void setCustomTextOutput(const std::string& text); | 103 void setCustomTextOutput(const std::string& text); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 122 void policyDelegateDone(); | 125 void policyDelegateDone(); |
| 123 bool policyDelegateEnabled() const; | 126 bool policyDelegateEnabled() const; |
| 124 bool policyDelegateIsPermissive() const; | 127 bool policyDelegateIsPermissive() const; |
| 125 bool policyDelegateShouldNotifyDone() const; | 128 bool policyDelegateShouldNotifyDone() const; |
| 126 bool shouldInterceptPostMessage() const; | 129 bool shouldInterceptPostMessage() const; |
| 127 bool shouldDumpResourcePriorities() const; | 130 bool shouldDumpResourcePriorities() const; |
| 128 bool RequestPointerLock(); | 131 bool RequestPointerLock(); |
| 129 void RequestPointerUnlock(); | 132 void RequestPointerUnlock(); |
| 130 bool isPointerLocked(); | 133 bool isPointerLocked(); |
| 131 void setToolTipText(const blink::WebString&); | 134 void setToolTipText(const blink::WebString&); |
| 132 bool shouldDumpDragImage(); | 135 void setDragImage(const blink::WebImage& drag_image); |
| 133 bool shouldDumpNavigationPolicy() const; | 136 bool shouldDumpNavigationPolicy() const; |
| 134 | 137 |
| 135 bool midiAccessorResult(); | 138 bool midiAccessorResult(); |
| 136 | 139 |
| 137 // Methods used by MockColorChooser: | 140 // Methods used by MockColorChooser: |
| 138 void DidOpenChooser(); | 141 void DidOpenChooser(); |
| 139 void DidCloseChooser(); | 142 void DidCloseChooser(); |
| 140 | 143 |
| 141 // A single item in the work queue. | 144 // A single item in the work queue. |
| 142 class WorkItem { | 145 class WorkItem { |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 // changes. It takes no arguments, and ignores any that may be present. | 474 // changes. It takes no arguments, and ignores any that may be present. |
| 472 void DumpResourceRequestPriorities(); | 475 void DumpResourceRequestPriorities(); |
| 473 | 476 |
| 474 // Sets a flag to enable the mock theme. | 477 // Sets a flag to enable the mock theme. |
| 475 void SetUseMockTheme(bool use); | 478 void SetUseMockTheme(bool use); |
| 476 | 479 |
| 477 // Sets a flag that causes the test to be marked as completed when the | 480 // Sets a flag that causes the test to be marked as completed when the |
| 478 // WebFrameClient receives a loadURLExternally() call. | 481 // WebFrameClient receives a loadURLExternally() call. |
| 479 void WaitUntilExternalURLLoad(); | 482 void WaitUntilExternalURLLoad(); |
| 480 | 483 |
| 481 // This function sets a flag which tells the WebTestProxy to dump the drag | 484 // This function sets a flag to dump the drag image when the next drag&drop is |
| 482 // image when the next drag-and-drop is initiated. It is equivalent to | 485 // initiated. It is equivalent to DumpAsTextWithPixelResults but the pixel |
| 483 // DumpAsTextWithPixelResults but the pixel results will be the drag image | 486 // results will be the drag image instead of a snapshot of the page. |
| 484 // instead of a snapshot of the page. | |
| 485 void DumpDragImage(); | 487 void DumpDragImage(); |
| 486 | 488 |
| 487 // Sets a flag that tells the WebTestProxy to dump the default navigation | 489 // Sets a flag that tells the WebTestProxy to dump the default navigation |
| 488 // policy passed to the decidePolicyForNavigation callback. | 490 // policy passed to the decidePolicyForNavigation callback. |
| 489 void DumpNavigationPolicy(); | 491 void DumpNavigationPolicy(); |
| 490 | 492 |
| 491 // Dump current PageImportanceSignals for the page. | 493 // Dump current PageImportanceSignals for the page. |
| 492 void DumpPageImportanceSignals(); | 494 void DumpPageImportanceSignals(); |
| 493 | 495 |
| 494 /////////////////////////////////////////////////////////////////////////// | 496 /////////////////////////////////////////////////////////////////////////// |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 bool dump_window_status_changes_; | 750 bool dump_window_status_changes_; |
| 749 | 751 |
| 750 // If true, the test_shell will output descriptive test for spellcheck | 752 // If true, the test_shell will output descriptive test for spellcheck |
| 751 // execution. | 753 // execution. |
| 752 bool dump_spell_check_callbacks_; | 754 bool dump_spell_check_callbacks_; |
| 753 | 755 |
| 754 // If true, the test_shell will produce a dump of the back forward list as | 756 // If true, the test_shell will produce a dump of the back forward list as |
| 755 // well. | 757 // well. |
| 756 bool dump_back_forward_list_; | 758 bool dump_back_forward_list_; |
| 757 | 759 |
| 758 // If true, the test_shell will draw the bounds of the current selection rect | |
| 759 // taking possible transforms of the selection rect into account. | |
| 760 bool dump_selection_rect_; | |
| 761 | |
| 762 // If true, the test_shell will dump the drag image as pixel results. | |
| 763 bool dump_drag_image_; | |
| 764 | |
| 765 // If true, content_shell will dump the default navigation policy passed to | 760 // If true, content_shell will dump the default navigation policy passed to |
| 766 // WebFrameClient::decidePolicyForNavigation. | 761 // WebFrameClient::decidePolicyForNavigation. |
| 767 bool dump_navigation_policy_; | 762 bool dump_navigation_policy_; |
| 768 | 763 |
| 769 // If true, pixel dump will be produced as a series of 1px-tall, view-wide | 764 // If true, pixel dump will be produced as a series of 1px-tall, view-wide |
| 770 // individual paints over the height of the view. | 765 // individual paints over the height of the view. |
| 771 bool test_repaint_; | 766 bool test_repaint_; |
| 772 | 767 |
| 773 // If true and test_repaint_ is true as well, pixel dump will be produced as | 768 // If true and test_repaint_ is true as well, pixel dump will be produced as |
| 774 // a series of 1px-wide, view-tall paints across the width of the view. | 769 // a series of 1px-wide, view-tall paints across the width of the view. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 PointerLockWillFailSync, | 805 PointerLockWillFailSync, |
| 811 } pointer_lock_planned_result_; | 806 } pointer_lock_planned_result_; |
| 812 bool use_mock_theme_; | 807 bool use_mock_theme_; |
| 813 | 808 |
| 814 scoped_ptr<MockScreenOrientationClient> mock_screen_orientation_client_; | 809 scoped_ptr<MockScreenOrientationClient> mock_screen_orientation_client_; |
| 815 scoped_ptr<MockWebUserMediaClient> user_media_client_; | 810 scoped_ptr<MockWebUserMediaClient> user_media_client_; |
| 816 | 811 |
| 817 // Number of currently active color choosers. | 812 // Number of currently active color choosers. |
| 818 int chooser_count_; | 813 int chooser_count_; |
| 819 | 814 |
| 815 // Captured drag image. |
| 816 blink::WebImage drag_image_; |
| 817 |
| 820 base::WeakPtrFactory<TestRunner> weak_factory_; | 818 base::WeakPtrFactory<TestRunner> weak_factory_; |
| 821 | 819 |
| 822 DISALLOW_COPY_AND_ASSIGN(TestRunner); | 820 DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 823 }; | 821 }; |
| 824 | 822 |
| 825 } // namespace test_runner | 823 } // namespace test_runner |
| 826 | 824 |
| 827 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ | 825 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| OLD | NEW |