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