[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
Scott Violet | fdda96d | 2018-07-27 20:17:23 | [diff] [blame] | 5 | #ifndef CONTENT_SHELL_TEST_RUNNER_TEST_RUNNER_H_ |
| 6 | #define CONTENT_SHELL_TEST_RUNNER_TEST_RUNNER_H_ |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 7 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 10 | #include <memory> |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 11 | #include <set> |
| 12 | #include <string> |
benwells | 0c0d3f1 | 2015-05-25 01:03:17 | [diff] [blame] | 13 | #include <vector> |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 14 | |
Brett Wilson | cc8623d | 2017-09-12 03:28:10 | [diff] [blame] | 15 | #include "base/containers/circular_deque.h" |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 16 | #include "base/macros.h" |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 17 | #include "base/memory/weak_ptr.h" |
Peter Beverloo | 988ef96 | 2017-09-12 15:49:17 | [diff] [blame] | 18 | #include "base/optional.h" |
| 19 | #include "base/strings/string16.h" |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 20 | #include "content/shell/test_runner/mock_screen_orientation_client.h" |
Scott Violet | fdda96d | 2018-07-27 20:17:23 | [diff] [blame] | 21 | #include "content/shell/test_runner/test_runner_export.h" |
| 22 | #include "content/shell/test_runner/web_test_runner.h" |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 23 | #include "content/shell/test_runner/web_test_runtime_flags.h" |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame] | 24 | #include "third_party/blink/public/platform/web_effective_connection_type.h" |
Fredrik Söderquist | b2b39eb9 | 2019-11-18 16:16:50 | [diff] [blame] | 25 | #include "third_party/skia/include/core/SkBitmap.h" |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 26 | #include "v8/include/v8.h" |
| 27 | |
[email protected] | 945babb | 2014-07-30 14:25:32 | [diff] [blame] | 28 | class GURL; |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 29 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 30 | namespace blink { |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 31 | class WebContentSettingsClient; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 32 | class WebFrame; |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 33 | class WebLocalFrame; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 34 | class WebString; |
| 35 | class WebView; |
Scott Violet | fdda96d | 2018-07-27 20:17:23 | [diff] [blame] | 36 | } |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 37 | |
| 38 | namespace gin { |
| 39 | class ArrayBufferView; |
| 40 | class Arguments; |
Scott Violet | fdda96d | 2018-07-27 20:17:23 | [diff] [blame] | 41 | } |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 42 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 43 | namespace test_runner { |
lukasza | 2135323 | 2016-04-12 19:52:11 | [diff] [blame] | 44 | class MockContentSettingsClient; |
lukasza | 6a113ae1 | 2016-03-17 22:41:20 | [diff] [blame] | 45 | class MockScreenOrientationClient; |
lukasza | 5c2279c | 2016-04-05 16:44:47 | [diff] [blame] | 46 | class SpellCheckClient; |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 47 | class TestInterfaces; |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 48 | class TestRunnerForSpecificView; |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 49 | class WebTestDelegate; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 50 | |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 51 | // TestRunner class currently has dual purpose: |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 52 | // 1. It implements TestRunner javascript bindings for "global" / "ambient". |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 53 | // Examples: |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 54 | // - TestRunner.DumpAsText (test flag affecting test behavior) |
| 55 | // - TestRunner.SetAllowRunningOfInsecureContent (test flag affecting product |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 56 | // behavior) |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 57 | // - TestRunner.SetTextSubpixelPositioning (directly interacts with product). |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 58 | // Note that "per-view" (non-"global") bindings are handled by |
| 59 | // instances of TestRunnerForSpecificView class. |
| 60 | // 2. It manages global test state. Example: |
| 61 | // - Tracking topLoadingFrame that can finish the test when it loads. |
| 62 | // - WorkQueue holding load requests from the TestInterfaces |
Kent Tamura | 21d1de6 | 2018-12-10 04:45:20 | [diff] [blame] | 63 | // - WebTestRuntimeFlags |
lukasza | c935882 | 2016-04-07 14:43:46 | [diff] [blame] | 64 | class TestRunner : public WebTestRunner { |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 65 | public: |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 66 | explicit TestRunner(TestInterfaces*); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 67 | virtual ~TestRunner(); |
| 68 | |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 69 | void Install(blink::WebLocalFrame* frame, |
| 70 | base::WeakPtr<TestRunnerForSpecificView> view_test_runner); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 71 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 72 | void SetDelegate(WebTestDelegate*); |
lukasza | 8973c52 | 2016-04-27 16:32:28 | [diff] [blame] | 73 | void SetMainView(blink::WebView*); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 74 | |
| 75 | void Reset(); |
| 76 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 77 | void SetTestIsRunning(bool); |
| 78 | bool TestIsRunning() const { return test_is_running_; } |
| 79 | |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 80 | // Finishes the test if it is ready. This should be called before running |
| 81 | // tasks that will change state, so that the test can capture the current |
| 82 | // state. Specifically, should run before the BeginMainFrame step which does |
| 83 | // layout and animation etc. |
| 84 | // This does *not* run as part of loading finishing because that happens in |
| 85 | // the middle of blink call stacks that have inconsistent state. |
| 86 | void FinishTestIfReady(); |
| 87 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 88 | // WebTestRunner implementation. |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 89 | bool ShouldGeneratePixelResults() override; |
| 90 | bool ShouldDumpAsAudio() const override; |
| 91 | void GetAudioData(std::vector<unsigned char>* buffer_view) const override; |
lukasza | ef264fc5 | 2016-03-17 22:49:19 | [diff] [blame] | 92 | bool IsRecursiveLayoutDumpRequested() override; |
| 93 | std::string DumpLayout(blink::WebLocalFrame* frame) override; |
Mason Freed | 75453ec | 2018-08-27 17:11:23 | [diff] [blame] | 94 | bool ShouldDumpSelectionRect() const override; |
danakj | e73c9cd | 2019-04-16 16:29:33 | [diff] [blame] | 95 | bool CanDumpPixelsFromRenderer() const override; |
| 96 | void DumpPixelsAsync( |
danakj | da15621e | 2019-04-05 20:34:43 | [diff] [blame] | 97 | content::RenderView* render_view, |
lukasza | 20971a6 | 2017-07-12 01:31:27 | [diff] [blame] | 98 | base::OnceCallback<void(const SkBitmap&)> callback) override; |
Kent Tamura | 679c7c4 | 2018-12-05 03:21:10 | [diff] [blame] | 99 | void ReplicateWebTestRuntimeFlagsChanges( |
lukasza | c9cbe71 | 2016-03-14 14:06:43 | [diff] [blame] | 100 | const base::DictionaryValue& changed_values) override; |
lukasza | a896046 | 2016-01-27 22:27:33 | [diff] [blame] | 101 | bool HasCustomTextDump(std::string* custom_text_dump) const override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 102 | bool ShouldDumpBackForwardList() const override; |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 103 | blink::WebContentSettingsClient* GetWebContentSettings() const override; |
xiaochengh | 81bfb1741 | 2017-04-06 17:54:33 | [diff] [blame] | 104 | blink::WebTextCheckClient* GetWebTextCheckClient() const override; |
lukasza | 95416be14 | 2016-04-14 15:06:33 | [diff] [blame] | 105 | void SetFocus(blink::WebView* web_view, bool focus) override; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 106 | |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 107 | // Methods used by WebViewTestClient and WebFrameTestClient. |
lukasza | a0b624a | 2016-04-04 15:00:49 | [diff] [blame] | 108 | std::string GetAcceptLanguages() const; |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 109 | bool ShouldStayOnPageAfterHandlingBeforeUnload() const; |
| 110 | MockScreenOrientationClient* GetMockScreenOrientationClient(); |
| 111 | bool ShouldDumpAsCustomText() const; |
| 112 | std::string CustomDumpText() const; |
abhishek.a21 | ca9b560 | 2014-09-19 07:33:33 | [diff] [blame] | 113 | void ShowDevTools(const std::string& settings, |
[email protected] | 06c25301 | 2014-04-16 18:35:33 | [diff] [blame] | 114 | const std::string& frontend_url); |
pfeldman | 4c4133d | 2016-12-20 02:40:21 | [diff] [blame] | 115 | void SetV8CacheDisabled(bool); |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 116 | void SetShouldDumpAsText(bool); |
| 117 | void SetShouldDumpAsMarkup(bool); |
| 118 | void SetShouldDumpAsLayout(bool); |
| 119 | void SetCustomTextOutput(const std::string& text); |
| 120 | void SetShouldGeneratePixelResults(bool); |
| 121 | void SetShouldDumpFrameLoadCallbacks(bool); |
| 122 | void SetShouldEnableViewSource(bool); |
| 123 | bool ShouldDumpEditingCallbacks() const; |
| 124 | bool ShouldDumpFrameLoadCallbacks() const; |
| 125 | bool ShouldDumpPingLoaderCallbacks() const; |
| 126 | bool ShouldDumpUserGestureInFrameLoadCallbacks() const; |
| 127 | bool ShouldDumpTitleChanges() const; |
| 128 | bool ShouldDumpIconChanges() const; |
| 129 | bool ShouldDumpCreateView() const; |
| 130 | bool CanOpenWindows() const; |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 131 | bool ShouldDumpSpellCheckCallbacks() const; |
| 132 | bool ShouldWaitUntilExternalURLLoad() const; |
| 133 | const std::set<std::string>* HttpHeadersToClear() const; |
Dominic Farolino | aee9c1b8 | 2019-12-18 03:20:10 | [diff] [blame^] | 134 | bool ClearReferrer() const; |
tkent | 2edc979d | 2016-05-27 04:58:25 | [diff] [blame] | 135 | bool is_web_platform_tests_mode() const { |
| 136 | return is_web_platform_tests_mode_; |
| 137 | } |
| 138 | void set_is_web_platform_tests_mode() { is_web_platform_tests_mode_ = true; } |
Mason Freed | b085562 | 2018-10-02 17:49:47 | [diff] [blame] | 139 | bool animation_requires_raster() const { return animation_requires_raster_; } |
| 140 | void SetAnimationRequiresRaster(bool do_raster); |
lukasza | 10cd876 | 2016-04-27 20:03:02 | [diff] [blame] | 141 | |
arthursonzogni | d409c25 | 2019-03-14 09:22:22 | [diff] [blame] | 142 | // Add |frame| to the set of loading frames. |
| 143 | // |
| 144 | // Note: Only one renderer process is really tracking the loading frames. This |
| 145 | // is the first to observe one. Both local and remote frames are tracked |
| 146 | // by this process. |
| 147 | void AddLoadingFrame(blink::WebFrame* frame); |
lukasza | 10cd876 | 2016-04-27 20:03:02 | [diff] [blame] | 148 | |
arthursonzogni | d409c25 | 2019-03-14 09:22:22 | [diff] [blame] | 149 | // Remove |frame| from the set of loading frames. |
| 150 | // |
| 151 | // When there are no more loading frames, this potentially finishes the test, |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 152 | // unless TestRunner.WaitUntilDone() was called and/or there are pending load |
arthursonzogni | d409c25 | 2019-03-14 09:22:22 | [diff] [blame] | 153 | // requests in WorkQueue. |
| 154 | void RemoveLoadingFrame(blink::WebFrame* frame); |
lukasza | 10cd876 | 2016-04-27 20:03:02 | [diff] [blame] | 155 | |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 156 | blink::WebFrame* MainFrame() const; |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 157 | void PolicyDelegateDone(); |
| 158 | bool PolicyDelegateEnabled() const; |
| 159 | bool PolicyDelegateIsPermissive() const; |
| 160 | bool PolicyDelegateShouldNotifyDone() const; |
| 161 | void SetToolTipText(const blink::WebString&); |
| 162 | void SetDragImage(const SkBitmap& drag_image); |
| 163 | bool ShouldDumpNavigationPolicy() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 164 | |
caseq | cb222783 | 2016-05-24 18:52:04 | [diff] [blame] | 165 | bool ShouldDumpConsoleMessages() const; |
Yoichi Osato | ebf845ac7 | 2018-08-30 08:13:50 | [diff] [blame] | 166 | // Controls whether console messages produced by the page are dumped |
| 167 | // to test output. |
| 168 | void SetDumpConsoleMessages(bool value); |
| 169 | |
tkent | 217ff885 | 2016-11-14 04:43:49 | [diff] [blame] | 170 | bool ShouldDumpJavaScriptDialogs() const; |
caseq | cb222783 | 2016-05-24 18:52:04 | [diff] [blame] | 171 | |
jkarlin | 3bddb7d | 2016-09-21 18:44:16 | [diff] [blame] | 172 | blink::WebEffectiveConnectionType effective_connection_type() const { |
| 173 | return effective_connection_type_; |
| 174 | } |
| 175 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 176 | // A single item in the work queue. |
| 177 | class WorkItem { |
| 178 | public: |
| 179 | virtual ~WorkItem() {} |
| 180 | |
| 181 | // Returns true if this started a load. |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 182 | virtual bool Run(WebTestDelegate*, blink::WebView*) = 0; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 183 | }; |
| 184 | |
| 185 | private: |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 186 | friend class TestRunnerBindings; |
| 187 | friend class WorkQueue; |
| 188 | |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 189 | // Helper class for managing events queued by methods like QueueLoad or |
| 190 | // QueueScript. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 191 | class WorkQueue { |
| 192 | public: |
| 193 | explicit WorkQueue(TestRunner* controller); |
| 194 | virtual ~WorkQueue(); |
| 195 | void ProcessWorkSoon(); |
| 196 | |
| 197 | // Reset the state of the class between tests. |
| 198 | void Reset(); |
| 199 | |
| 200 | void AddWork(WorkItem*); |
| 201 | |
| 202 | void set_frozen(bool frozen) { frozen_ = frozen; } |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 203 | bool is_empty() const { return queue_.empty(); } |
| 204 | |
| 205 | void set_finished_loading() { finished_loading_ = true; } |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 206 | |
| 207 | private: |
| 208 | void ProcessWork(); |
| 209 | |
Brett Wilson | cc8623d | 2017-09-12 03:28:10 | [diff] [blame] | 210 | base::circular_deque<WorkItem*> queue_; |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 211 | bool frozen_ = false; |
| 212 | bool finished_loading_ = false; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 213 | TestRunner* controller_; |
lukasza | c935882 | 2016-04-07 14:43:46 | [diff] [blame] | 214 | |
Jeremy Roman | 3bca4bf | 2019-07-11 03:41:25 | [diff] [blame] | 215 | base::WeakPtrFactory<WorkQueue> weak_factory_{this}; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 216 | }; |
| 217 | |
| 218 | /////////////////////////////////////////////////////////////////////////// |
| 219 | // Methods dealing with the test logic |
| 220 | |
| 221 | // By default, tests end when page load is complete. These methods are used |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 222 | // to delay the completion of the test until NotifyDone is called. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 223 | void NotifyDone(); |
| 224 | void WaitUntilDone(); |
| 225 | |
| 226 | // Methods for adding actions to the work queue. Used in conjunction with |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 227 | // WaitUntilDone/NotifyDone above. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 228 | void QueueBackNavigation(int how_far_back); |
| 229 | void QueueForwardNavigation(int how_far_forward); |
| 230 | void QueueReload(); |
| 231 | void QueueLoadingScript(const std::string& script); |
| 232 | void QueueNonLoadingScript(const std::string& script); |
| 233 | void QueueLoad(const std::string& url, const std::string& target); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 234 | |
| 235 | // Causes navigation actions just printout the intended navigation instead |
| 236 | // of taking you to the page. This is used for cases like mailto, where you |
| 237 | // don't actually want to open the mail program. |
| 238 | void SetCustomPolicyDelegate(gin::Arguments* args); |
| 239 | |
| 240 | // Delays completion of the test until the policy delegate runs. |
| 241 | void WaitForPolicyDelegate(); |
| 242 | |
| 243 | // Functions for dealing with windows. By default we block all new windows. |
| 244 | int WindowCount(); |
| 245 | void SetCloseRemainingWindowsWhenComplete(bool close_remaining_windows); |
| 246 | void ResetTestHelperControllers(); |
| 247 | |
Kent Tamura | 21d1de6 | 2018-12-10 04:45:20 | [diff] [blame] | 248 | // Allows web tests to manage origins' allow list. |
Takashi Toyoshima | 66e7d0d | 2018-08-28 09:20:10 | [diff] [blame] | 249 | void AddOriginAccessAllowListEntry(const std::string& source_origin, |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 250 | const std::string& destination_protocol, |
| 251 | const std::string& destination_host, |
| 252 | bool allow_destination_subdomains); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 253 | |
dcheng | 9000dbd | 2015-04-03 05:39:40 | [diff] [blame] | 254 | // Add |source_code| as an injected stylesheet to the active document of the |
| 255 | // window of the current V8 context. |
| 256 | void InsertStyleSheet(const std::string& source_code); |
| 257 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 258 | // Enables or disables subpixel positioning (i.e. fractional X positions for |
| 259 | // glyphs) in text rendering on Linux. Since this method changes global |
| 260 | // settings, tests that call it must use their own custom font family for |
| 261 | // all text that they render. If not, an already-cached style will be used, |
| 262 | // resulting in the changed setting being ignored. |
| 263 | void SetTextSubpixelPositioning(bool value); |
| 264 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 265 | // After this function is called, all window-sizing machinery is |
| 266 | // short-circuited inside the renderer. This mode is necessary for |
| 267 | // some tests that were written before browsers had multi-process architecture |
| 268 | // and rely on window resizes to happen synchronously. |
| 269 | // The function has "unfortunate" it its name because we must strive to remove |
| 270 | // all tests that rely on this... well, unfortunate behavior. See |
| 271 | // http://crbug.com/309760 for the plan. |
| 272 | void UseUnfortunateSynchronousResizeMode(); |
| 273 | |
danakj | 83388a3 | 2019-09-11 16:28:31 | [diff] [blame] | 274 | void EnableAutoResizeMode(int min_width, |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 275 | int min_height, |
| 276 | int max_width, |
| 277 | int max_height); |
danakj | 83388a3 | 2019-09-11 16:28:31 | [diff] [blame] | 278 | void DisableAutoResizeMode(int new_width, int new_height); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 279 | |
[email protected] | e0bc2cb | 2014-03-20 17:34:24 | [diff] [blame] | 280 | void SetMockScreenOrientation(const std::string& orientation); |
dgozman | 3c16f7f | 2016-02-26 01:21:18 | [diff] [blame] | 281 | void DisableMockScreenOrientation(); |
[email protected] | e0bc2cb | 2014-03-20 17:34:24 | [diff] [blame] | 282 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 283 | /////////////////////////////////////////////////////////////////////////// |
| 284 | // Methods modifying WebPreferences. |
| 285 | |
| 286 | // Set the WebPreference that controls webkit's popup blocking. |
| 287 | void SetPopupBlockingEnabled(bool block_popups); |
| 288 | |
| 289 | void SetJavaScriptCanAccessClipboard(bool can_access); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 290 | void SetAllowFileAccessFromFileURLs(bool allow); |
Dan Elphick | 382a596 | 2018-07-27 13:34:04 | [diff] [blame] | 291 | void OverridePreference(gin::Arguments* arguments); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 292 | |
Leon Han | c819dc6 | 2019-01-28 04:30:19 | [diff] [blame] | 293 | // Modify accept_languages in blink::mojom::RendererPreferences. |
[email protected] | ebd5ea5 | 2014-05-28 14:51:15 | [diff] [blame] | 294 | void SetAcceptLanguages(const std::string& accept_languages); |
| 295 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 296 | // Enable or disable plugins. |
| 297 | void SetPluginsEnabled(bool enabled); |
| 298 | |
| 299 | /////////////////////////////////////////////////////////////////////////// |
| 300 | // Methods that modify the state of TestRunner |
| 301 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 302 | // This function sets a flag that tells the test runner to print a line of |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 303 | // descriptive text for each editing command. It takes no arguments, and |
| 304 | // ignores any that may be present. |
| 305 | void DumpEditingCallbacks(); |
| 306 | |
Xianzhu Wang | 6e84f099 | 2018-10-23 23:07:55 | [diff] [blame] | 307 | // This function sets a flag that tells the test runner to dump pages as |
| 308 | // plain text. The pixel results will not be generated for this test. |
| 309 | // It has higher priority than DumpAsMarkup() and DumpAsLayout(). |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 310 | void DumpAsText(); |
| 311 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 312 | // This function sets a flag that tells the test runner to dump pages as |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 313 | // the DOM contents, rather than as a text representation of the renderer's |
Xianzhu Wang | 6e84f099 | 2018-10-23 23:07:55 | [diff] [blame] | 314 | // state. The pixel results will not be generated for this test. It has |
| 315 | // higher priority than DumpAsLayout(), but lower than DumpAsText(). |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 316 | void DumpAsMarkup(); |
| 317 | |
Xianzhu Wang | 6e84f099 | 2018-10-23 23:07:55 | [diff] [blame] | 318 | // This function sets a flag that tells the test runner to dump pages as |
| 319 | // plain text. It will also generate a pixel dump for the test. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 320 | void DumpAsTextWithPixelResults(); |
| 321 | |
Xianzhu Wang | 6e84f099 | 2018-10-23 23:07:55 | [diff] [blame] | 322 | // This function sets a flag that tells the test runner to dump pages as |
| 323 | // text representation of the layout. The pixel results will not be generated |
| 324 | // for this test. It has lower priority than DumpAsText() and DumpAsMarkup(). |
| 325 | void DumpAsLayout(); |
| 326 | |
| 327 | // This function sets a flag that tells the test runner to dump pages as |
| 328 | // text representation of the layout. It will also generate a pixel dump for |
| 329 | // the test. |
| 330 | void DumpAsLayoutWithPixelResults(); |
| 331 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 332 | // This function sets a flag that tells the test runner to recursively dump |
Xianzhu Wang | 6e84f099 | 2018-10-23 23:07:55 | [diff] [blame] | 333 | // all frames as text, markup or layout depending on which of DumpAsText, |
| 334 | // DumpAsMarkup and DumpAsLayout is effective. |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 335 | void DumpChildFrames(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 336 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 337 | // This function sets a flag that tells the test runner to print out the |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 338 | // information about icon changes notifications from WebKit. |
| 339 | void DumpIconChanges(); |
| 340 | |
| 341 | // Deals with Web Audio WAV file data. |
| 342 | void SetAudioData(const gin::ArrayBufferView& view); |
| 343 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 344 | // This function sets a flag that tells the test runner to print a line of |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 345 | // descriptive text for each frame load callback. It takes no arguments, and |
| 346 | // ignores any that may be present. |
| 347 | void DumpFrameLoadCallbacks(); |
| 348 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 349 | // This function sets a flag that tells the test runner to print a line of |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 350 | // descriptive text for each PingLoader dispatch. It takes no arguments, and |
| 351 | // ignores any that may be present. |
| 352 | void DumpPingLoaderCallbacks(); |
| 353 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 354 | // This function sets a flag that tells the test runner to print a line of |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 355 | // user gesture status text for some frame load callbacks. It takes no |
| 356 | // arguments, and ignores any that may be present. |
| 357 | void DumpUserGestureInFrameLoadCallbacks(); |
| 358 | |
| 359 | void DumpTitleChanges(); |
| 360 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 361 | // This function sets a flag that tells the test runner to dump all calls to |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 362 | // WebViewClient::createView(). |
| 363 | // It takes no arguments, and ignores any that may be present. |
| 364 | void DumpCreateView(); |
| 365 | |
| 366 | void SetCanOpenWindows(); |
| 367 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 368 | // This function sets a flag that tells the test runner to dump the MIME type |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 369 | // for each resource that was loaded. It takes no arguments, and ignores any |
| 370 | // that may be present. |
| 371 | void DumpResourceResponseMIMETypes(); |
| 372 | |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 373 | // WebContentSettingsClient related. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 374 | void SetImagesAllowed(bool allowed); |
| 375 | void SetScriptsAllowed(bool allowed); |
| 376 | void SetStorageAllowed(bool allowed); |
| 377 | void SetPluginsAllowed(bool allowed); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 378 | void SetAllowRunningOfInsecureContent(bool allowed); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 379 | void DumpPermissionClientCallbacks(); |
| 380 | |
engedy | 9ae0424 | 2016-06-08 13:31:18 | [diff] [blame] | 381 | // Sets up a mock DocumentSubresourceFilter to disallow subsequent subresource |
| 382 | // loads within the current document with the given path |suffixes|. The |
| 383 | // filter is created and injected even if |suffixes| is empty. If |suffixes| |
John Delaney | 096b7a7 | 2019-01-18 18:43:24 | [diff] [blame] | 384 | // contains the empty string, all subresource loads will be disallowed. If |
| 385 | // |block_subresources| is false, matching resources will not be blocked but |
| 386 | // instead marked as matching a disallowed resource. |
engedy | 9ae0424 | 2016-06-08 13:31:18 | [diff] [blame] | 387 | void SetDisallowedSubresourcePathSuffixes( |
John Delaney | 096b7a7 | 2019-01-18 18:43:24 | [diff] [blame] | 388 | const std::vector<std::string>& suffixes, |
| 389 | bool block_subresources); |
engedy | 9ae0424 | 2016-06-08 13:31:18 | [diff] [blame] | 390 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 391 | // This function sets a flag that tells the test runner to dump all |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 392 | // the lines of descriptive text about spellcheck execution. |
| 393 | void DumpSpellCheckCallbacks(); |
| 394 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 395 | // This function sets a flag that tells the test runner to print out a text |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 396 | // representation of the back/forward list. It ignores all arguments. |
| 397 | void DumpBackForwardList(); |
| 398 | |
| 399 | void DumpSelectionRect(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 400 | |
| 401 | // Causes layout to happen as if targetted to printed pages. |
| 402 | void SetPrinting(); |
Xianzhu Wang | dbb84fc | 2018-02-03 00:33:35 | [diff] [blame] | 403 | void SetPrintingForFrame(const std::string& frame_name); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 404 | |
[email protected] | 5284610 | 2014-06-24 04:26:44 | [diff] [blame] | 405 | // Clears the state from SetPrinting(). |
| 406 | void ClearPrinting(); |
| 407 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 408 | void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); |
| 409 | |
| 410 | // Causes WillSendRequest to clear certain headers. |
Dominic Farolino | aee9c1b8 | 2019-12-18 03:20:10 | [diff] [blame^] | 411 | // Note: This cannot be used to clear the request's `Referer` header, as this |
| 412 | // header is computed later given its referrer string member. To clear it, use |
| 413 | // SetWillSendRequestClearReferrer() below. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 414 | void SetWillSendRequestClearHeader(const std::string& header); |
| 415 | |
Dominic Farolino | aee9c1b8 | 2019-12-18 03:20:10 | [diff] [blame^] | 416 | // Causes WillSendRequest to clear the request's referrer string and set its |
| 417 | // referrer policy to the default. |
| 418 | void SetWillSendRequestClearReferrer(); |
| 419 | |
[email protected] | a79cb991 | 2014-04-26 22:07:33 | [diff] [blame] | 420 | // Sets a flag that causes the test to be marked as completed when the |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 421 | // WebLocalFrameClient receives a LoadURLExternally() call. |
[email protected] | a79cb991 | 2014-04-26 22:07:33 | [diff] [blame] | 422 | void WaitUntilExternalURLLoad(); |
| 423 | |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 424 | // This function sets a flag to dump the drag image when the next drag&drop is |
| 425 | // initiated. It is equivalent to DumpAsTextWithPixelResults but the pixel |
| 426 | // results will be the drag image instead of a snapshot of the page. |
jackhou | 656fc85 | 2015-02-13 09:04:17 | [diff] [blame] | 427 | void DumpDragImage(); |
| 428 | |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 429 | // Sets a flag that tells the WebViewTestProxy to dump the default navigation |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 430 | // policy passed to the DecidePolicyForNavigation callback. |
jochen | c3a98da1 | 2015-03-10 13:59:58 | [diff] [blame] | 431 | void DumpNavigationPolicy(); |
| 432 | |
tkent | 217ff885 | 2016-11-14 04:43:49 | [diff] [blame] | 433 | // Controls whether JavaScript dialogs such as alert() are dumped to test |
| 434 | // output. |
| 435 | void SetDumpJavaScriptDialogs(bool value); |
| 436 | |
jkarlin | 3bddb7d | 2016-09-21 18:44:16 | [diff] [blame] | 437 | // Overrides the NetworkQualityEstimator's estimated network type. If |type| |
| 438 | // is TypeUnknown the NQE's value is used. Be sure to call this with |
| 439 | // TypeUnknown at the end of your test if you use this. |
| 440 | void SetEffectiveConnectionType( |
| 441 | blink::WebEffectiveConnectionType connection_type); |
| 442 | |
xiaochengh | 2fa3e76 | 2016-08-24 11:27:04 | [diff] [blame] | 443 | // Controls whether the mock spell checker is enabled. |
| 444 | void SetMockSpellCheckerEnabled(bool enabled); |
| 445 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 446 | /////////////////////////////////////////////////////////////////////////// |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 447 | // Methods interacting with the WebViewTestProxy |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 448 | |
| 449 | /////////////////////////////////////////////////////////////////////////// |
| 450 | // Methods forwarding to the WebTestDelegate |
| 451 | |
| 452 | // Shows DevTools window. |
[email protected] | 06c25301 | 2014-04-16 18:35:33 | [diff] [blame] | 453 | void ShowWebInspector(const std::string& str, |
| 454 | const std::string& frontend_url); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 455 | void CloseWebInspector(); |
| 456 | |
Will Chen | 8bbdf20f | 2017-12-12 21:09:54 | [diff] [blame] | 457 | void NavigateSecondaryWindow(const GURL& url); |
| 458 | void InspectSecondaryWindow(); |
| 459 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 460 | // Inspect chooser state |
| 461 | bool IsChooserShown(); |
| 462 | |
Kent Tamura | 21d1de6 | 2018-12-10 04:45:20 | [diff] [blame] | 463 | // Allows web tests to exec scripts at WebInspector side. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 464 | void EvaluateInWebInspector(int call_id, const std::string& script); |
| 465 | |
| 466 | // Clears all databases. |
| 467 | void ClearAllDatabases(); |
| 468 | // Sets the default quota for all origins |
| 469 | void SetDatabaseQuota(int quota); |
| 470 | |
tyoshino | a6b9146 | 2016-07-11 09:15:09 | [diff] [blame] | 471 | // Sets the cookie policy to: |
| 472 | // - allow all cookies when |block| is false |
| 473 | // - block only third-party cookies when |block| is true |
| 474 | void SetBlockThirdPartyCookies(bool block); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 475 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 476 | // Converts a URL starting with file:///tmp/ to the local mapping. |
| 477 | std::string PathToLocalResource(const std::string& path); |
| 478 | |
mlamouri | d5098d0 | 2015-04-21 12:17:30 | [diff] [blame] | 479 | // Sets the permission's |name| to |value| for a given {origin, embedder} |
| 480 | // tuple. |
| 481 | void SetPermission(const std::string& name, |
| 482 | const std::string& value, |
| 483 | const GURL& origin, |
| 484 | const GURL& embedding_origin); |
| 485 | |
dominickn | 09f7b57 | 2016-10-28 01:44:15 | [diff] [blame] | 486 | // Resolve the in-flight beforeinstallprompt event. |
| 487 | void ResolveBeforeInstallPromptPromise(const std::string& platform); |
benwells | 0c0d3f1 | 2015-05-25 01:03:17 | [diff] [blame] | 488 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 489 | // Calls setlocale(LC_ALL, ...) for a specified locale. |
| 490 | // Resets between tests. |
| 491 | void SetPOSIXLocale(const std::string& locale); |
| 492 | |
peter | d98157d | 2014-11-20 13:15:01 | [diff] [blame] | 493 | // Simulates a click on a Web Notification. |
Peter Beverloo | 988ef96 | 2017-09-12 15:49:17 | [diff] [blame] | 494 | void SimulateWebNotificationClick( |
| 495 | const std::string& title, |
| 496 | const base::Optional<int>& action_index, |
| 497 | const base::Optional<base::string16>& reply); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 498 | |
nsatragno | 24bd34b | 2016-02-09 10:30:02 | [diff] [blame] | 499 | // Simulates closing a Web Notification. |
| 500 | void SimulateWebNotificationClose(const std::string& title, bool by_user); |
| 501 | |
Rayan Kanso | b7bef39 | 2019-07-25 12:32:36 | [diff] [blame] | 502 | // Simulates a user deleting a content index entry. |
| 503 | void SimulateWebContentIndexDelete(const std::string& id); |
| 504 | |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 505 | // Takes care of notifying the delegate after a change to web test runtime |
lukasza | 083b4f1 | 2016-03-24 16:51:43 | [diff] [blame] | 506 | // flags. |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 507 | void OnWebTestRuntimeFlagsChanged(); |
lukasza | c9cbe71 | 2016-03-14 14:06:43 | [diff] [blame] | 508 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 509 | /////////////////////////////////////////////////////////////////////////// |
| 510 | // Internal helpers |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 511 | |
lukasza | 10cd876 | 2016-04-27 20:03:02 | [diff] [blame] | 512 | bool IsFramePartOfMainTestWindow(blink::WebFrame*) const; |
| 513 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 514 | void CheckResponseMimeType(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 515 | |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 516 | bool test_is_running_ = false; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 517 | |
| 518 | // When reset is called, go through and close all but the main test shell |
| 519 | // window. By default, set to true but toggled to false using |
danakj | 2d792165 | 2019-09-11 17:20:12 | [diff] [blame] | 520 | // SetCloseRemainingWindowsWhenComplete(). |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 521 | bool close_remaining_windows_ = false; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 522 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 523 | WorkQueue work_queue_; |
| 524 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 525 | // Bound variable to return the name of this platform (chromium). |
| 526 | std::string platform_name_; |
| 527 | |
| 528 | // Bound variable to store the last tooltip text |
| 529 | std::string tooltip_text_; |
| 530 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 531 | // Bound variable counting the number of top URLs visited. |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 532 | int web_history_item_count_ = 0; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 533 | |
lukasza | 9b9d70e | 2016-02-25 23:45:44 | [diff] [blame] | 534 | // Flags controlling what content gets dumped as a layout text result. |
Kent Tamura | 2eab5b1 | 2018-12-07 04:31:23 | [diff] [blame] | 535 | WebTestRuntimeFlags web_test_runtime_flags_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 536 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 537 | // If true, the test runner will output a base64 encoded WAVE file. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 538 | bool dump_as_audio_; |
| 539 | |
Xianzhu Wang | 8d64fc3 | 2018-10-15 02:26:53 | [diff] [blame] | 540 | // If true, the test runner will produce a dump of the back forward list as |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 541 | // well. |
| 542 | bool dump_back_forward_list_; |
| 543 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 544 | // If true, pixel dump will be produced as a series of 1px-tall, view-wide |
| 545 | // individual paints over the height of the view. |
| 546 | bool test_repaint_; |
| 547 | |
| 548 | // If true and test_repaint_ is true as well, pixel dump will be produced as |
| 549 | // a series of 1px-wide, view-tall paints across the width of the view. |
| 550 | bool sweep_horizontally_; |
| 551 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 552 | std::set<std::string> http_headers_to_clear_; |
Dominic Farolino | aee9c1b8 | 2019-12-18 03:20:10 | [diff] [blame^] | 553 | bool clear_referrer_ = false; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 554 | |
| 555 | // WAV audio data is stored here. |
| 556 | std::vector<unsigned char> audio_data_; |
| 557 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 558 | TestInterfaces* test_interfaces_; |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 559 | WebTestDelegate* delegate_ = nullptr; |
| 560 | blink::WebView* main_view_ = nullptr; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 561 | |
arthursonzogni | d409c25 | 2019-03-14 09:22:22 | [diff] [blame] | 562 | // This is non empty when a load is in progress. |
| 563 | std::vector<blink::WebFrame*> loading_frames_; |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 564 | // When a loading task is started, this bool is set until all loading_frames_ |
| 565 | // are completed and removed. This bool becomes true earlier than |
| 566 | // loading_frames_ becomes non-empty. Starts as true for the initial load |
| 567 | // which does not come from the WorkQueue. |
| 568 | bool running_load_ = true; |
| 569 | // When NotifyDone() occurs, if loading is still working, it is delayed, and |
| 570 | // this bool tracks that NotifyDone() was called. This differentiates from a |
| 571 | // test that was not waiting for NotifyDone() at all. |
| 572 | bool did_notify_done_ = false; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 573 | |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 574 | // WebContentSettingsClient mock object. |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 575 | std::unique_ptr<MockContentSettingsClient> mock_content_settings_client_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 576 | |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 577 | bool use_mock_theme_ = false; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 578 | |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 579 | MockScreenOrientationClient mock_screen_orientation_client_; |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 580 | std::unique_ptr<SpellCheckClient> spellcheck_; |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 581 | |
| 582 | // Number of currently active color choosers. |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 583 | int chooser_count_ = 0; |
lukasza | 6a113ae1 | 2016-03-17 22:41:20 | [diff] [blame] | 584 | |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 585 | // Captured drag image. |
danakj | 0c75ad8 | 2018-07-10 19:50:12 | [diff] [blame] | 586 | SkBitmap drag_image_; |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 587 | |
lukasza | 95416be14 | 2016-04-14 15:06:33 | [diff] [blame] | 588 | // View that was focused by a previous call to TestRunner::SetFocus method. |
| 589 | // Note - this can be a dangling pointer to an already destroyed WebView (this |
| 590 | // is ok, because this is taken care of in WebTestDelegate::SetFocus). |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 591 | blink::WebView* previously_focused_view_ = nullptr; |
lukasza | 95416be14 | 2016-04-14 15:06:33 | [diff] [blame] | 592 | |
Kent Tamura | fde0e4e | 2018-11-26 08:27:00 | [diff] [blame] | 593 | // True when running a test in web_tests/external/wpt/. |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 594 | bool is_web_platform_tests_mode_ = false; |
tkent | 00340348 | 2016-05-26 08:18:41 | [diff] [blame] | 595 | |
Mason Freed | b085562 | 2018-10-02 17:49:47 | [diff] [blame] | 596 | // True if rasterization should be performed during tests that examine |
| 597 | // fling-style animations. This includes middle-click auto-scroll behaviors. |
| 598 | // This does not include most "ordinary" animations, such as CSS animations. |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 599 | bool animation_requires_raster_ = false; |
Mason Freed | b085562 | 2018-10-02 17:49:47 | [diff] [blame] | 600 | |
Kent Tamura | 21d1de6 | 2018-12-10 04:45:20 | [diff] [blame] | 601 | // An effective connection type settable by web tests. |
danakj | 3130f12 | 2019-07-16 17:49:47 | [diff] [blame] | 602 | blink::WebEffectiveConnectionType effective_connection_type_ = |
| 603 | blink::WebEffectiveConnectionType::kTypeUnknown; |
jkarlin | 3bddb7d | 2016-09-21 18:44:16 | [diff] [blame] | 604 | |
pfeldman | 4c4133d | 2016-12-20 02:40:21 | [diff] [blame] | 605 | // Forces v8 compilation cache to be disabled (used for inspector tests). |
| 606 | bool disable_v8_cache_ = false; |
| 607 | |
Jeremy Roman | 3bca4bf | 2019-07-11 03:41:25 | [diff] [blame] | 608 | base::WeakPtrFactory<TestRunner> weak_factory_{this}; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 609 | |
| 610 | DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 611 | }; |
| 612 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 613 | } // namespace test_runner |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 614 | |
Scott Violet | fdda96d | 2018-07-27 20:17:23 | [diff] [blame] | 615 | #endif // CONTENT_SHELL_TEST_RUNNER_TEST_RUNNER_H_ |