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