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