OLD | NEW |
(Empty) | |
| 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 |
| 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_RUNNER_H_ |
| 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_RUNNER_H_ |
| 7 |
| 8 #include <deque> |
| 9 #include <set> |
| 10 #include <string> |
| 11 |
| 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 14 #include "content/shell/renderer/test_runner/WebTask.h" |
| 15 #include "content/shell/renderer/test_runner/WebTestRunner.h" |
| 16 #include "v8/include/v8.h" |
| 17 |
| 18 namespace blink { |
| 19 class WebFrame; |
| 20 class WebNotificationPresenter; |
| 21 class WebPermissionClient; |
| 22 class WebString; |
| 23 class WebView; |
| 24 } |
| 25 |
| 26 namespace gin { |
| 27 class ArrayBufferView; |
| 28 class Arguments; |
| 29 } |
| 30 |
| 31 namespace WebTestRunner { |
| 32 class TestInterfaces; |
| 33 class WebPermissions; |
| 34 class WebTestDelegate; |
| 35 class WebTestProxyBase; |
| 36 } |
| 37 |
| 38 namespace content { |
| 39 |
| 40 class NotificationPresenter; |
| 41 class TestPageOverlay; |
| 42 |
| 43 class TestRunner : public ::WebTestRunner::WebTestRunner, |
| 44 public base::SupportsWeakPtr<TestRunner> { |
| 45 public: |
| 46 explicit TestRunner(::WebTestRunner::TestInterfaces*); |
| 47 virtual ~TestRunner(); |
| 48 |
| 49 void Install(blink::WebFrame* frame); |
| 50 |
| 51 void SetDelegate(::WebTestRunner::WebTestDelegate*); |
| 52 void SetWebView(blink::WebView*, ::WebTestRunner::WebTestProxyBase*); |
| 53 |
| 54 void Reset(); |
| 55 |
| 56 ::WebTestRunner::WebTaskList* taskList() { return &task_list_; } |
| 57 |
| 58 void SetTestIsRunning(bool); |
| 59 bool TestIsRunning() const { return test_is_running_; } |
| 60 |
| 61 bool UseMockTheme() const { return use_mock_theme_; } |
| 62 |
| 63 // WebTestRunner implementation. |
| 64 virtual bool shouldGeneratePixelResults() OVERRIDE; |
| 65 virtual bool shouldDumpAsAudio() const OVERRIDE; |
| 66 virtual void getAudioData(std::vector<unsigned char>* bufferView) const |
| 67 OVERRIDE; |
| 68 virtual bool shouldDumpBackForwardList() const OVERRIDE; |
| 69 virtual blink::WebPermissionClient* webPermissions() const OVERRIDE; |
| 70 |
| 71 // Methods used by WebTestProxyBase. |
| 72 bool shouldDumpSelectionRect() const; |
| 73 bool testRepaint() const; |
| 74 bool sweepHorizontally() const; |
| 75 bool isPrinting() const; |
| 76 bool shouldDumpAsText(); |
| 77 bool shouldDumpAsTextWithPixelResults(); |
| 78 bool shouldDumpAsMarkup(); |
| 79 bool shouldDumpChildFrameScrollPositions() const; |
| 80 bool shouldDumpChildFramesAsText() const; |
| 81 void showDevTools(const std::string& settings); |
| 82 void clearDevToolsLocalStorage(); |
| 83 void setShouldDumpAsText(bool); |
| 84 void setShouldDumpAsMarkup(bool); |
| 85 void setShouldGeneratePixelResults(bool); |
| 86 void setShouldDumpFrameLoadCallbacks(bool); |
| 87 void setShouldDumpPingLoaderCallbacks(bool); |
| 88 void setShouldEnableViewSource(bool); |
| 89 bool shouldDumpEditingCallbacks() const; |
| 90 bool shouldDumpFrameLoadCallbacks() const; |
| 91 bool shouldDumpPingLoaderCallbacks() const; |
| 92 bool shouldDumpUserGestureInFrameLoadCallbacks() const; |
| 93 bool shouldDumpTitleChanges() const; |
| 94 bool shouldDumpIconChanges() const; |
| 95 bool shouldDumpCreateView() const; |
| 96 bool canOpenWindows() const; |
| 97 bool shouldDumpResourceLoadCallbacks() const; |
| 98 bool shouldDumpResourceRequestCallbacks() const; |
| 99 bool shouldDumpResourceResponseMIMETypes() const; |
| 100 bool shouldDumpStatusCallbacks() const; |
| 101 bool shouldDumpProgressFinishedCallback() const; |
| 102 bool shouldDumpSpellCheckCallbacks() const; |
| 103 bool shouldStayOnPageAfterHandlingBeforeUnload() const; |
| 104 const std::set<std::string>* httpHeadersToClear() const; |
| 105 void setTopLoadingFrame(blink::WebFrame*, bool); |
| 106 blink::WebFrame* topLoadingFrame() const; |
| 107 void policyDelegateDone(); |
| 108 bool policyDelegateEnabled() const; |
| 109 bool policyDelegateIsPermissive() const; |
| 110 bool policyDelegateShouldNotifyDone() const; |
| 111 bool shouldInterceptPostMessage() const; |
| 112 bool shouldDumpResourcePriorities() const; |
| 113 blink::WebNotificationPresenter* notification_presenter() const; |
| 114 bool RequestPointerLock(); |
| 115 void RequestPointerUnlock(); |
| 116 bool isPointerLocked(); |
| 117 void setToolTipText(const blink::WebString&); |
| 118 |
| 119 bool midiAccessorResult(); |
| 120 |
| 121 // A single item in the work queue. |
| 122 class WorkItem { |
| 123 public: |
| 124 virtual ~WorkItem() {} |
| 125 |
| 126 // Returns true if this started a load. |
| 127 virtual bool Run(::WebTestRunner::WebTestDelegate*, blink::WebView*) = 0; |
| 128 }; |
| 129 |
| 130 private: |
| 131 friend class InvokeCallbackTask; |
| 132 friend class TestRunnerBindings; |
| 133 friend class WorkQueue; |
| 134 |
| 135 // Helper class for managing events queued by methods like queueLoad or |
| 136 // queueScript. |
| 137 class WorkQueue { |
| 138 public: |
| 139 explicit WorkQueue(TestRunner* controller); |
| 140 virtual ~WorkQueue(); |
| 141 void ProcessWorkSoon(); |
| 142 |
| 143 // Reset the state of the class between tests. |
| 144 void Reset(); |
| 145 |
| 146 void AddWork(WorkItem*); |
| 147 |
| 148 void set_frozen(bool frozen) { frozen_ = frozen; } |
| 149 bool is_empty() { return queue_.empty(); } |
| 150 ::WebTestRunner::WebTaskList* taskList() { return &task_list_; } |
| 151 |
| 152 private: |
| 153 void ProcessWork(); |
| 154 |
| 155 class WorkQueueTask : public ::WebTestRunner::WebMethodTask<WorkQueue> { |
| 156 public: |
| 157 WorkQueueTask(WorkQueue* object) : |
| 158 ::WebTestRunner::WebMethodTask<WorkQueue>(object) { } |
| 159 |
| 160 virtual void runIfValid() OVERRIDE; |
| 161 }; |
| 162 |
| 163 ::WebTestRunner::WebTaskList task_list_; |
| 164 std::deque<WorkItem*> queue_; |
| 165 bool frozen_; |
| 166 TestRunner* controller_; |
| 167 }; |
| 168 |
| 169 /////////////////////////////////////////////////////////////////////////// |
| 170 // Methods dealing with the test logic |
| 171 |
| 172 // By default, tests end when page load is complete. These methods are used |
| 173 // to delay the completion of the test until notifyDone is called. |
| 174 void NotifyDone(); |
| 175 void WaitUntilDone(); |
| 176 |
| 177 // Methods for adding actions to the work queue. Used in conjunction with |
| 178 // waitUntilDone/notifyDone above. |
| 179 void QueueBackNavigation(int how_far_back); |
| 180 void QueueForwardNavigation(int how_far_forward); |
| 181 void QueueReload(); |
| 182 void QueueLoadingScript(const std::string& script); |
| 183 void QueueNonLoadingScript(const std::string& script); |
| 184 void QueueLoad(const std::string& url, const std::string& target); |
| 185 void QueueLoadHTMLString(gin::Arguments* args); |
| 186 |
| 187 // Causes navigation actions just printout the intended navigation instead |
| 188 // of taking you to the page. This is used for cases like mailto, where you |
| 189 // don't actually want to open the mail program. |
| 190 void SetCustomPolicyDelegate(gin::Arguments* args); |
| 191 |
| 192 // Delays completion of the test until the policy delegate runs. |
| 193 void WaitForPolicyDelegate(); |
| 194 |
| 195 // Functions for dealing with windows. By default we block all new windows. |
| 196 int WindowCount(); |
| 197 void SetCloseRemainingWindowsWhenComplete(bool close_remaining_windows); |
| 198 void ResetTestHelperControllers(); |
| 199 |
| 200 /////////////////////////////////////////////////////////////////////////// |
| 201 // Methods implemented entirely in terms of chromium's public WebKit API |
| 202 |
| 203 // Method that controls whether pressing Tab key cycles through page elements |
| 204 // or inserts a '\t' char in text area |
| 205 void SetTabKeyCyclesThroughElements(bool tab_key_cycles_through_elements); |
| 206 |
| 207 // Executes an internal command (superset of document.execCommand() commands). |
| 208 void ExecCommand(gin::Arguments* args); |
| 209 |
| 210 // Checks if an internal command is currently available. |
| 211 bool IsCommandEnabled(const std::string& command); |
| 212 |
| 213 bool CallShouldCloseOnWebView(); |
| 214 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, |
| 215 const std::string& scheme); |
| 216 v8::Handle<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( |
| 217 int world_id, const std::string& script); |
| 218 void EvaluateScriptInIsolatedWorld(int world_id, const std::string& script); |
| 219 void SetIsolatedWorldSecurityOrigin(int world_id, |
| 220 v8::Handle<v8::Value> origin); |
| 221 void SetIsolatedWorldContentSecurityPolicy(int world_id, |
| 222 const std::string& policy); |
| 223 |
| 224 // Allows layout tests to manage origins' whitelisting. |
| 225 void AddOriginAccessWhitelistEntry(const std::string& source_origin, |
| 226 const std::string& destination_protocol, |
| 227 const std::string& destination_host, |
| 228 bool allow_destination_subdomains); |
| 229 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
| 230 const std::string& destination_protocol, |
| 231 const std::string& destination_host, |
| 232 bool allow_destination_subdomains); |
| 233 |
| 234 // Returns true if the current page box has custom page size style for |
| 235 // printing. |
| 236 bool HasCustomPageSizeStyle(int page_index); |
| 237 |
| 238 // Forces the selection colors for testing under Linux. |
| 239 void ForceRedSelectionColors(); |
| 240 |
| 241 // Adds a style sheet to be injected into new documents. |
| 242 void InjectStyleSheet(const std::string& source_code, bool all_frames); |
| 243 |
| 244 bool FindString(const std::string& search_text, |
| 245 const std::vector<std::string>& options_array); |
| 246 |
| 247 std::string SelectionAsMarkup(); |
| 248 |
| 249 // Enables or disables subpixel positioning (i.e. fractional X positions for |
| 250 // glyphs) in text rendering on Linux. Since this method changes global |
| 251 // settings, tests that call it must use their own custom font family for |
| 252 // all text that they render. If not, an already-cached style will be used, |
| 253 // resulting in the changed setting being ignored. |
| 254 void SetTextSubpixelPositioning(bool value); |
| 255 |
| 256 // Switch the visibility of the page. |
| 257 void SetPageVisibility(const std::string& new_visibility); |
| 258 |
| 259 // Changes the direction of the focused element. |
| 260 void SetTextDirection(const std::string& direction_name); |
| 261 |
| 262 // After this function is called, all window-sizing machinery is |
| 263 // short-circuited inside the renderer. This mode is necessary for |
| 264 // some tests that were written before browsers had multi-process architecture |
| 265 // and rely on window resizes to happen synchronously. |
| 266 // The function has "unfortunate" it its name because we must strive to remove |
| 267 // all tests that rely on this... well, unfortunate behavior. See |
| 268 // http://crbug.com/309760 for the plan. |
| 269 void UseUnfortunateSynchronousResizeMode(); |
| 270 |
| 271 bool EnableAutoResizeMode(int min_width, |
| 272 int min_height, |
| 273 int max_width, |
| 274 int max_height); |
| 275 bool DisableAutoResizeMode(int new_width, int new_height); |
| 276 |
| 277 // Device Motion / Device Orientation related functions |
| 278 void SetMockDeviceMotion(bool has_acceleration_x, double acceleration_x, |
| 279 bool has_acceleration_y, double acceleration_y, |
| 280 bool has_acceleration_z, double acceleration_z, |
| 281 bool has_acceleration_including_gravity_x, |
| 282 double acceleration_including_gravity_x, |
| 283 bool has_acceleration_including_gravity_y, |
| 284 double acceleration_including_gravity_y, |
| 285 bool has_acceleration_including_gravity_z, |
| 286 double acceleration_including_gravity_z, |
| 287 bool has_rotation_rate_alpha, |
| 288 double rotation_rate_alpha, |
| 289 bool has_rotation_rate_beta, |
| 290 double rotation_rate_beta, |
| 291 bool has_rotation_rate_gamma, |
| 292 double rotation_rate_gamma, |
| 293 double interval); |
| 294 void SetMockDeviceOrientation(bool has_alpha, double alpha, |
| 295 bool has_beta, double beta, |
| 296 bool has_gamma, double gamma, |
| 297 bool has_absolute, bool absolute); |
| 298 |
| 299 void DidAcquirePointerLock(); |
| 300 void DidNotAcquirePointerLock(); |
| 301 void DidLosePointerLock(); |
| 302 void SetPointerLockWillFailSynchronously(); |
| 303 void SetPointerLockWillRespondAsynchronously(); |
| 304 |
| 305 /////////////////////////////////////////////////////////////////////////// |
| 306 // Methods modifying WebPreferences. |
| 307 |
| 308 // Set the WebPreference that controls webkit's popup blocking. |
| 309 void SetPopupBlockingEnabled(bool block_popups); |
| 310 |
| 311 void SetJavaScriptCanAccessClipboard(bool can_access); |
| 312 void SetXSSAuditorEnabled(bool enabled); |
| 313 void SetAllowUniversalAccessFromFileURLs(bool allow); |
| 314 void SetAllowFileAccessFromFileURLs(bool allow); |
| 315 void OverridePreference(const std::string key, v8::Handle<v8::Value> value); |
| 316 |
| 317 // Enable or disable plugins. |
| 318 void SetPluginsEnabled(bool enabled); |
| 319 |
| 320 /////////////////////////////////////////////////////////////////////////// |
| 321 // Methods that modify the state of TestRunner |
| 322 |
| 323 // This function sets a flag that tells the test_shell to print a line of |
| 324 // descriptive text for each editing command. It takes no arguments, and |
| 325 // ignores any that may be present. |
| 326 void DumpEditingCallbacks(); |
| 327 |
| 328 // This function sets a flag that tells the test_shell to dump pages as |
| 329 // plain text, rather than as a text representation of the renderer's state. |
| 330 // The pixel results will not be generated for this test. |
| 331 void DumpAsText(); |
| 332 |
| 333 // This function sets a flag that tells the test_shell to dump pages as |
| 334 // plain text, rather than as a text representation of the renderer's state. |
| 335 // It will also generate a pixel dump for the test. |
| 336 void DumpAsTextWithPixelResults(); |
| 337 |
| 338 // This function sets a flag that tells the test_shell to print out the |
| 339 // scroll offsets of the child frames. It ignores all. |
| 340 void DumpChildFrameScrollPositions(); |
| 341 |
| 342 // This function sets a flag that tells the test_shell to recursively |
| 343 // dump all frames as plain text if the DumpAsText flag is set. |
| 344 // It takes no arguments, and ignores any that may be present. |
| 345 void DumpChildFramesAsText(); |
| 346 |
| 347 // This function sets a flag that tells the test_shell to print out the |
| 348 // information about icon changes notifications from WebKit. |
| 349 void DumpIconChanges(); |
| 350 |
| 351 // Deals with Web Audio WAV file data. |
| 352 void SetAudioData(const gin::ArrayBufferView& view); |
| 353 |
| 354 // This function sets a flag that tells the test_shell to print a line of |
| 355 // descriptive text for each frame load callback. It takes no arguments, and |
| 356 // ignores any that may be present. |
| 357 void DumpFrameLoadCallbacks(); |
| 358 |
| 359 // This function sets a flag that tells the test_shell to print a line of |
| 360 // descriptive text for each PingLoader dispatch. It takes no arguments, and |
| 361 // ignores any that may be present. |
| 362 void DumpPingLoaderCallbacks(); |
| 363 |
| 364 // This function sets a flag that tells the test_shell to print a line of |
| 365 // user gesture status text for some frame load callbacks. It takes no |
| 366 // arguments, and ignores any that may be present. |
| 367 void DumpUserGestureInFrameLoadCallbacks(); |
| 368 |
| 369 void DumpTitleChanges(); |
| 370 |
| 371 // This function sets a flag that tells the test_shell to dump all calls to |
| 372 // WebViewClient::createView(). |
| 373 // It takes no arguments, and ignores any that may be present. |
| 374 void DumpCreateView(); |
| 375 |
| 376 void SetCanOpenWindows(); |
| 377 |
| 378 // This function sets a flag that tells the test_shell to dump a descriptive |
| 379 // line for each resource load callback. It takes no arguments, and ignores |
| 380 // any that may be present. |
| 381 void DumpResourceLoadCallbacks(); |
| 382 |
| 383 // This function sets a flag that tells the test_shell to print a line of |
| 384 // descriptive text for each element that requested a resource. It takes no |
| 385 // arguments, and ignores any that may be present. |
| 386 void DumpResourceRequestCallbacks(); |
| 387 |
| 388 // This function sets a flag that tells the test_shell to dump the MIME type |
| 389 // for each resource that was loaded. It takes no arguments, and ignores any |
| 390 // that may be present. |
| 391 void DumpResourceResponseMIMETypes(); |
| 392 |
| 393 // WebPermissionClient related. |
| 394 void SetImagesAllowed(bool allowed); |
| 395 void SetScriptsAllowed(bool allowed); |
| 396 void SetStorageAllowed(bool allowed); |
| 397 void SetPluginsAllowed(bool allowed); |
| 398 void SetAllowDisplayOfInsecureContent(bool allowed); |
| 399 void SetAllowRunningOfInsecureContent(bool allowed); |
| 400 void DumpPermissionClientCallbacks(); |
| 401 |
| 402 // This function sets a flag that tells the test_shell to dump all calls |
| 403 // to window.status(). |
| 404 // It takes no arguments, and ignores any that may be present. |
| 405 void DumpWindowStatusChanges(); |
| 406 |
| 407 // This function sets a flag that tells the test_shell to print a line of |
| 408 // descriptive text for the progress finished callback. It takes no |
| 409 // arguments, and ignores any that may be present. |
| 410 void DumpProgressFinishedCallback(); |
| 411 |
| 412 // This function sets a flag that tells the test_shell to dump all |
| 413 // the lines of descriptive text about spellcheck execution. |
| 414 void DumpSpellCheckCallbacks(); |
| 415 |
| 416 // This function sets a flag that tells the test_shell to print out a text |
| 417 // representation of the back/forward list. It ignores all arguments. |
| 418 void DumpBackForwardList(); |
| 419 |
| 420 void DumpSelectionRect(); |
| 421 void TestRepaint(); |
| 422 void RepaintSweepHorizontally(); |
| 423 |
| 424 // Causes layout to happen as if targetted to printed pages. |
| 425 void SetPrinting(); |
| 426 |
| 427 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); |
| 428 |
| 429 // Causes WillSendRequest to clear certain headers. |
| 430 void SetWillSendRequestClearHeader(const std::string& header); |
| 431 |
| 432 // This function sets a flag that tells the test_shell to dump a descriptive |
| 433 // line for each resource load's priority and any time that priority |
| 434 // changes. It takes no arguments, and ignores any that may be present. |
| 435 void DumpResourceRequestPriorities(); |
| 436 |
| 437 // Sets a flag to enable the mock theme. |
| 438 void SetUseMockTheme(bool use); |
| 439 |
| 440 /////////////////////////////////////////////////////////////////////////// |
| 441 // Methods interacting with the WebTestProxy |
| 442 |
| 443 /////////////////////////////////////////////////////////////////////////// |
| 444 // Methods forwarding to the WebTestDelegate |
| 445 |
| 446 // Shows DevTools window. |
| 447 void ShowWebInspector(const std::string& str); |
| 448 void CloseWebInspector(); |
| 449 |
| 450 // Inspect chooser state |
| 451 bool IsChooserShown(); |
| 452 |
| 453 // Allows layout tests to exec scripts at WebInspector side. |
| 454 void EvaluateInWebInspector(int call_id, const std::string& script); |
| 455 |
| 456 // Clears all databases. |
| 457 void ClearAllDatabases(); |
| 458 // Sets the default quota for all origins |
| 459 void SetDatabaseQuota(int quota); |
| 460 |
| 461 // Changes the cookie policy from the default to allow all cookies. |
| 462 void SetAlwaysAcceptCookies(bool accept); |
| 463 |
| 464 // Gives focus to the window. |
| 465 void SetWindowIsKey(bool value); |
| 466 |
| 467 // Converts a URL starting with file:///tmp/ to the local mapping. |
| 468 std::string PathToLocalResource(const std::string& path); |
| 469 |
| 470 // Used to set the device scale factor. |
| 471 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); |
| 472 |
| 473 // Calls setlocale(LC_ALL, ...) for a specified locale. |
| 474 // Resets between tests. |
| 475 void SetPOSIXLocale(const std::string& locale); |
| 476 |
| 477 // MIDI function to control permission handling. |
| 478 void SetMIDIAccessorResult(bool result); |
| 479 void SetMIDISysExPermission(bool value); |
| 480 |
| 481 // Grants permission for desktop notifications to an origin |
| 482 void GrantWebNotificationPermission(const std::string& origin, |
| 483 bool permission_granted); |
| 484 // Simulates a click on a desktop notification. |
| 485 bool SimulateWebNotificationClick(const std::string& value); |
| 486 |
| 487 // Speech input related functions. |
| 488 void AddMockSpeechInputResult(const std::string& result, |
| 489 double confidence, |
| 490 const std::string& language); |
| 491 void SetMockSpeechInputDumpRect(bool value); |
| 492 void AddMockSpeechRecognitionResult(const std::string& transcript, |
| 493 double confidence); |
| 494 void SetMockSpeechRecognitionError(const std::string& error, |
| 495 const std::string& message); |
| 496 bool WasMockSpeechRecognitionAborted(); |
| 497 |
| 498 // WebPageOverlay related functions. Permits the adding and removing of only |
| 499 // one opaque overlay. |
| 500 void AddWebPageOverlay(); |
| 501 void RemoveWebPageOverlay(); |
| 502 |
| 503 void Display(); |
| 504 void DisplayInvalidatedRegion(); |
| 505 |
| 506 /////////////////////////////////////////////////////////////////////////// |
| 507 // Internal helpers |
| 508 void CheckResponseMimeType(); |
| 509 void CompleteNotifyDone(); |
| 510 |
| 511 void DidAcquirePointerLockInternal(); |
| 512 void DidNotAcquirePointerLockInternal(); |
| 513 void DidLosePointerLockInternal(); |
| 514 |
| 515 // In the Mac code, this is called to trigger the end of a test after the |
| 516 // page has finished loading. From here, we can generate the dump for the |
| 517 // test. |
| 518 void LocationChangeDone(); |
| 519 |
| 520 bool test_is_running_; |
| 521 |
| 522 // When reset is called, go through and close all but the main test shell |
| 523 // window. By default, set to true but toggled to false using |
| 524 // setCloseRemainingWindowsWhenComplete(). |
| 525 bool close_remaining_windows_; |
| 526 |
| 527 // If true, don't dump output until notifyDone is called. |
| 528 bool wait_until_done_; |
| 529 |
| 530 // Causes navigation actions just printout the intended navigation instead |
| 531 // of taking you to the page. This is used for cases like mailto, where you |
| 532 // don't actually want to open the mail program. |
| 533 bool policy_delegate_enabled_; |
| 534 |
| 535 // Toggles the behavior of the policy delegate. If true, then navigations |
| 536 // will be allowed. Otherwise, they will be ignored (dropped). |
| 537 bool policy_delegate_is_permissive_; |
| 538 |
| 539 // If true, the policy delegate will signal layout test completion. |
| 540 bool policy_delegate_should_notify_done_; |
| 541 |
| 542 WorkQueue work_queue_; |
| 543 |
| 544 // Used by a number of layout tests in http/tests/security/dataURL. |
| 545 bool global_flag_; |
| 546 |
| 547 // Bound variable to return the name of this platform (chromium). |
| 548 std::string platform_name_; |
| 549 |
| 550 // Bound variable to store the last tooltip text |
| 551 std::string tooltip_text_; |
| 552 |
| 553 // Bound variable to disable notifyDone calls. This is used in GC leak |
| 554 // tests, where existing LayoutTests are loaded within an iframe. The GC |
| 555 // test harness will set this flag to ignore the notifyDone calls from the |
| 556 // target LayoutTest. |
| 557 bool disable_notify_done_; |
| 558 |
| 559 // Bound variable counting the number of top URLs visited. |
| 560 int web_history_item_count_; |
| 561 |
| 562 // Bound variable to set whether postMessages should be intercepted or not |
| 563 bool intercept_post_message_; |
| 564 |
| 565 // If true, the test_shell will write a descriptive line for each editing |
| 566 // command. |
| 567 bool dump_editting_callbacks_; |
| 568 |
| 569 // If true, the test_shell will generate pixel results in DumpAsText mode |
| 570 bool generate_pixel_results_; |
| 571 |
| 572 // If true, the test_shell will produce a plain text dump rather than a |
| 573 // text representation of the renderer. |
| 574 bool dump_as_text_; |
| 575 |
| 576 // If true and if dump_as_text_ is true, the test_shell will recursively |
| 577 // dump all frames as plain text. |
| 578 bool dump_child_frames_as_text_; |
| 579 |
| 580 // If true, the test_shell will produce a dump of the DOM rather than a text |
| 581 // representation of the renderer. |
| 582 bool dump_as_markup_; |
| 583 |
| 584 // If true, the test_shell will print out the child frame scroll offsets as |
| 585 // well. |
| 586 bool dump_child_frame_scroll_positions_; |
| 587 |
| 588 // If true, the test_shell will print out the icon change notifications. |
| 589 bool dump_icon_changes_; |
| 590 |
| 591 // If true, the test_shell will output a base64 encoded WAVE file. |
| 592 bool dump_as_audio_; |
| 593 |
| 594 // If true, the test_shell will output a descriptive line for each frame |
| 595 // load callback. |
| 596 bool dump_frame_load_callbacks_; |
| 597 |
| 598 // If true, the test_shell will output a descriptive line for each |
| 599 // PingLoader dispatched. |
| 600 bool dump_ping_loader_callbacks_; |
| 601 |
| 602 // If true, the test_shell will output a line of the user gesture status |
| 603 // text for some frame load callbacks. |
| 604 bool dump_user_gesture_in_frame_load_callbacks_; |
| 605 |
| 606 // If true, output a message when the page title is changed. |
| 607 bool dump_title_changes_; |
| 608 |
| 609 // If true, output a descriptive line each time WebViewClient::createView |
| 610 // is invoked. |
| 611 bool dump_create_view_; |
| 612 |
| 613 // If true, new windows can be opened via javascript or by plugins. By |
| 614 // default, set to false and can be toggled to true using |
| 615 // setCanOpenWindows(). |
| 616 bool can_open_windows_; |
| 617 |
| 618 // If true, the test_shell will output a descriptive line for each resource |
| 619 // load callback. |
| 620 bool dump_resource_load_callbacks_; |
| 621 |
| 622 // If true, the test_shell will output a descriptive line for each resource |
| 623 // request callback. |
| 624 bool dump_resource_request_callbacks_; |
| 625 |
| 626 // If true, the test_shell will output the MIME type for each resource that |
| 627 // was loaded. |
| 628 bool dump_resource_reqponse_mime_types_; |
| 629 |
| 630 // If true, the test_shell will dump all changes to window.status. |
| 631 bool dump_window_status_changes_; |
| 632 |
| 633 // If true, the test_shell will output a descriptive line for the progress |
| 634 // finished callback. |
| 635 bool dump_progress_finished_callback_; |
| 636 |
| 637 // If true, the test_shell will output descriptive test for spellcheck |
| 638 // execution. |
| 639 bool dump_spell_check_callbacks_; |
| 640 |
| 641 // If true, the test_shell will produce a dump of the back forward list as |
| 642 // well. |
| 643 bool dump_back_forward_list_; |
| 644 |
| 645 // If true, the test_shell will draw the bounds of the current selection rect |
| 646 // taking possible transforms of the selection rect into account. |
| 647 bool dump_selection_rect_; |
| 648 |
| 649 // If true, pixel dump will be produced as a series of 1px-tall, view-wide |
| 650 // individual paints over the height of the view. |
| 651 bool test_repaint_; |
| 652 |
| 653 // If true and test_repaint_ is true as well, pixel dump will be produced as |
| 654 // a series of 1px-wide, view-tall paints across the width of the view. |
| 655 bool sweep_horizontally_; |
| 656 |
| 657 // If true, layout is to target printed pages. |
| 658 bool is_printing_; |
| 659 |
| 660 // If false, MockWebMIDIAccessor fails on startSession() for testing. |
| 661 bool midi_accessor_result_; |
| 662 |
| 663 bool should_stay_on_page_after_handling_before_unload_; |
| 664 |
| 665 bool should_dump_resource_priorities_; |
| 666 |
| 667 std::set<std::string> http_headers_to_clear_; |
| 668 |
| 669 // WAV audio data is stored here. |
| 670 std::vector<unsigned char> audio_data_; |
| 671 |
| 672 // Used for test timeouts. |
| 673 ::WebTestRunner::WebTaskList task_list_; |
| 674 |
| 675 ::WebTestRunner::TestInterfaces* test_interfaces_; |
| 676 ::WebTestRunner::WebTestDelegate* delegate_; |
| 677 blink::WebView* web_view_; |
| 678 TestPageOverlay* page_overlay_; |
| 679 ::WebTestRunner::WebTestProxyBase* proxy_; |
| 680 |
| 681 // This is non-0 IFF a load is in progress. |
| 682 blink::WebFrame* top_loading_frame_; |
| 683 |
| 684 // WebPermissionClient mock object. |
| 685 scoped_ptr< ::WebTestRunner::WebPermissions> web_permissions_; |
| 686 |
| 687 scoped_ptr<content::NotificationPresenter> notification_presenter_; |
| 688 |
| 689 bool pointer_locked_; |
| 690 enum { |
| 691 PointerLockWillSucceed, |
| 692 PointerLockWillRespondAsync, |
| 693 PointerLockWillFailSync, |
| 694 } pointer_lock_planned_result_; |
| 695 bool use_mock_theme_; |
| 696 |
| 697 base::WeakPtrFactory<TestRunner> weak_factory_; |
| 698 |
| 699 DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 700 }; |
| 701 |
| 702 } // namespace content |
| 703 |
| 704 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_RUNNER_H_ |
OLD | NEW |