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_dump_flags.h" | |
19 #include "components/test_runner/test_runner_export.h" | 18 #include "components/test_runner/test_runner_export.h" |
20 #include "components/test_runner/web_task.h" | 19 #include "components/test_runner/web_task.h" |
21 #include "components/test_runner/web_test_runner.h" | 20 #include "components/test_runner/web_test_runner.h" |
22 #include "v8/include/v8.h" | 21 #include "v8/include/v8.h" |
23 | 22 |
24 class GURL; | 23 class GURL; |
25 class SkBitmap; | 24 class SkBitmap; |
26 | 25 |
27 namespace blink { | 26 namespace blink { |
28 class WebContentSettingsClient; | 27 class WebContentSettingsClient; |
29 class WebFrame; | 28 class WebFrame; |
30 class WebMediaStream; | 29 class WebMediaStream; |
31 class WebString; | 30 class WebString; |
32 class WebView; | 31 class WebView; |
33 class WebURLResponse; | 32 class WebURLResponse; |
34 } | 33 } |
35 | 34 |
36 namespace gin { | 35 namespace gin { |
37 class ArrayBufferView; | 36 class ArrayBufferView; |
38 class Arguments; | 37 class Arguments; |
39 } | 38 } |
40 | 39 |
41 namespace test_runner { | 40 namespace test_runner { |
42 | 41 |
43 class InvokeCallbackTask; | 42 class InvokeCallbackTask; |
44 class TestInterfaces; | 43 class TestInterfaces; |
45 class WebContentSettings; | 44 class WebContentSettings; |
46 class WebTestDelegate; | 45 class WebTestDelegate; |
47 class WebTestProxyBase; | 46 class WebTestProxyBase; |
| 47 struct LayoutDumpFlags; |
48 | 48 |
49 class TestRunner : public WebTestRunner, | 49 class TestRunner : public WebTestRunner, |
50 public base::SupportsWeakPtr<TestRunner> { | 50 public base::SupportsWeakPtr<TestRunner> { |
51 public: | 51 public: |
52 explicit TestRunner(TestInterfaces*); | 52 explicit TestRunner(TestInterfaces*); |
53 virtual ~TestRunner(); | 53 virtual ~TestRunner(); |
54 | 54 |
55 void Install(blink::WebFrame* frame); | 55 void Install(blink::WebFrame* frame); |
56 | 56 |
57 void SetDelegate(WebTestDelegate*); | 57 void SetDelegate(WebTestDelegate*); |
58 void SetWebView(blink::WebView*, WebTestProxyBase*); | 58 void SetWebView(blink::WebView*, WebTestProxyBase*); |
59 | 59 |
60 void Reset(); | |
61 | |
62 WebTaskList* mutable_task_list() { return &task_list_; } | 60 WebTaskList* mutable_task_list() { return &task_list_; } |
63 | 61 |
64 void SetTestIsRunning(bool); | 62 void SetTestIsRunning(bool); |
65 bool TestIsRunning() const { return test_is_running_; } | 63 bool TestIsRunning() const { return test_is_running_; } |
66 | 64 |
67 bool UseMockTheme() const { return use_mock_theme_; } | 65 bool UseMockTheme() const { return use_mock_theme_; } |
68 | 66 |
69 void InvokeCallback(scoped_ptr<InvokeCallbackTask> callback); | 67 void InvokeCallback(scoped_ptr<InvokeCallbackTask> callback); |
70 | 68 |
71 // WebTestRunner implementation. | 69 // WebTestRunner implementation. |
| 70 void SetSharedLayoutDumpFlags( |
| 71 LayoutDumpFlags* shared_layout_dump_flags) override; |
| 72 void Reset() override; |
72 bool ShouldGeneratePixelResults() override; | 73 bool ShouldGeneratePixelResults() override; |
73 bool ShouldStayOnPageAfterHandlingBeforeUnload() const override; | 74 bool ShouldStayOnPageAfterHandlingBeforeUnload() const override; |
74 bool ShouldDumpAsAudio() const override; | 75 bool ShouldDumpAsAudio() const override; |
75 void GetAudioData(std::vector<unsigned char>* buffer_view) const override; | 76 void GetAudioData(std::vector<unsigned char>* buffer_view) const override; |
76 const LayoutDumpFlags& GetLayoutDumpFlags() override; | 77 const LayoutDumpFlags& GetLayoutDumpFlags() override; |
77 bool HasCustomTextDump(std::string* custom_text_dump) const override; | 78 bool HasCustomTextDump(std::string* custom_text_dump) const override; |
78 bool ShouldDumpBackForwardList() const override; | 79 bool ShouldDumpBackForwardList() const override; |
79 blink::WebContentSettingsClient* GetWebContentSettings() const override; | 80 blink::WebContentSettingsClient* GetWebContentSettings() const override; |
80 | 81 |
81 // Methods used by WebTestProxyBase. | 82 // Methods used by WebTestProxyBase. |
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 // page has finished loading. From here, we can generate the dump for the | 647 // page has finished loading. From here, we can generate the dump for the |
647 // test. | 648 // test. |
648 void LocationChangeDone(); | 649 void LocationChangeDone(); |
649 | 650 |
650 // Sets a flag causing the next call to WebGLRenderingContext::create to fail. | 651 // Sets a flag causing the next call to WebGLRenderingContext::create to fail. |
651 void ForceNextWebGLContextCreationToFail(); | 652 void ForceNextWebGLContextCreationToFail(); |
652 | 653 |
653 // Sets a flag causing the next call to DrawingBuffer::create to fail. | 654 // Sets a flag causing the next call to DrawingBuffer::create to fail. |
654 void ForceNextDrawingBufferCreationToFail(); | 655 void ForceNextDrawingBufferCreationToFail(); |
655 | 656 |
| 657 LayoutDumpFlags* layout_dump_flags() { |
| 658 CHECK(layout_dump_flags_); |
| 659 return layout_dump_flags_; |
| 660 } |
| 661 |
| 662 const LayoutDumpFlags* layout_dump_flags() const { |
| 663 CHECK(layout_dump_flags_); |
| 664 return layout_dump_flags_; |
| 665 } |
| 666 |
656 bool test_is_running_; | 667 bool test_is_running_; |
657 | 668 |
658 // When reset is called, go through and close all but the main test shell | 669 // When reset is called, go through and close all but the main test shell |
659 // window. By default, set to true but toggled to false using | 670 // window. By default, set to true but toggled to false using |
660 // setCloseRemainingWindowsWhenComplete(). | 671 // setCloseRemainingWindowsWhenComplete(). |
661 bool close_remaining_windows_; | 672 bool close_remaining_windows_; |
662 | 673 |
663 // If true, don't dump output until notifyDone is called. | |
664 bool wait_until_done_; | |
665 | |
666 // If true, ends the test when a URL is loaded externally via | 674 // If true, ends the test when a URL is loaded externally via |
667 // WebFrameClient::loadURLExternally(). | 675 // WebFrameClient::loadURLExternally(). |
668 bool wait_until_external_url_load_; | 676 bool wait_until_external_url_load_; |
669 | 677 |
670 // Causes navigation actions just printout the intended navigation instead | 678 // Causes navigation actions just printout the intended navigation instead |
671 // of taking you to the page. This is used for cases like mailto, where you | 679 // of taking you to the page. This is used for cases like mailto, where you |
672 // don't actually want to open the mail program. | 680 // don't actually want to open the mail program. |
673 bool policy_delegate_enabled_; | 681 bool policy_delegate_enabled_; |
674 | 682 |
675 // Toggles the behavior of the policy delegate. If true, then navigations | 683 // Toggles the behavior of the policy delegate. If true, then navigations |
(...skipping 20 matching lines...) Expand all Loading... |
696 // Bound variable counting the number of top URLs visited. | 704 // Bound variable counting the number of top URLs visited. |
697 int web_history_item_count_; | 705 int web_history_item_count_; |
698 | 706 |
699 // Bound variable to set whether postMessages should be intercepted or not | 707 // Bound variable to set whether postMessages should be intercepted or not |
700 bool intercept_post_message_; | 708 bool intercept_post_message_; |
701 | 709 |
702 // If true, the test_shell will write a descriptive line for each editing | 710 // If true, the test_shell will write a descriptive line for each editing |
703 // command. | 711 // command. |
704 bool dump_editting_callbacks_; | 712 bool dump_editting_callbacks_; |
705 | 713 |
706 // If true, the test_shell will generate pixel results in DumpAsText mode | |
707 bool generate_pixel_results_; | |
708 | |
709 // Flags controlling what content gets dumped as a layout text result. | 714 // Flags controlling what content gets dumped as a layout text result. |
710 LayoutDumpFlags layout_dump_flags_; | 715 LayoutDumpFlags* layout_dump_flags_; |
711 | 716 |
712 // If true, the test_shell will print out the icon change notifications. | 717 // If true, the test_shell will print out the icon change notifications. |
713 bool dump_icon_changes_; | 718 bool dump_icon_changes_; |
714 | 719 |
715 // If true, the test_shell will output a base64 encoded WAVE file. | 720 // If true, the test_shell will output a base64 encoded WAVE file. |
716 bool dump_as_audio_; | 721 bool dump_as_audio_; |
717 | 722 |
718 // If true, the test_shell will output a descriptive line for each frame | 723 // If true, the test_shell will output a descriptive line for each frame |
719 // load callback. | 724 // load callback. |
720 bool dump_frame_load_callbacks_; | 725 bool dump_frame_load_callbacks_; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 bool use_mock_theme_; | 824 bool use_mock_theme_; |
820 | 825 |
821 base::WeakPtrFactory<TestRunner> weak_factory_; | 826 base::WeakPtrFactory<TestRunner> weak_factory_; |
822 | 827 |
823 DISALLOW_COPY_AND_ASSIGN(TestRunner); | 828 DISALLOW_COPY_AND_ASSIGN(TestRunner); |
824 }; | 829 }; |
825 | 830 |
826 } // namespace test_runner | 831 } // namespace test_runner |
827 | 832 |
828 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ | 833 #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
OLD | NEW |