[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 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 5 | #ifndef COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| 6 | #define COMPONENTS_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 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 10 | #include <deque> |
| 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 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 15 | #include "base/macros.h" |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 16 | #include "base/memory/scoped_ptr.h" |
| 17 | #include "base/memory/weak_ptr.h" |
jochen | 746754c5 | 2015-06-05 16:40:41 | [diff] [blame] | 18 | #include "components/test_runner/test_runner_export.h" |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 19 | #include "components/test_runner/web_task.h" |
| 20 | #include "components/test_runner/web_test_runner.h" |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 21 | #include "v8/include/v8.h" |
| 22 | |
[email protected] | 945babb | 2014-07-30 14:25:32 | [diff] [blame] | 23 | class GURL; |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 24 | class SkBitmap; |
| 25 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 26 | namespace blink { |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 27 | class WebContentSettingsClient; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 28 | class WebFrame; |
mcasas | 43ff56ff | 2015-10-08 05:24:37 | [diff] [blame] | 29 | class WebMediaStream; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 30 | class WebString; |
| 31 | class WebView; |
kenneth.r.christiansen | 1a4946d | 2014-09-25 16:11:06 | [diff] [blame] | 32 | class WebURLResponse; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 33 | } |
| 34 | |
| 35 | namespace gin { |
| 36 | class ArrayBufferView; |
| 37 | class Arguments; |
| 38 | } |
| 39 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 40 | namespace test_runner { |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 41 | |
[email protected] | 97d3fe8 | 2014-04-05 02:40:00 | [diff] [blame] | 42 | class InvokeCallbackTask; |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 43 | class TestInterfaces; |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 44 | class WebContentSettings; |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 45 | class WebTestDelegate; |
[email protected] | a2ec0bc | 2014-04-23 08:18:27 | [diff] [blame] | 46 | class WebTestProxyBase; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 47 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 48 | class TestRunner : public WebTestRunner, |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 49 | public base::SupportsWeakPtr<TestRunner> { |
| 50 | public: |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 51 | explicit TestRunner(TestInterfaces*); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 52 | virtual ~TestRunner(); |
| 53 | |
| 54 | void Install(blink::WebFrame* frame); |
| 55 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 56 | void SetDelegate(WebTestDelegate*); |
[email protected] | a2ec0bc | 2014-04-23 08:18:27 | [diff] [blame] | 57 | void SetWebView(blink::WebView*, WebTestProxyBase*); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 58 | |
| 59 | void Reset(); |
| 60 | |
[email protected] | a1640e4 | 2014-05-14 13:43:32 | [diff] [blame] | 61 | WebTaskList* mutable_task_list() { return &task_list_; } |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 62 | |
| 63 | void SetTestIsRunning(bool); |
| 64 | bool TestIsRunning() const { return test_is_running_; } |
| 65 | |
| 66 | bool UseMockTheme() const { return use_mock_theme_; } |
| 67 | |
[email protected] | 97d3fe8 | 2014-04-05 02:40:00 | [diff] [blame] | 68 | void InvokeCallback(scoped_ptr<InvokeCallbackTask> callback); |
| 69 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 70 | // WebTestRunner implementation. |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 71 | bool ShouldGeneratePixelResults() override; |
jochen | 746754c5 | 2015-06-05 16:40:41 | [diff] [blame] | 72 | bool ShouldStayOnPageAfterHandlingBeforeUnload() const override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 73 | bool ShouldDumpAsAudio() const override; |
| 74 | void GetAudioData(std::vector<unsigned char>* buffer_view) const override; |
lukasza | a896046 | 2016-01-27 22:27:33 | [diff] [blame] | 75 | LayoutDumpFlags GetLayoutDumpFlags() override; |
| 76 | bool HasCustomTextDump(std::string* custom_text_dump) const override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 77 | bool ShouldDumpBackForwardList() const override; |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 78 | blink::WebContentSettingsClient* GetWebContentSettings() const override; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 79 | |
| 80 | // Methods used by WebTestProxyBase. |
| 81 | bool shouldDumpSelectionRect() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 82 | bool isPrinting() const; |
| 83 | bool shouldDumpAsText(); |
| 84 | bool shouldDumpAsTextWithPixelResults(); |
[email protected] | f24836a | 2014-05-06 01:02:44 | [diff] [blame] | 85 | bool shouldDumpAsCustomText() const; |
| 86 | std:: string customDumpText() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 87 | bool shouldDumpAsMarkup(); |
| 88 | bool shouldDumpChildFrameScrollPositions() const; |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 89 | bool shouldDumpChildFramesAsMarkup() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 90 | bool shouldDumpChildFramesAsText() const; |
abhishek.a21 | ca9b560 | 2014-09-19 07:33:33 | [diff] [blame] | 91 | void ShowDevTools(const std::string& settings, |
[email protected] | 06c25301 | 2014-04-16 18:35:33 | [diff] [blame] | 92 | const std::string& frontend_url); |
abhishek.a21 | ca9b560 | 2014-09-19 07:33:33 | [diff] [blame] | 93 | void ClearDevToolsLocalStorage(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 94 | void setShouldDumpAsText(bool); |
| 95 | void setShouldDumpAsMarkup(bool); |
ki.stfu | 939799a4 | 2015-09-28 04:41:20 | [diff] [blame] | 96 | void setCustomTextOutput(const std::string& text); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 97 | void setShouldGeneratePixelResults(bool); |
| 98 | void setShouldDumpFrameLoadCallbacks(bool); |
| 99 | void setShouldDumpPingLoaderCallbacks(bool); |
| 100 | void setShouldEnableViewSource(bool); |
| 101 | bool shouldDumpEditingCallbacks() const; |
| 102 | bool shouldDumpFrameLoadCallbacks() const; |
| 103 | bool shouldDumpPingLoaderCallbacks() const; |
| 104 | bool shouldDumpUserGestureInFrameLoadCallbacks() const; |
| 105 | bool shouldDumpTitleChanges() const; |
| 106 | bool shouldDumpIconChanges() const; |
| 107 | bool shouldDumpCreateView() const; |
| 108 | bool canOpenWindows() const; |
| 109 | bool shouldDumpResourceLoadCallbacks() const; |
| 110 | bool shouldDumpResourceRequestCallbacks() const; |
| 111 | bool shouldDumpResourceResponseMIMETypes() const; |
| 112 | bool shouldDumpStatusCallbacks() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 113 | bool shouldDumpSpellCheckCallbacks() const; |
[email protected] | a79cb991 | 2014-04-26 22:07:33 | [diff] [blame] | 114 | bool shouldWaitUntilExternalURLLoad() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 115 | const std::set<std::string>* httpHeadersToClear() const; |
| 116 | void setTopLoadingFrame(blink::WebFrame*, bool); |
| 117 | blink::WebFrame* topLoadingFrame() const; |
| 118 | void policyDelegateDone(); |
| 119 | bool policyDelegateEnabled() const; |
| 120 | bool policyDelegateIsPermissive() const; |
| 121 | bool policyDelegateShouldNotifyDone() const; |
| 122 | bool shouldInterceptPostMessage() const; |
| 123 | bool shouldDumpResourcePriorities() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 124 | bool RequestPointerLock(); |
| 125 | void RequestPointerUnlock(); |
| 126 | bool isPointerLocked(); |
| 127 | void setToolTipText(const blink::WebString&); |
jackhou | 656fc85 | 2015-02-13 09:04:17 | [diff] [blame] | 128 | bool shouldDumpDragImage(); |
jochen | c3a98da1 | 2015-03-10 13:59:58 | [diff] [blame] | 129 | bool shouldDumpNavigationPolicy() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 130 | |
| 131 | bool midiAccessorResult(); |
| 132 | |
| 133 | // A single item in the work queue. |
| 134 | class WorkItem { |
| 135 | public: |
| 136 | virtual ~WorkItem() {} |
| 137 | |
| 138 | // Returns true if this started a load. |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 139 | virtual bool Run(WebTestDelegate*, blink::WebView*) = 0; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 140 | }; |
| 141 | |
| 142 | private: |
| 143 | friend class InvokeCallbackTask; |
| 144 | friend class TestRunnerBindings; |
| 145 | friend class WorkQueue; |
| 146 | |
| 147 | // Helper class for managing events queued by methods like queueLoad or |
| 148 | // queueScript. |
| 149 | class WorkQueue { |
| 150 | public: |
| 151 | explicit WorkQueue(TestRunner* controller); |
| 152 | virtual ~WorkQueue(); |
| 153 | void ProcessWorkSoon(); |
| 154 | |
| 155 | // Reset the state of the class between tests. |
| 156 | void Reset(); |
| 157 | |
| 158 | void AddWork(WorkItem*); |
| 159 | |
| 160 | void set_frozen(bool frozen) { frozen_ = frozen; } |
| 161 | bool is_empty() { return queue_.empty(); } |
[email protected] | a1640e4 | 2014-05-14 13:43:32 | [diff] [blame] | 162 | WebTaskList* mutable_task_list() { return &task_list_; } |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 163 | |
| 164 | private: |
| 165 | void ProcessWork(); |
| 166 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 167 | class WorkQueueTask : public WebMethodTask<WorkQueue> { |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 168 | public: |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 169 | WorkQueueTask(WorkQueue* object) : WebMethodTask<WorkQueue>(object) {} |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 170 | |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 171 | void RunIfValid() override; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 172 | }; |
| 173 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 174 | WebTaskList task_list_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 175 | std::deque<WorkItem*> queue_; |
| 176 | bool frozen_; |
| 177 | TestRunner* controller_; |
| 178 | }; |
| 179 | |
| 180 | /////////////////////////////////////////////////////////////////////////// |
| 181 | // Methods dealing with the test logic |
| 182 | |
| 183 | // By default, tests end when page load is complete. These methods are used |
| 184 | // to delay the completion of the test until notifyDone is called. |
| 185 | void NotifyDone(); |
| 186 | void WaitUntilDone(); |
| 187 | |
| 188 | // Methods for adding actions to the work queue. Used in conjunction with |
| 189 | // waitUntilDone/notifyDone above. |
| 190 | void QueueBackNavigation(int how_far_back); |
| 191 | void QueueForwardNavigation(int how_far_forward); |
| 192 | void QueueReload(); |
| 193 | void QueueLoadingScript(const std::string& script); |
| 194 | void QueueNonLoadingScript(const std::string& script); |
| 195 | void QueueLoad(const std::string& url, const std::string& target); |
| 196 | void QueueLoadHTMLString(gin::Arguments* args); |
| 197 | |
| 198 | // Causes navigation actions just printout the intended navigation instead |
| 199 | // of taking you to the page. This is used for cases like mailto, where you |
| 200 | // don't actually want to open the mail program. |
| 201 | void SetCustomPolicyDelegate(gin::Arguments* args); |
| 202 | |
| 203 | // Delays completion of the test until the policy delegate runs. |
| 204 | void WaitForPolicyDelegate(); |
| 205 | |
| 206 | // Functions for dealing with windows. By default we block all new windows. |
| 207 | int WindowCount(); |
| 208 | void SetCloseRemainingWindowsWhenComplete(bool close_remaining_windows); |
| 209 | void ResetTestHelperControllers(); |
| 210 | |
| 211 | /////////////////////////////////////////////////////////////////////////// |
| 212 | // Methods implemented entirely in terms of chromium's public WebKit API |
| 213 | |
| 214 | // Method that controls whether pressing Tab key cycles through page elements |
| 215 | // or inserts a '\t' char in text area |
| 216 | void SetTabKeyCyclesThroughElements(bool tab_key_cycles_through_elements); |
| 217 | |
| 218 | // Executes an internal command (superset of document.execCommand() commands). |
| 219 | void ExecCommand(gin::Arguments* args); |
| 220 | |
| 221 | // Checks if an internal command is currently available. |
| 222 | bool IsCommandEnabled(const std::string& command); |
| 223 | |
| 224 | bool CallShouldCloseOnWebView(); |
| 225 | void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, |
| 226 | const std::string& scheme); |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 227 | v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 228 | int world_id, const std::string& script); |
| 229 | void EvaluateScriptInIsolatedWorld(int world_id, const std::string& script); |
| 230 | void SetIsolatedWorldSecurityOrigin(int world_id, |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 231 | v8::Local<v8::Value> origin); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 232 | void SetIsolatedWorldContentSecurityPolicy(int world_id, |
| 233 | const std::string& policy); |
| 234 | |
| 235 | // Allows layout tests to manage origins' whitelisting. |
| 236 | void AddOriginAccessWhitelistEntry(const std::string& source_origin, |
| 237 | const std::string& destination_protocol, |
| 238 | const std::string& destination_host, |
| 239 | bool allow_destination_subdomains); |
| 240 | void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
| 241 | const std::string& destination_protocol, |
| 242 | const std::string& destination_host, |
| 243 | bool allow_destination_subdomains); |
| 244 | |
| 245 | // Returns true if the current page box has custom page size style for |
| 246 | // printing. |
| 247 | bool HasCustomPageSizeStyle(int page_index); |
| 248 | |
| 249 | // Forces the selection colors for testing under Linux. |
| 250 | void ForceRedSelectionColors(); |
| 251 | |
dcheng | 9000dbd | 2015-04-03 05:39:40 | [diff] [blame] | 252 | // Add |source_code| as an injected stylesheet to the active document of the |
| 253 | // window of the current V8 context. |
| 254 | void InsertStyleSheet(const std::string& source_code); |
| 255 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 256 | bool FindString(const std::string& search_text, |
| 257 | const std::vector<std::string>& options_array); |
| 258 | |
| 259 | std::string SelectionAsMarkup(); |
| 260 | |
| 261 | // Enables or disables subpixel positioning (i.e. fractional X positions for |
| 262 | // glyphs) in text rendering on Linux. Since this method changes global |
| 263 | // settings, tests that call it must use their own custom font family for |
| 264 | // all text that they render. If not, an already-cached style will be used, |
| 265 | // resulting in the changed setting being ignored. |
| 266 | void SetTextSubpixelPositioning(bool value); |
| 267 | |
| 268 | // Switch the visibility of the page. |
| 269 | void SetPageVisibility(const std::string& new_visibility); |
| 270 | |
| 271 | // Changes the direction of the focused element. |
| 272 | void SetTextDirection(const std::string& direction_name); |
| 273 | |
| 274 | // After this function is called, all window-sizing machinery is |
| 275 | // short-circuited inside the renderer. This mode is necessary for |
| 276 | // some tests that were written before browsers had multi-process architecture |
| 277 | // and rely on window resizes to happen synchronously. |
| 278 | // The function has "unfortunate" it its name because we must strive to remove |
| 279 | // all tests that rely on this... well, unfortunate behavior. See |
| 280 | // http://crbug.com/309760 for the plan. |
| 281 | void UseUnfortunateSynchronousResizeMode(); |
| 282 | |
| 283 | bool EnableAutoResizeMode(int min_width, |
| 284 | int min_height, |
| 285 | int max_width, |
| 286 | int max_height); |
| 287 | bool DisableAutoResizeMode(int new_width, int new_height); |
| 288 | |
[email protected] | 2ad7e62 | 2014-06-30 17:44:21 | [diff] [blame] | 289 | void SetMockDeviceLight(double value); |
| 290 | void ResetDeviceLight(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 291 | // Device Motion / Device Orientation related functions |
| 292 | void SetMockDeviceMotion(bool has_acceleration_x, double acceleration_x, |
| 293 | bool has_acceleration_y, double acceleration_y, |
| 294 | bool has_acceleration_z, double acceleration_z, |
| 295 | bool has_acceleration_including_gravity_x, |
| 296 | double acceleration_including_gravity_x, |
| 297 | bool has_acceleration_including_gravity_y, |
| 298 | double acceleration_including_gravity_y, |
| 299 | bool has_acceleration_including_gravity_z, |
| 300 | double acceleration_including_gravity_z, |
| 301 | bool has_rotation_rate_alpha, |
| 302 | double rotation_rate_alpha, |
| 303 | bool has_rotation_rate_beta, |
| 304 | double rotation_rate_beta, |
| 305 | bool has_rotation_rate_gamma, |
| 306 | double rotation_rate_gamma, |
| 307 | double interval); |
| 308 | void SetMockDeviceOrientation(bool has_alpha, double alpha, |
| 309 | bool has_beta, double beta, |
| 310 | bool has_gamma, double gamma, |
| 311 | bool has_absolute, bool absolute); |
| 312 | |
[email protected] | e0bc2cb | 2014-03-20 17:34:24 | [diff] [blame] | 313 | void SetMockScreenOrientation(const std::string& orientation); |
| 314 | |
[email protected] | de7c9e7 | 2014-06-03 22:30:26 | [diff] [blame] | 315 | void DidChangeBatteryStatus(bool charging, |
| 316 | double chargingTime, |
| 317 | double dischargingTime, |
| 318 | double level); |
| 319 | void ResetBatteryStatus(); |
| 320 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 321 | void DidAcquirePointerLock(); |
| 322 | void DidNotAcquirePointerLock(); |
| 323 | void DidLosePointerLock(); |
| 324 | void SetPointerLockWillFailSynchronously(); |
| 325 | void SetPointerLockWillRespondAsynchronously(); |
| 326 | |
| 327 | /////////////////////////////////////////////////////////////////////////// |
| 328 | // Methods modifying WebPreferences. |
| 329 | |
| 330 | // Set the WebPreference that controls webkit's popup blocking. |
| 331 | void SetPopupBlockingEnabled(bool block_popups); |
| 332 | |
| 333 | void SetJavaScriptCanAccessClipboard(bool can_access); |
| 334 | void SetXSSAuditorEnabled(bool enabled); |
| 335 | void SetAllowUniversalAccessFromFileURLs(bool allow); |
| 336 | void SetAllowFileAccessFromFileURLs(bool allow); |
ki.stfu | 939799a4 | 2015-09-28 04:41:20 | [diff] [blame] | 337 | void OverridePreference(const std::string& key, v8::Local<v8::Value> value); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 338 | |
[email protected] | ebd5ea5 | 2014-05-28 14:51:15 | [diff] [blame] | 339 | // Modify accept_languages in RendererPreferences. |
| 340 | void SetAcceptLanguages(const std::string& accept_languages); |
| 341 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 342 | // Enable or disable plugins. |
| 343 | void SetPluginsEnabled(bool enabled); |
| 344 | |
| 345 | /////////////////////////////////////////////////////////////////////////// |
| 346 | // Methods that modify the state of TestRunner |
| 347 | |
| 348 | // This function sets a flag that tells the test_shell to print a line of |
| 349 | // descriptive text for each editing command. It takes no arguments, and |
| 350 | // ignores any that may be present. |
| 351 | void DumpEditingCallbacks(); |
| 352 | |
| 353 | // This function sets a flag that tells the test_shell to dump pages as |
| 354 | // plain text, rather than as a text representation of the renderer's state. |
| 355 | // The pixel results will not be generated for this test. |
| 356 | void DumpAsText(); |
| 357 | |
| 358 | // This function sets a flag that tells the test_shell to dump pages as |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 359 | // the DOM contents, rather than as a text representation of the renderer's |
| 360 | // state. The pixel results will not be generated for this test. |
| 361 | void DumpAsMarkup(); |
| 362 | |
| 363 | // This function sets a flag that tells the test_shell to dump pages as |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 364 | // plain text, rather than as a text representation of the renderer's state. |
| 365 | // It will also generate a pixel dump for the test. |
| 366 | void DumpAsTextWithPixelResults(); |
| 367 | |
| 368 | // This function sets a flag that tells the test_shell to print out the |
| 369 | // scroll offsets of the child frames. It ignores all. |
| 370 | void DumpChildFrameScrollPositions(); |
| 371 | |
| 372 | // This function sets a flag that tells the test_shell to recursively |
| 373 | // dump all frames as plain text if the DumpAsText flag is set. |
| 374 | // It takes no arguments, and ignores any that may be present. |
| 375 | void DumpChildFramesAsText(); |
| 376 | |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 377 | // This function sets a flag that tells the test_shell to recursively |
| 378 | // dump all frames as the DOM contents if the DumpAsMarkup flag is set. |
| 379 | // It takes no arguments, and ignores any that may be present. |
| 380 | void DumpChildFramesAsMarkup(); |
| 381 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 382 | // This function sets a flag that tells the test_shell to print out the |
| 383 | // information about icon changes notifications from WebKit. |
| 384 | void DumpIconChanges(); |
| 385 | |
| 386 | // Deals with Web Audio WAV file data. |
| 387 | void SetAudioData(const gin::ArrayBufferView& view); |
| 388 | |
| 389 | // This function sets a flag that tells the test_shell to print a line of |
| 390 | // descriptive text for each frame load callback. It takes no arguments, and |
| 391 | // ignores any that may be present. |
| 392 | void DumpFrameLoadCallbacks(); |
| 393 | |
| 394 | // This function sets a flag that tells the test_shell to print a line of |
| 395 | // descriptive text for each PingLoader dispatch. It takes no arguments, and |
| 396 | // ignores any that may be present. |
| 397 | void DumpPingLoaderCallbacks(); |
| 398 | |
| 399 | // This function sets a flag that tells the test_shell to print a line of |
| 400 | // user gesture status text for some frame load callbacks. It takes no |
| 401 | // arguments, and ignores any that may be present. |
| 402 | void DumpUserGestureInFrameLoadCallbacks(); |
| 403 | |
| 404 | void DumpTitleChanges(); |
| 405 | |
| 406 | // This function sets a flag that tells the test_shell to dump all calls to |
| 407 | // WebViewClient::createView(). |
| 408 | // It takes no arguments, and ignores any that may be present. |
| 409 | void DumpCreateView(); |
| 410 | |
| 411 | void SetCanOpenWindows(); |
| 412 | |
| 413 | // This function sets a flag that tells the test_shell to dump a descriptive |
| 414 | // line for each resource load callback. It takes no arguments, and ignores |
| 415 | // any that may be present. |
| 416 | void DumpResourceLoadCallbacks(); |
| 417 | |
| 418 | // This function sets a flag that tells the test_shell to print a line of |
| 419 | // descriptive text for each element that requested a resource. It takes no |
| 420 | // arguments, and ignores any that may be present. |
| 421 | void DumpResourceRequestCallbacks(); |
| 422 | |
| 423 | // This function sets a flag that tells the test_shell to dump the MIME type |
| 424 | // for each resource that was loaded. It takes no arguments, and ignores any |
| 425 | // that may be present. |
| 426 | void DumpResourceResponseMIMETypes(); |
| 427 | |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 428 | // WebContentSettingsClient related. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 429 | void SetImagesAllowed(bool allowed); |
[email protected] | e19024b9 | 2014-06-10 11:10:37 | [diff] [blame] | 430 | void SetMediaAllowed(bool allowed); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 431 | void SetScriptsAllowed(bool allowed); |
| 432 | void SetStorageAllowed(bool allowed); |
| 433 | void SetPluginsAllowed(bool allowed); |
| 434 | void SetAllowDisplayOfInsecureContent(bool allowed); |
| 435 | void SetAllowRunningOfInsecureContent(bool allowed); |
| 436 | void DumpPermissionClientCallbacks(); |
| 437 | |
| 438 | // This function sets a flag that tells the test_shell to dump all calls |
| 439 | // to window.status(). |
| 440 | // It takes no arguments, and ignores any that may be present. |
| 441 | void DumpWindowStatusChanges(); |
| 442 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 443 | // This function sets a flag that tells the test_shell to dump all |
| 444 | // the lines of descriptive text about spellcheck execution. |
| 445 | void DumpSpellCheckCallbacks(); |
| 446 | |
| 447 | // This function sets a flag that tells the test_shell to print out a text |
| 448 | // representation of the back/forward list. It ignores all arguments. |
| 449 | void DumpBackForwardList(); |
| 450 | |
| 451 | void DumpSelectionRect(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 452 | |
| 453 | // Causes layout to happen as if targetted to printed pages. |
| 454 | void SetPrinting(); |
| 455 | |
[email protected] | 5284610 | 2014-06-24 04:26:44 | [diff] [blame] | 456 | // Clears the state from SetPrinting(). |
| 457 | void ClearPrinting(); |
| 458 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 459 | void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); |
| 460 | |
| 461 | // Causes WillSendRequest to clear certain headers. |
| 462 | void SetWillSendRequestClearHeader(const std::string& header); |
| 463 | |
| 464 | // This function sets a flag that tells the test_shell to dump a descriptive |
| 465 | // line for each resource load's priority and any time that priority |
| 466 | // changes. It takes no arguments, and ignores any that may be present. |
| 467 | void DumpResourceRequestPriorities(); |
| 468 | |
| 469 | // Sets a flag to enable the mock theme. |
| 470 | void SetUseMockTheme(bool use); |
| 471 | |
[email protected] | a79cb991 | 2014-04-26 22:07:33 | [diff] [blame] | 472 | // Sets a flag that causes the test to be marked as completed when the |
| 473 | // WebFrameClient receives a loadURLExternally() call. |
| 474 | void WaitUntilExternalURLLoad(); |
| 475 | |
jackhou | 656fc85 | 2015-02-13 09:04:17 | [diff] [blame] | 476 | // This function sets a flag which tells the WebTestProxy to dump the drag |
| 477 | // image when the next drag-and-drop is initiated. It is equivalent to |
| 478 | // DumpAsTextWithPixelResults but the pixel results will be the drag image |
| 479 | // instead of a snapshot of the page. |
| 480 | void DumpDragImage(); |
| 481 | |
jochen | c3a98da1 | 2015-03-10 13:59:58 | [diff] [blame] | 482 | // Sets a flag that tells the WebTestProxy to dump the default navigation |
| 483 | // policy passed to the decidePolicyForNavigation callback. |
| 484 | void DumpNavigationPolicy(); |
| 485 | |
kouhei | 503bf4e | 2015-11-05 04:59:04 | [diff] [blame] | 486 | // Dump current PageImportanceSignals for the page. |
| 487 | void DumpPageImportanceSignals(); |
| 488 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 489 | /////////////////////////////////////////////////////////////////////////// |
| 490 | // Methods interacting with the WebTestProxy |
| 491 | |
| 492 | /////////////////////////////////////////////////////////////////////////// |
| 493 | // Methods forwarding to the WebTestDelegate |
| 494 | |
| 495 | // Shows DevTools window. |
[email protected] | 06c25301 | 2014-04-16 18:35:33 | [diff] [blame] | 496 | void ShowWebInspector(const std::string& str, |
| 497 | const std::string& frontend_url); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 498 | void CloseWebInspector(); |
| 499 | |
| 500 | // Inspect chooser state |
| 501 | bool IsChooserShown(); |
| 502 | |
| 503 | // Allows layout tests to exec scripts at WebInspector side. |
| 504 | void EvaluateInWebInspector(int call_id, const std::string& script); |
sergeyv | 0cd842b4 | 2015-10-09 16:07:11 | [diff] [blame] | 505 | // Allows layout tests to evaluate scripts in InspectorOverlay page. |
| 506 | // Script may have an output represented as a string, return values of other |
| 507 | // types would be ignored. |
| 508 | std::string EvaluateInWebInspectorOverlay(const std::string& script); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 509 | |
| 510 | // Clears all databases. |
| 511 | void ClearAllDatabases(); |
| 512 | // Sets the default quota for all origins |
| 513 | void SetDatabaseQuota(int quota); |
| 514 | |
| 515 | // Changes the cookie policy from the default to allow all cookies. |
| 516 | void SetAlwaysAcceptCookies(bool accept); |
| 517 | |
| 518 | // Gives focus to the window. |
| 519 | void SetWindowIsKey(bool value); |
| 520 | |
| 521 | // Converts a URL starting with file:///tmp/ to the local mapping. |
| 522 | std::string PathToLocalResource(const std::string& path); |
| 523 | |
| 524 | // Used to set the device scale factor. |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 525 | void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 526 | |
oshima | 841bbae | 2015-12-18 08:14:29 | [diff] [blame] | 527 | // Enable zoom-for-dsf option. |
| 528 | // TODO(oshima): Remove this once all platforms migrated. |
| 529 | void EnableUseZoomForDSF(v8::Local<v8::Function> callback); |
| 530 | |
[email protected] | 71e65230 | 2014-05-09 14:20:13 | [diff] [blame] | 531 | // Change the device color profile while running a layout test. |
| 532 | void SetColorProfile(const std::string& name, |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 533 | v8::Local<v8::Function> callback); |
[email protected] | 71e65230 | 2014-05-09 14:20:13 | [diff] [blame] | 534 | |
jyasskin | 8057c00 | 2015-09-10 19:09:53 | [diff] [blame] | 535 | // Change the bluetooth test data while running a layout test and resets the |
| 536 | // chooser to accept the first device. |
scheib | 834f2690 | 2014-11-05 23:57:26 | [diff] [blame] | 537 | void SetBluetoothMockDataSet(const std::string& name); |
| 538 | |
jyasskin | 8057c00 | 2015-09-10 19:09:53 | [diff] [blame] | 539 | // Makes the Bluetooth chooser record its input and wait for instructions from |
| 540 | // the test program on how to proceed. |
| 541 | void SetBluetoothManualChooser(); |
| 542 | |
jyasskin | a5cef8f | 2015-09-22 16:20:26 | [diff] [blame] | 543 | // Calls |callback| with a DOMString[] representing the events recorded since |
| 544 | // the last call to this function. |
| 545 | void GetBluetoothManualChooserEvents(v8::Local<v8::Function> callback); |
jyasskin | 8057c00 | 2015-09-10 19:09:53 | [diff] [blame] | 546 | |
| 547 | // Calls the BluetoothChooser::EventHandler with the arguments here. Valid |
| 548 | // event strings are: |
| 549 | // * "cancel" - simulates the user canceling the chooser. |
| 550 | // * "select" - simulates the user selecting a device whose device ID is in |
| 551 | // |argument|. |
| 552 | void SendBluetoothManualChooserEvent(const std::string& event, |
| 553 | const std::string& argument); |
| 554 | |
mek | 340dd9d | 2014-12-11 02:10:46 | [diff] [blame] | 555 | // Enables mock geofencing service while running a layout test. |
| 556 | // |service_available| indicates if the mock service should mock geofencing |
| 557 | // being available or not. |
| 558 | void SetGeofencingMockProvider(bool service_available); |
| 559 | |
| 560 | // Disables mock geofencing service while running a layout test. |
| 561 | void ClearGeofencingMockProvider(); |
| 562 | |
| 563 | // Set the mock geofencing position while running a layout test. |
| 564 | void SetGeofencingMockPosition(double latitude, double longitude); |
| 565 | |
mlamouri | d5098d0 | 2015-04-21 12:17:30 | [diff] [blame] | 566 | // Sets the permission's |name| to |value| for a given {origin, embedder} |
| 567 | // tuple. |
| 568 | void SetPermission(const std::string& name, |
| 569 | const std::string& value, |
| 570 | const GURL& origin, |
| 571 | const GURL& embedding_origin); |
| 572 | |
benwells | 0c0d3f1 | 2015-05-25 01:03:17 | [diff] [blame] | 573 | // Causes the beforeinstallprompt event to be sent to the renderer. |
| 574 | void DispatchBeforeInstallPromptEvent( |
| 575 | int request_id, |
| 576 | const std::vector<std::string>& event_platforms, |
| 577 | v8::Local<v8::Function> callback); |
| 578 | |
| 579 | // Resolve the beforeinstallprompt event with the matching request id. |
| 580 | void ResolveBeforeInstallPromptPromise(int request_id, |
| 581 | const std::string& platform); |
| 582 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 583 | // Calls setlocale(LC_ALL, ...) for a specified locale. |
| 584 | // Resets between tests. |
| 585 | void SetPOSIXLocale(const std::string& locale); |
| 586 | |
| 587 | // MIDI function to control permission handling. |
| 588 | void SetMIDIAccessorResult(bool result); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 589 | |
peter | d98157d | 2014-11-20 13:15:01 | [diff] [blame] | 590 | // Simulates a click on a Web Notification. |
johnme | 96d5012 | 2015-08-07 15:33:21 | [diff] [blame] | 591 | void SimulateWebNotificationClick(const std::string& title, int action_index); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 592 | |
nsatragno | 24bd34b | 2016-02-09 10:30:02 | [diff] [blame^] | 593 | // Simulates closing a Web Notification. |
| 594 | void SimulateWebNotificationClose(const std::string& title, bool by_user); |
| 595 | |
[email protected] | 56e365d4 | 2014-05-02 22:18:24 | [diff] [blame] | 596 | // Speech recognition related functions. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 597 | void AddMockSpeechRecognitionResult(const std::string& transcript, |
| 598 | double confidence); |
| 599 | void SetMockSpeechRecognitionError(const std::string& error, |
| 600 | const std::string& message); |
| 601 | bool WasMockSpeechRecognitionAborted(); |
| 602 | |
mkwst | 41667ab | 2014-09-16 06:52:43 | [diff] [blame] | 603 | // Credential Manager mock functions |
| 604 | // TODO(mkwst): Support FederatedCredential. |
| 605 | void AddMockCredentialManagerResponse(const std::string& id, |
| 606 | const std::string& name, |
| 607 | const std::string& avatar, |
| 608 | const std::string& password); |
| 609 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 610 | // WebPageOverlay related functions. Permits the adding and removing of only |
| 611 | // one opaque overlay. |
| 612 | void AddWebPageOverlay(); |
| 613 | void RemoveWebPageOverlay(); |
| 614 | |
wangxianzhu | 372112e | 2015-05-06 23:01:57 | [diff] [blame] | 615 | void LayoutAndPaintAsync(); |
| 616 | void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 617 | |
wangxianzhu | 372112e | 2015-05-06 23:01:57 | [diff] [blame] | 618 | // Similar to LayoutAndPaintAsyncThen(), but pass parameters of the captured |
[email protected] | 5284610 | 2014-06-24 04:26:44 | [diff] [blame] | 619 | // snapshot (width, height, snapshot) to the callback. The snapshot is in |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 620 | // uint8_t RGBA format. |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 621 | void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); |
[email protected] | 9285cdc | 2014-07-18 15:42:25 | [diff] [blame] | 622 | // Similar to CapturePixelsAsyncThen(). Copies to the clipboard the image |
| 623 | // located at a particular point in the WebView (if there is such an image), |
| 624 | // reads back its pixels, and provides the snapshot to the callback. If there |
| 625 | // is no image at that point, calls the callback with (0, 0, empty_snapshot). |
| 626 | void CopyImageAtAndCapturePixelsAsyncThen( |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 627 | int x, int y, const v8::Local<v8::Function> callback); |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 628 | |
deepak.s | 750d68f | 2015-04-30 07:32:41 | [diff] [blame] | 629 | void GetManifestThen(v8::Local<v8::Function> callback); |
kenneth.r.christiansen | 1a4946d | 2014-09-25 16:11:06 | [diff] [blame] | 630 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 631 | /////////////////////////////////////////////////////////////////////////// |
| 632 | // Internal helpers |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 633 | |
kenneth.r.christiansen | 1a4946d | 2014-09-25 16:11:06 | [diff] [blame] | 634 | void GetManifestCallback(scoped_ptr<InvokeCallbackTask> task, |
| 635 | const blink::WebURLResponse& response, |
| 636 | const std::string& data); |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 637 | void CapturePixelsCallback(scoped_ptr<InvokeCallbackTask> task, |
| 638 | const SkBitmap& snapshot); |
benwells | 0c0d3f1 | 2015-05-25 01:03:17 | [diff] [blame] | 639 | void DispatchBeforeInstallPromptCallback(scoped_ptr<InvokeCallbackTask> task, |
| 640 | bool canceled); |
jyasskin | a5cef8f | 2015-09-22 16:20:26 | [diff] [blame] | 641 | void GetBluetoothManualChooserEventsCallback( |
| 642 | scoped_ptr<InvokeCallbackTask> task, |
| 643 | const std::vector<std::string>& events); |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 644 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 645 | void CheckResponseMimeType(); |
| 646 | void CompleteNotifyDone(); |
| 647 | |
| 648 | void DidAcquirePointerLockInternal(); |
| 649 | void DidNotAcquirePointerLockInternal(); |
| 650 | void DidLosePointerLockInternal(); |
| 651 | |
| 652 | // In the Mac code, this is called to trigger the end of a test after the |
| 653 | // page has finished loading. From here, we can generate the dump for the |
| 654 | // test. |
| 655 | void LocationChangeDone(); |
| 656 | |
siva.gunturi | 3ccb6144 | 2014-11-14 01:55:13 | [diff] [blame] | 657 | // Sets a flag causing the next call to WebGLRenderingContext::create to fail. |
| 658 | void ForceNextWebGLContextCreationToFail(); |
| 659 | |
bajones | f6f00b00 | 2015-05-28 00:01:43 | [diff] [blame] | 660 | // Sets a flag causing the next call to DrawingBuffer::create to fail. |
| 661 | void ForceNextDrawingBufferCreationToFail(); |
| 662 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 663 | bool test_is_running_; |
| 664 | |
| 665 | // When reset is called, go through and close all but the main test shell |
| 666 | // window. By default, set to true but toggled to false using |
| 667 | // setCloseRemainingWindowsWhenComplete(). |
| 668 | bool close_remaining_windows_; |
| 669 | |
| 670 | // If true, don't dump output until notifyDone is called. |
| 671 | bool wait_until_done_; |
| 672 | |
[email protected] | a79cb991 | 2014-04-26 22:07:33 | [diff] [blame] | 673 | // If true, ends the test when a URL is loaded externally via |
| 674 | // WebFrameClient::loadURLExternally(). |
| 675 | bool wait_until_external_url_load_; |
| 676 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 677 | // Causes navigation actions just printout the intended navigation instead |
| 678 | // of taking you to the page. This is used for cases like mailto, where you |
| 679 | // don't actually want to open the mail program. |
| 680 | bool policy_delegate_enabled_; |
| 681 | |
| 682 | // Toggles the behavior of the policy delegate. If true, then navigations |
| 683 | // will be allowed. Otherwise, they will be ignored (dropped). |
| 684 | bool policy_delegate_is_permissive_; |
| 685 | |
| 686 | // If true, the policy delegate will signal layout test completion. |
| 687 | bool policy_delegate_should_notify_done_; |
| 688 | |
| 689 | WorkQueue work_queue_; |
| 690 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 691 | // Bound variable to return the name of this platform (chromium). |
| 692 | std::string platform_name_; |
| 693 | |
| 694 | // Bound variable to store the last tooltip text |
| 695 | std::string tooltip_text_; |
| 696 | |
| 697 | // Bound variable to disable notifyDone calls. This is used in GC leak |
| 698 | // tests, where existing LayoutTests are loaded within an iframe. The GC |
| 699 | // test harness will set this flag to ignore the notifyDone calls from the |
| 700 | // target LayoutTest. |
| 701 | bool disable_notify_done_; |
| 702 | |
| 703 | // Bound variable counting the number of top URLs visited. |
| 704 | int web_history_item_count_; |
| 705 | |
| 706 | // Bound variable to set whether postMessages should be intercepted or not |
| 707 | bool intercept_post_message_; |
| 708 | |
| 709 | // If true, the test_shell will write a descriptive line for each editing |
| 710 | // command. |
| 711 | bool dump_editting_callbacks_; |
| 712 | |
| 713 | // If true, the test_shell will generate pixel results in DumpAsText mode |
| 714 | bool generate_pixel_results_; |
| 715 | |
| 716 | // If true, the test_shell will produce a plain text dump rather than a |
| 717 | // text representation of the renderer. |
| 718 | bool dump_as_text_; |
| 719 | |
| 720 | // If true and if dump_as_text_ is true, the test_shell will recursively |
| 721 | // dump all frames as plain text. |
| 722 | bool dump_child_frames_as_text_; |
| 723 | |
| 724 | // If true, the test_shell will produce a dump of the DOM rather than a text |
| 725 | // representation of the renderer. |
| 726 | bool dump_as_markup_; |
| 727 | |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 728 | // If true and if dump_as_markup_ is true, the test_shell will recursively |
| 729 | // produce a dump of the DOM rather than a text representation of the |
| 730 | // renderer. |
| 731 | bool dump_child_frames_as_markup_; |
| 732 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 733 | // If true, the test_shell will print out the child frame scroll offsets as |
| 734 | // well. |
| 735 | bool dump_child_frame_scroll_positions_; |
| 736 | |
| 737 | // If true, the test_shell will print out the icon change notifications. |
| 738 | bool dump_icon_changes_; |
| 739 | |
| 740 | // If true, the test_shell will output a base64 encoded WAVE file. |
| 741 | bool dump_as_audio_; |
| 742 | |
| 743 | // If true, the test_shell will output a descriptive line for each frame |
| 744 | // load callback. |
| 745 | bool dump_frame_load_callbacks_; |
| 746 | |
| 747 | // If true, the test_shell will output a descriptive line for each |
| 748 | // PingLoader dispatched. |
| 749 | bool dump_ping_loader_callbacks_; |
| 750 | |
| 751 | // If true, the test_shell will output a line of the user gesture status |
| 752 | // text for some frame load callbacks. |
| 753 | bool dump_user_gesture_in_frame_load_callbacks_; |
| 754 | |
| 755 | // If true, output a message when the page title is changed. |
| 756 | bool dump_title_changes_; |
| 757 | |
| 758 | // If true, output a descriptive line each time WebViewClient::createView |
| 759 | // is invoked. |
| 760 | bool dump_create_view_; |
| 761 | |
| 762 | // If true, new windows can be opened via javascript or by plugins. By |
| 763 | // default, set to false and can be toggled to true using |
| 764 | // setCanOpenWindows(). |
| 765 | bool can_open_windows_; |
| 766 | |
| 767 | // If true, the test_shell will output a descriptive line for each resource |
| 768 | // load callback. |
| 769 | bool dump_resource_load_callbacks_; |
| 770 | |
| 771 | // If true, the test_shell will output a descriptive line for each resource |
| 772 | // request callback. |
| 773 | bool dump_resource_request_callbacks_; |
| 774 | |
| 775 | // If true, the test_shell will output the MIME type for each resource that |
| 776 | // was loaded. |
jbroman | 37b021e | 2015-05-08 17:30:25 | [diff] [blame] | 777 | bool dump_resource_response_mime_types_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 778 | |
| 779 | // If true, the test_shell will dump all changes to window.status. |
| 780 | bool dump_window_status_changes_; |
| 781 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 782 | // If true, the test_shell will output descriptive test for spellcheck |
| 783 | // execution. |
| 784 | bool dump_spell_check_callbacks_; |
| 785 | |
| 786 | // If true, the test_shell will produce a dump of the back forward list as |
| 787 | // well. |
| 788 | bool dump_back_forward_list_; |
| 789 | |
| 790 | // If true, the test_shell will draw the bounds of the current selection rect |
| 791 | // taking possible transforms of the selection rect into account. |
| 792 | bool dump_selection_rect_; |
| 793 | |
jackhou | 656fc85 | 2015-02-13 09:04:17 | [diff] [blame] | 794 | // If true, the test_shell will dump the drag image as pixel results. |
| 795 | bool dump_drag_image_; |
| 796 | |
jochen | c3a98da1 | 2015-03-10 13:59:58 | [diff] [blame] | 797 | // If true, content_shell will dump the default navigation policy passed to |
| 798 | // WebFrameClient::decidePolicyForNavigation. |
| 799 | bool dump_navigation_policy_; |
| 800 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 801 | // If true, pixel dump will be produced as a series of 1px-tall, view-wide |
| 802 | // individual paints over the height of the view. |
| 803 | bool test_repaint_; |
| 804 | |
| 805 | // If true and test_repaint_ is true as well, pixel dump will be produced as |
| 806 | // a series of 1px-wide, view-tall paints across the width of the view. |
| 807 | bool sweep_horizontally_; |
| 808 | |
| 809 | // If true, layout is to target printed pages. |
| 810 | bool is_printing_; |
| 811 | |
| 812 | // If false, MockWebMIDIAccessor fails on startSession() for testing. |
| 813 | bool midi_accessor_result_; |
| 814 | |
| 815 | bool should_stay_on_page_after_handling_before_unload_; |
| 816 | |
| 817 | bool should_dump_resource_priorities_; |
| 818 | |
[email protected] | f24836a | 2014-05-06 01:02:44 | [diff] [blame] | 819 | bool has_custom_text_output_; |
| 820 | std::string custom_text_output_; |
| 821 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 822 | std::set<std::string> http_headers_to_clear_; |
| 823 | |
| 824 | // WAV audio data is stored here. |
| 825 | std::vector<unsigned char> audio_data_; |
| 826 | |
| 827 | // Used for test timeouts. |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 828 | WebTaskList task_list_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 829 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 830 | TestInterfaces* test_interfaces_; |
| 831 | WebTestDelegate* delegate_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 832 | blink::WebView* web_view_; |
[email protected] | a2ec0bc | 2014-04-23 08:18:27 | [diff] [blame] | 833 | WebTestProxyBase* proxy_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 834 | |
| 835 | // This is non-0 IFF a load is in progress. |
| 836 | blink::WebFrame* top_loading_frame_; |
| 837 | |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 838 | // WebContentSettingsClient mock object. |
| 839 | scoped_ptr<WebContentSettings> web_content_settings_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 840 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 841 | bool pointer_locked_; |
| 842 | enum { |
| 843 | PointerLockWillSucceed, |
| 844 | PointerLockWillRespondAsync, |
| 845 | PointerLockWillFailSync, |
| 846 | } pointer_lock_planned_result_; |
| 847 | bool use_mock_theme_; |
| 848 | |
| 849 | base::WeakPtrFactory<TestRunner> weak_factory_; |
| 850 | |
| 851 | DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 852 | }; |
| 853 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 854 | } // namespace test_runner |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 855 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 856 | #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |