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