Chromium Code Reviews| 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, double 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 bool GrantWebNotificationPermission(const std::string& value); | |
| 483 // Simulates a click on a desktop notification. | |
| 484 bool SimulateLegacyWebNotificationClick(const std::string& value); | |
| 485 // Cancel all active desktop notifications. | |
| 486 bool CancelAllActiveNotifications(); | |
| 487 | |
| 488 // Speech input related functions. | |
| 489 void AddMockSpeechInputResult(const std::string& result, | |
| 490 double confidence, | |
| 491 const std::string& language); | |
| 492 void SetMockSpeechInputDumpRect(bool value); | |
| 493 void AddMockSpeechRecognitionResult(const std::string& transcript, | |
| 494 double confidence); | |
| 495 void SetMockSpeechRecognitionError(const std::string& error, | |
| 496 const std::string& message); | |
| 497 bool WasMockSpeechRecognitionAborted(); | |
| 498 | |
| 499 // WebPageOverlay related functions. Permits the adding and removing of only | |
| 500 // one opaque overlay. | |
| 501 void AddWebPageOverlay(); | |
| 502 void RemoveWebPageOverlay(); | |
| 503 | |
| 504 void Display(); | |
| 505 void DisplayInvalidatedRegion(); | |
| 506 | |
| 507 /////////////////////////////////////////////////////////////////////////// | |
| 508 // Internal helpers | |
| 509 void CheckResponseMimeType(); | |
| 510 void CompleteNotifyDone(); | |
| 511 | |
| 512 void DidAcquirePointerLockInternal(); | |
| 513 void DidNotAcquirePointerLockInternal(); | |
| 514 void DidLosePointerLockInternal(); | |
| 515 | |
| 516 // In the Mac code, this is called to trigger the end of a test after the | |
| 517 // page has finished loading. From here, we can generate the dump for the | |
| 518 // test. | |
| 519 void LocationChangeDone(); | |
| 520 | |
| 521 bool test_is_running_; | |
| 522 | |
| 523 // When reset is called, go through and close all but the main test shell | |
| 524 // window. By default, set to true but toggled to false using | |
| 525 // setCloseRemainingWindowsWhenComplete(). | |
| 526 bool close_remaining_windows_; | |
| 527 | |
| 528 // If true, don't dump output until notifyDone is called. | |
| 529 bool wait_until_done_; | |
| 530 | |
| 531 // Causes navigation actions just printout the intended navigation instead | |
| 532 // of taking you to the page. This is used for cases like mailto, where you | |
| 533 // don't actually want to open the mail program. | |
| 534 bool policy_delegate_enabled_; | |
| 535 | |
| 536 // Toggles the behavior of the policy delegate. If true, then navigations | |
| 537 // will be allowed. Otherwise, they will be ignored (dropped). | |
| 538 bool policy_delegate_is_permissive_; | |
| 539 | |
| 540 // If true, the policy delegate will signal layout test completion. | |
| 541 bool policy_delegate_should_notify_done_; | |
| 542 | |
| 543 WorkQueue work_queue_; | |
| 544 | |
| 545 // Used by a number of layout tests in http/tests/security/dataURL. | |
| 546 v8::Persistent<v8::Value> global_flag_; | |
| 547 | |
| 548 // Bound variable to return the name of this platform (chromium). | |
| 549 std::string platform_name_; | |
| 550 | |
| 551 // Bound variable to store the last tooltip text | |
| 552 std::string tooltip_text_; | |
| 553 | |
| 554 // Bound variable to disable notifyDone calls. This is used in GC leak | |
| 555 // tests, where existing LayoutTests are loaded within an iframe. The GC | |
| 556 // test harness will set this flag to ignore the notifyDone calls from the | |
| 557 // target LayoutTest. | |
| 558 bool disable_notify_done_; | |
| 559 | |
| 560 // Bound variable counting the number of top URLs visited. | |
| 561 int web_history_item_count_; | |
| 562 | |
| 563 // Bound variable to set whether postMessages should be intercepted or not | |
| 564 bool intercept_post_message_; | |
| 565 | |
| 566 // If true, the test_shell will write a descriptive line for each editing | |
| 567 // command. | |
| 568 bool dump_editting_callbacks_; | |
| 569 | |
| 570 // If true, the test_shell will generate pixel results in DumpAsText mode | |
| 571 bool generate_pixel_results_; | |
| 572 | |
| 573 // If true, the test_shell will produce a plain text dump rather than a | |
| 574 // text representation of the renderer. | |
| 575 bool dump_as_text_; | |
| 576 | |
| 577 // If true and if dump_as_text_ is true, the test_shell will recursively | |
| 578 // dump all frames as plain text. | |
| 579 bool dump_child_frames_as_text_; | |
| 580 | |
| 581 // If true, the test_shell will produce a dump of the DOM rather than a text | |
| 582 // representation of the renderer. | |
| 583 bool dump_as_markup_; | |
| 584 | |
| 585 // If true, the test_shell will print out the child frame scroll offsets as | |
| 586 // well. | |
| 587 bool dump_child_frame_scroll_positions_; | |
| 588 | |
| 589 // If true, the test_shell will print out the icon change notifications. | |
| 590 bool dump_icon_changes_; | |
| 591 | |
| 592 // If true, the test_shell will output a base64 encoded WAVE file. | |
| 593 bool dump_as_audio_; | |
| 594 | |
| 595 // If true, the test_shell will output a descriptive line for each frame | |
| 596 // load callback. | |
| 597 bool dump_frame_load_callbacks_; | |
| 598 | |
| 599 // If true, the test_shell will output a descriptive line for each | |
| 600 // PingLoader dispatched. | |
| 601 bool dump_ping_loader_callbacks_; | |
| 602 | |
| 603 // If true, the test_shell will output a line of the user gesture status | |
| 604 // text for some frame load callbacks. | |
| 605 bool dump_user_gesture_in_frame_load_callbacks_; | |
| 606 | |
| 607 // If true, output a message when the page title is changed. | |
| 608 bool dump_title_changes_; | |
| 609 | |
| 610 // If true, output a descriptive line each time WebViewClient::createView | |
| 611 // is invoked. | |
| 612 bool dump_create_view_; | |
| 613 | |
| 614 // If true, new windows can be opened via javascript or by plugins. By | |
| 615 // default, set to false and can be toggled to true using | |
| 616 // setCanOpenWindows(). | |
| 617 bool can_open_windows_; | |
| 618 | |
| 619 // If true, the test_shell will output a descriptive line for each resource | |
| 620 // load callback. | |
| 621 bool dump_resource_load_callbacks_; | |
| 622 | |
| 623 // If true, the test_shell will output a descriptive line for each resource | |
| 624 // request callback. | |
| 625 bool dump_resource_request_callbacks_; | |
| 626 | |
| 627 // If true, the test_shell will output the MIME type for each resource that | |
| 628 // was loaded. | |
| 629 bool dump_resource_reqponse_mime_types_; | |
| 630 | |
| 631 // If true, the test_shell will dump all changes to window.status. | |
| 632 bool dump_window_status_changes_; | |
| 633 | |
| 634 // If true, the test_shell will output a descriptive line for the progress | |
| 635 // finished callback. | |
| 636 bool dump_progress_finished_callback_; | |
| 637 | |
| 638 // If true, the test_shell will output descriptive test for spellcheck | |
| 639 // execution. | |
| 640 bool dump_spell_check_callbacks_; | |
| 641 | |
| 642 // If true, the test_shell will produce a dump of the back forward list as | |
| 643 // well. | |
| 644 bool dump_back_forward_list_; | |
| 645 | |
| 646 // If true, the test_shell will draw the bounds of the current selection rect | |
| 647 // taking possible transforms of the selection rect into account. | |
| 648 bool dump_selection_rect_; | |
| 649 | |
| 650 // If true, pixel dump will be produced as a series of 1px-tall, view-wide | |
| 651 // individual paints over the height of the view. | |
| 652 bool test_repaint_; | |
| 653 | |
| 654 // If true and test_repaint_ is true as well, pixel dump will be produced as | |
| 655 // a series of 1px-wide, view-tall paints across the width of the view. | |
| 656 bool sweep_horizontally_; | |
| 657 | |
| 658 // If true, layout is to target printed pages. | |
| 659 bool is_printing_; | |
| 660 | |
| 661 // If false, MockWebMIDIAccessor fails on startSession() for testing. | |
| 662 bool midi_accessor_result_; | |
| 663 | |
| 664 bool should_stay_on_page_after_handling_before_unload_; | |
| 665 | |
| 666 bool should_dump_resource_priorities_; | |
| 667 | |
| 668 std::set<std::string> http_headers_to_clear_; | |
| 669 | |
| 670 // WAV audio data is stored here. | |
| 671 std::vector<unsigned char> audio_data_; | |
| 672 | |
| 673 // Used for test timeouts. | |
| 674 ::WebTestRunner::WebTaskList task_list_; | |
| 675 | |
| 676 ::WebTestRunner::TestInterfaces* test_interfaces_; | |
| 677 ::WebTestRunner::WebTestDelegate* delegate_; | |
| 678 blink::WebView* web_view_; | |
| 679 TestPageOverlay* page_overlay_; | |
| 680 ::WebTestRunner::WebTestProxyBase* proxy_; | |
| 681 | |
| 682 // This is non-0 IFF a load is in progress. | |
| 683 blink::WebFrame* top_loading_frame_; | |
| 684 | |
| 685 // WebPermissionClient mock object. | |
| 686 scoped_ptr<::WebTestRunner::WebPermissions> web_permissions_; | |
|
kouhei (in TOK)
2014/03/06 11:49:36
scoped_ptr< ::WebT
^^^^^you need a space
hajimehoshi
2014/03/06 13:01:11
Out of curiosity, I'd like to know the reason.
hajimehoshi
2014/03/06 13:49:47
I understood it by reading the compile errors. Tha
| |
| 687 | |
| 688 scoped_ptr<content::NotificationPresenter> notification_presenter_; | |
| 689 | |
| 690 bool pointer_locked_; | |
| 691 enum { | |
| 692 PointerLockWillSucceed, | |
| 693 PointerLockWillRespondAsync, | |
| 694 PointerLockWillFailSync, | |
| 695 } pointer_lock_planned_result_; | |
| 696 bool use_mock_theme_; | |
| 697 | |
| 698 base::WeakPtrFactory<TestRunner> weak_factory_; | |
| 699 | |
| 700 DISALLOW_COPY_AND_ASSIGN(TestRunner); | |
| 701 }; | |
| 702 | |
| 703 } // namespace content | |
| 704 | |
| 705 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_RUNNER_H_ | |
| OLD | NEW |