Enable right clicking on the applist doodle web contents and log the data.
[chromium-blink-merge.git] / content / shell / renderer / test_runner / test_runner.h
blobb897d3448f7bd09ae2a650f19b408f7eac3466f7
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.
5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_RUNNER_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_RUNNER_H_
8 #include <deque>
9 #include <set>
10 #include <string>
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h"
14 #include "content/shell/renderer/test_runner/web_task.h"
15 #include "content/shell/renderer/test_runner/web_test_runner.h"
16 #include "v8/include/v8.h"
18 class GURL;
19 class SkBitmap;
21 namespace blink {
22 class WebFrame;
23 class WebPermissionClient;
24 class WebString;
25 class WebView;
26 class WebURLResponse;
29 namespace gin {
30 class ArrayBufferView;
31 class Arguments;
34 namespace content {
36 class InvokeCallbackTask;
37 class TestInterfaces;
38 class TestPageOverlay;
39 class WebPermissions;
40 class WebTestDelegate;
41 class WebTestProxyBase;
43 class TestRunner : public WebTestRunner,
44 public base::SupportsWeakPtr<TestRunner> {
45 public:
46 explicit TestRunner(TestInterfaces*);
47 virtual ~TestRunner();
49 void Install(blink::WebFrame* frame);
51 void SetDelegate(WebTestDelegate*);
52 void SetWebView(blink::WebView*, WebTestProxyBase*);
54 void Reset();
56 WebTaskList* mutable_task_list() { return &task_list_; }
58 void SetTestIsRunning(bool);
59 bool TestIsRunning() const { return test_is_running_; }
61 bool UseMockTheme() const { return use_mock_theme_; }
63 void InvokeCallback(scoped_ptr<InvokeCallbackTask> callback);
65 // WebTestRunner implementation.
66 bool ShouldGeneratePixelResults() override;
67 bool ShouldDumpAsAudio() const override;
68 void GetAudioData(std::vector<unsigned char>* buffer_view) const override;
69 bool ShouldDumpBackForwardList() const override;
70 blink::WebPermissionClient* GetWebPermissions() const override;
72 // Methods used by WebTestProxyBase.
73 bool shouldDumpSelectionRect() const;
74 bool isPrinting() const;
75 bool shouldDumpAsText();
76 bool shouldDumpAsTextWithPixelResults();
77 bool shouldDumpAsCustomText() const;
78 std:: string customDumpText() const;
79 bool shouldDumpAsMarkup();
80 bool shouldDumpChildFrameScrollPositions() const;
81 bool shouldDumpChildFramesAsMarkup() const;
82 bool shouldDumpChildFramesAsText() const;
83 void ShowDevTools(const std::string& settings,
84 const std::string& frontend_url);
85 void ClearDevToolsLocalStorage();
86 void setShouldDumpAsText(bool);
87 void setShouldDumpAsMarkup(bool);
88 void setCustomTextOutput(std::string text);
89 void setShouldGeneratePixelResults(bool);
90 void setShouldDumpFrameLoadCallbacks(bool);
91 void setShouldDumpPingLoaderCallbacks(bool);
92 void setShouldEnableViewSource(bool);
93 bool shouldDumpEditingCallbacks() const;
94 bool shouldDumpFrameLoadCallbacks() const;
95 bool shouldDumpPingLoaderCallbacks() const;
96 bool shouldDumpUserGestureInFrameLoadCallbacks() const;
97 bool shouldDumpTitleChanges() const;
98 bool shouldDumpIconChanges() const;
99 bool shouldDumpCreateView() const;
100 bool canOpenWindows() const;
101 bool shouldDumpResourceLoadCallbacks() const;
102 bool shouldDumpResourceRequestCallbacks() const;
103 bool shouldDumpResourceResponseMIMETypes() const;
104 bool shouldDumpStatusCallbacks() const;
105 bool shouldDumpProgressFinishedCallback() const;
106 bool shouldDumpSpellCheckCallbacks() const;
107 bool shouldStayOnPageAfterHandlingBeforeUnload() const;
108 bool shouldWaitUntilExternalURLLoad() const;
109 const std::set<std::string>* httpHeadersToClear() const;
110 void setTopLoadingFrame(blink::WebFrame*, bool);
111 blink::WebFrame* topLoadingFrame() const;
112 void policyDelegateDone();
113 bool policyDelegateEnabled() const;
114 bool policyDelegateIsPermissive() const;
115 bool policyDelegateShouldNotifyDone() const;
116 bool shouldInterceptPostMessage() const;
117 bool shouldDumpResourcePriorities() const;
118 bool RequestPointerLock();
119 void RequestPointerUnlock();
120 bool isPointerLocked();
121 void setToolTipText(const blink::WebString&);
122 bool shouldDumpDragImage();
124 bool midiAccessorResult();
126 // A single item in the work queue.
127 class WorkItem {
128 public:
129 virtual ~WorkItem() {}
131 // Returns true if this started a load.
132 virtual bool Run(WebTestDelegate*, blink::WebView*) = 0;
135 private:
136 friend class InvokeCallbackTask;
137 friend class TestRunnerBindings;
138 friend class WorkQueue;
140 // Helper class for managing events queued by methods like queueLoad or
141 // queueScript.
142 class WorkQueue {
143 public:
144 explicit WorkQueue(TestRunner* controller);
145 virtual ~WorkQueue();
146 void ProcessWorkSoon();
148 // Reset the state of the class between tests.
149 void Reset();
151 void AddWork(WorkItem*);
153 void set_frozen(bool frozen) { frozen_ = frozen; }
154 bool is_empty() { return queue_.empty(); }
155 WebTaskList* mutable_task_list() { return &task_list_; }
157 private:
158 void ProcessWork();
160 class WorkQueueTask : public WebMethodTask<WorkQueue> {
161 public:
162 WorkQueueTask(WorkQueue* object) : WebMethodTask<WorkQueue>(object) {}
164 void RunIfValid() override;
167 WebTaskList task_list_;
168 std::deque<WorkItem*> queue_;
169 bool frozen_;
170 TestRunner* controller_;
173 ///////////////////////////////////////////////////////////////////////////
174 // Methods dealing with the test logic
176 // By default, tests end when page load is complete. These methods are used
177 // to delay the completion of the test until notifyDone is called.
178 void NotifyDone();
179 void WaitUntilDone();
181 // Methods for adding actions to the work queue. Used in conjunction with
182 // waitUntilDone/notifyDone above.
183 void QueueBackNavigation(int how_far_back);
184 void QueueForwardNavigation(int how_far_forward);
185 void QueueReload();
186 void QueueLoadingScript(const std::string& script);
187 void QueueNonLoadingScript(const std::string& script);
188 void QueueLoad(const std::string& url, const std::string& target);
189 void QueueLoadHTMLString(gin::Arguments* args);
191 // Causes navigation actions just printout the intended navigation instead
192 // of taking you to the page. This is used for cases like mailto, where you
193 // don't actually want to open the mail program.
194 void SetCustomPolicyDelegate(gin::Arguments* args);
196 // Delays completion of the test until the policy delegate runs.
197 void WaitForPolicyDelegate();
199 // Functions for dealing with windows. By default we block all new windows.
200 int WindowCount();
201 void SetCloseRemainingWindowsWhenComplete(bool close_remaining_windows);
202 void ResetTestHelperControllers();
204 ///////////////////////////////////////////////////////////////////////////
205 // Methods implemented entirely in terms of chromium's public WebKit API
207 // Method that controls whether pressing Tab key cycles through page elements
208 // or inserts a '\t' char in text area
209 void SetTabKeyCyclesThroughElements(bool tab_key_cycles_through_elements);
211 // Executes an internal command (superset of document.execCommand() commands).
212 void ExecCommand(gin::Arguments* args);
214 // Checks if an internal command is currently available.
215 bool IsCommandEnabled(const std::string& command);
217 bool CallShouldCloseOnWebView();
218 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden,
219 const std::string& scheme);
220 v8::Handle<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue(
221 int world_id, const std::string& script);
222 void EvaluateScriptInIsolatedWorld(int world_id, const std::string& script);
223 void SetIsolatedWorldSecurityOrigin(int world_id,
224 v8::Handle<v8::Value> origin);
225 void SetIsolatedWorldContentSecurityPolicy(int world_id,
226 const std::string& policy);
228 // Allows layout tests to manage origins' whitelisting.
229 void AddOriginAccessWhitelistEntry(const std::string& source_origin,
230 const std::string& destination_protocol,
231 const std::string& destination_host,
232 bool allow_destination_subdomains);
233 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin,
234 const std::string& destination_protocol,
235 const std::string& destination_host,
236 bool allow_destination_subdomains);
238 // Returns true if the current page box has custom page size style for
239 // printing.
240 bool HasCustomPageSizeStyle(int page_index);
242 // Forces the selection colors for testing under Linux.
243 void ForceRedSelectionColors();
245 // Adds a style sheet to be injected into new documents.
246 void InjectStyleSheet(const std::string& source_code, bool all_frames);
248 bool FindString(const std::string& search_text,
249 const std::vector<std::string>& options_array);
251 std::string SelectionAsMarkup();
253 // Enables or disables subpixel positioning (i.e. fractional X positions for
254 // glyphs) in text rendering on Linux. Since this method changes global
255 // settings, tests that call it must use their own custom font family for
256 // all text that they render. If not, an already-cached style will be used,
257 // resulting in the changed setting being ignored.
258 void SetTextSubpixelPositioning(bool value);
260 // Switch the visibility of the page.
261 void SetPageVisibility(const std::string& new_visibility);
263 // Changes the direction of the focused element.
264 void SetTextDirection(const std::string& direction_name);
266 // After this function is called, all window-sizing machinery is
267 // short-circuited inside the renderer. This mode is necessary for
268 // some tests that were written before browsers had multi-process architecture
269 // and rely on window resizes to happen synchronously.
270 // The function has "unfortunate" it its name because we must strive to remove
271 // all tests that rely on this... well, unfortunate behavior. See
272 // http://crbug.com/309760 for the plan.
273 void UseUnfortunateSynchronousResizeMode();
275 bool EnableAutoResizeMode(int min_width,
276 int min_height,
277 int max_width,
278 int max_height);
279 bool DisableAutoResizeMode(int new_width, int new_height);
281 void SetMockDeviceLight(double value);
282 void ResetDeviceLight();
283 // Device Motion / Device Orientation related functions
284 void SetMockDeviceMotion(bool has_acceleration_x, double acceleration_x,
285 bool has_acceleration_y, double acceleration_y,
286 bool has_acceleration_z, double acceleration_z,
287 bool has_acceleration_including_gravity_x,
288 double acceleration_including_gravity_x,
289 bool has_acceleration_including_gravity_y,
290 double acceleration_including_gravity_y,
291 bool has_acceleration_including_gravity_z,
292 double acceleration_including_gravity_z,
293 bool has_rotation_rate_alpha,
294 double rotation_rate_alpha,
295 bool has_rotation_rate_beta,
296 double rotation_rate_beta,
297 bool has_rotation_rate_gamma,
298 double rotation_rate_gamma,
299 double interval);
300 void SetMockDeviceOrientation(bool has_alpha, double alpha,
301 bool has_beta, double beta,
302 bool has_gamma, double gamma,
303 bool has_absolute, bool absolute);
305 void SetMockScreenOrientation(const std::string& orientation);
307 void DidChangeBatteryStatus(bool charging,
308 double chargingTime,
309 double dischargingTime,
310 double level);
311 void ResetBatteryStatus();
313 // Presentation API related functions.
314 void SetMockScreenAvailability(bool available);
316 void DidAcquirePointerLock();
317 void DidNotAcquirePointerLock();
318 void DidLosePointerLock();
319 void SetPointerLockWillFailSynchronously();
320 void SetPointerLockWillRespondAsynchronously();
322 ///////////////////////////////////////////////////////////////////////////
323 // Methods modifying WebPreferences.
325 // Set the WebPreference that controls webkit's popup blocking.
326 void SetPopupBlockingEnabled(bool block_popups);
328 void SetJavaScriptCanAccessClipboard(bool can_access);
329 void SetXSSAuditorEnabled(bool enabled);
330 void SetAllowUniversalAccessFromFileURLs(bool allow);
331 void SetAllowFileAccessFromFileURLs(bool allow);
332 void OverridePreference(const std::string key, v8::Handle<v8::Value> value);
334 // Modify accept_languages in RendererPreferences.
335 void SetAcceptLanguages(const std::string& accept_languages);
337 // Enable or disable plugins.
338 void SetPluginsEnabled(bool enabled);
340 ///////////////////////////////////////////////////////////////////////////
341 // Methods that modify the state of TestRunner
343 // This function sets a flag that tells the test_shell to print a line of
344 // descriptive text for each editing command. It takes no arguments, and
345 // ignores any that may be present.
346 void DumpEditingCallbacks();
348 // This function sets a flag that tells the test_shell to dump pages as
349 // plain text, rather than as a text representation of the renderer's state.
350 // The pixel results will not be generated for this test.
351 void DumpAsText();
353 // This function sets a flag that tells the test_shell to dump pages as
354 // the DOM contents, rather than as a text representation of the renderer's
355 // state. The pixel results will not be generated for this test.
356 void DumpAsMarkup();
358 // This function sets a flag that tells the test_shell to dump pages as
359 // plain text, rather than as a text representation of the renderer's state.
360 // It will also generate a pixel dump for the test.
361 void DumpAsTextWithPixelResults();
363 // This function sets a flag that tells the test_shell to print out the
364 // scroll offsets of the child frames. It ignores all.
365 void DumpChildFrameScrollPositions();
367 // This function sets a flag that tells the test_shell to recursively
368 // dump all frames as plain text if the DumpAsText flag is set.
369 // It takes no arguments, and ignores any that may be present.
370 void DumpChildFramesAsText();
372 // This function sets a flag that tells the test_shell to recursively
373 // dump all frames as the DOM contents if the DumpAsMarkup flag is set.
374 // It takes no arguments, and ignores any that may be present.
375 void DumpChildFramesAsMarkup();
377 // This function sets a flag that tells the test_shell to print out the
378 // information about icon changes notifications from WebKit.
379 void DumpIconChanges();
381 // Deals with Web Audio WAV file data.
382 void SetAudioData(const gin::ArrayBufferView& view);
384 // This function sets a flag that tells the test_shell to print a line of
385 // descriptive text for each frame load callback. It takes no arguments, and
386 // ignores any that may be present.
387 void DumpFrameLoadCallbacks();
389 // This function sets a flag that tells the test_shell to print a line of
390 // descriptive text for each PingLoader dispatch. It takes no arguments, and
391 // ignores any that may be present.
392 void DumpPingLoaderCallbacks();
394 // This function sets a flag that tells the test_shell to print a line of
395 // user gesture status text for some frame load callbacks. It takes no
396 // arguments, and ignores any that may be present.
397 void DumpUserGestureInFrameLoadCallbacks();
399 void DumpTitleChanges();
401 // This function sets a flag that tells the test_shell to dump all calls to
402 // WebViewClient::createView().
403 // It takes no arguments, and ignores any that may be present.
404 void DumpCreateView();
406 void SetCanOpenWindows();
408 // This function sets a flag that tells the test_shell to dump a descriptive
409 // line for each resource load callback. It takes no arguments, and ignores
410 // any that may be present.
411 void DumpResourceLoadCallbacks();
413 // This function sets a flag that tells the test_shell to print a line of
414 // descriptive text for each element that requested a resource. It takes no
415 // arguments, and ignores any that may be present.
416 void DumpResourceRequestCallbacks();
418 // This function sets a flag that tells the test_shell to dump the MIME type
419 // for each resource that was loaded. It takes no arguments, and ignores any
420 // that may be present.
421 void DumpResourceResponseMIMETypes();
423 // WebPermissionClient related.
424 void SetImagesAllowed(bool allowed);
425 void SetMediaAllowed(bool allowed);
426 void SetScriptsAllowed(bool allowed);
427 void SetStorageAllowed(bool allowed);
428 void SetPluginsAllowed(bool allowed);
429 void SetAllowDisplayOfInsecureContent(bool allowed);
430 void SetAllowRunningOfInsecureContent(bool allowed);
431 void DumpPermissionClientCallbacks();
433 // This function sets a flag that tells the test_shell to dump all calls
434 // to window.status().
435 // It takes no arguments, and ignores any that may be present.
436 void DumpWindowStatusChanges();
438 // This function sets a flag that tells the test_shell to print a line of
439 // descriptive text for the progress finished callback. It takes no
440 // arguments, and ignores any that may be present.
441 void DumpProgressFinishedCallback();
443 // This function sets a flag that tells the test_shell to dump all
444 // the lines of descriptive text about spellcheck execution.
445 void DumpSpellCheckCallbacks();
447 // This function sets a flag that tells the test_shell to print out a text
448 // representation of the back/forward list. It ignores all arguments.
449 void DumpBackForwardList();
451 void DumpSelectionRect();
453 // Causes layout to happen as if targetted to printed pages.
454 void SetPrinting();
456 // Clears the state from SetPrinting().
457 void ClearPrinting();
459 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value);
461 // Causes WillSendRequest to clear certain headers.
462 void SetWillSendRequestClearHeader(const std::string& header);
464 // This function sets a flag that tells the test_shell to dump a descriptive
465 // line for each resource load's priority and any time that priority
466 // changes. It takes no arguments, and ignores any that may be present.
467 void DumpResourceRequestPriorities();
469 // Sets a flag to enable the mock theme.
470 void SetUseMockTheme(bool use);
472 // Sets a flag that causes the test to be marked as completed when the
473 // WebFrameClient receives a loadURLExternally() call.
474 void WaitUntilExternalURLLoad();
476 // This function sets a flag which tells the WebTestProxy to dump the drag
477 // image when the next drag-and-drop is initiated. It is equivalent to
478 // DumpAsTextWithPixelResults but the pixel results will be the drag image
479 // instead of a snapshot of the page.
480 void DumpDragImage();
482 ///////////////////////////////////////////////////////////////////////////
483 // Methods interacting with the WebTestProxy
485 ///////////////////////////////////////////////////////////////////////////
486 // Methods forwarding to the WebTestDelegate
488 // Shows DevTools window.
489 void ShowWebInspector(const std::string& str,
490 const std::string& frontend_url);
491 void CloseWebInspector();
493 // Inspect chooser state
494 bool IsChooserShown();
496 // Allows layout tests to exec scripts at WebInspector side.
497 void EvaluateInWebInspector(int call_id, const std::string& script);
499 // Clears all databases.
500 void ClearAllDatabases();
501 // Sets the default quota for all origins
502 void SetDatabaseQuota(int quota);
504 // Changes the cookie policy from the default to allow all cookies.
505 void SetAlwaysAcceptCookies(bool accept);
507 // Gives focus to the window.
508 void SetWindowIsKey(bool value);
510 // Converts a URL starting with file:///tmp/ to the local mapping.
511 std::string PathToLocalResource(const std::string& path);
513 // Used to set the device scale factor.
514 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback);
516 // Change the device color profile while running a layout test.
517 void SetColorProfile(const std::string& name,
518 v8::Handle<v8::Function> callback);
520 // Change the bluetooth test data while running a layout test.
521 void SetBluetoothMockDataSet(const std::string& name);
523 // Enables mock geofencing service while running a layout test.
524 // |service_available| indicates if the mock service should mock geofencing
525 // being available or not.
526 void SetGeofencingMockProvider(bool service_available);
528 // Disables mock geofencing service while running a layout test.
529 void ClearGeofencingMockProvider();
531 // Set the mock geofencing position while running a layout test.
532 void SetGeofencingMockPosition(double latitude, double longitude);
534 // Calls setlocale(LC_ALL, ...) for a specified locale.
535 // Resets between tests.
536 void SetPOSIXLocale(const std::string& locale);
538 // MIDI function to control permission handling.
539 void SetMIDIAccessorResult(bool result);
540 void SetMIDISysexPermission(bool value);
542 // Grants permission for desktop notifications to an origin
543 void GrantWebNotificationPermission(const GURL& origin,
544 bool permission_granted);
546 // Clears all previously granted Web Notification permissions.
547 void ClearWebNotificationPermissions();
549 // Simulates a click on a Web Notification.
550 void SimulateWebNotificationClick(const std::string& title);
552 // Speech recognition related functions.
553 void AddMockSpeechRecognitionResult(const std::string& transcript,
554 double confidence);
555 void SetMockSpeechRecognitionError(const std::string& error,
556 const std::string& message);
557 bool WasMockSpeechRecognitionAborted();
559 // Credential Manager mock functions
560 // TODO(mkwst): Support FederatedCredential.
561 void AddMockCredentialManagerResponse(const std::string& id,
562 const std::string& name,
563 const std::string& avatar,
564 const std::string& password);
566 // WebPageOverlay related functions. Permits the adding and removing of only
567 // one opaque overlay.
568 void AddWebPageOverlay();
569 void RemoveWebPageOverlay();
571 void DisplayAsync();
572 void DisplayAsyncThen(v8::Handle<v8::Function> callback);
574 // Similar to DisplayAsyncThen(), but pass parameters of the captured
575 // snapshot (width, height, snapshot) to the callback. The snapshot is in
576 // uint8 RGBA format.
577 void CapturePixelsAsyncThen(v8::Handle<v8::Function> callback);
578 // Similar to CapturePixelsAsyncThen(). Copies to the clipboard the image
579 // located at a particular point in the WebView (if there is such an image),
580 // reads back its pixels, and provides the snapshot to the callback. If there
581 // is no image at that point, calls the callback with (0, 0, empty_snapshot).
582 void CopyImageAtAndCapturePixelsAsyncThen(
583 int x, int y, const v8::Handle<v8::Function> callback);
585 // Sets the origin's permission to use the Push API to granted or denied.
586 void SetPushMessagingPermission(const GURL& origin, bool allowed);
588 // Clears all previously granted Push API permissions.
589 void ClearPushMessagingPermissions();
591 void GetManifestThen(v8::Handle<v8::Function> callback);
593 ///////////////////////////////////////////////////////////////////////////
594 // Internal helpers
596 void GetManifestCallback(scoped_ptr<InvokeCallbackTask> task,
597 const blink::WebURLResponse& response,
598 const std::string& data);
599 void CapturePixelsCallback(scoped_ptr<InvokeCallbackTask> task,
600 const SkBitmap& snapshot);
602 void CheckResponseMimeType();
603 void CompleteNotifyDone();
605 void DidAcquirePointerLockInternal();
606 void DidNotAcquirePointerLockInternal();
607 void DidLosePointerLockInternal();
609 // In the Mac code, this is called to trigger the end of a test after the
610 // page has finished loading. From here, we can generate the dump for the
611 // test.
612 void LocationChangeDone();
614 // Sets a flag causing the next call to WebGLRenderingContext::create to fail.
615 void ForceNextWebGLContextCreationToFail();
617 bool test_is_running_;
619 // When reset is called, go through and close all but the main test shell
620 // window. By default, set to true but toggled to false using
621 // setCloseRemainingWindowsWhenComplete().
622 bool close_remaining_windows_;
624 // If true, don't dump output until notifyDone is called.
625 bool wait_until_done_;
627 // If true, ends the test when a URL is loaded externally via
628 // WebFrameClient::loadURLExternally().
629 bool wait_until_external_url_load_;
631 // Causes navigation actions just printout the intended navigation instead
632 // of taking you to the page. This is used for cases like mailto, where you
633 // don't actually want to open the mail program.
634 bool policy_delegate_enabled_;
636 // Toggles the behavior of the policy delegate. If true, then navigations
637 // will be allowed. Otherwise, they will be ignored (dropped).
638 bool policy_delegate_is_permissive_;
640 // If true, the policy delegate will signal layout test completion.
641 bool policy_delegate_should_notify_done_;
643 WorkQueue work_queue_;
645 // Bound variable to return the name of this platform (chromium).
646 std::string platform_name_;
648 // Bound variable to store the last tooltip text
649 std::string tooltip_text_;
651 // Bound variable to disable notifyDone calls. This is used in GC leak
652 // tests, where existing LayoutTests are loaded within an iframe. The GC
653 // test harness will set this flag to ignore the notifyDone calls from the
654 // target LayoutTest.
655 bool disable_notify_done_;
657 // Bound variable counting the number of top URLs visited.
658 int web_history_item_count_;
660 // Bound variable to set whether postMessages should be intercepted or not
661 bool intercept_post_message_;
663 // If true, the test_shell will write a descriptive line for each editing
664 // command.
665 bool dump_editting_callbacks_;
667 // If true, the test_shell will generate pixel results in DumpAsText mode
668 bool generate_pixel_results_;
670 // If true, the test_shell will produce a plain text dump rather than a
671 // text representation of the renderer.
672 bool dump_as_text_;
674 // If true and if dump_as_text_ is true, the test_shell will recursively
675 // dump all frames as plain text.
676 bool dump_child_frames_as_text_;
678 // If true, the test_shell will produce a dump of the DOM rather than a text
679 // representation of the renderer.
680 bool dump_as_markup_;
682 // If true and if dump_as_markup_ is true, the test_shell will recursively
683 // produce a dump of the DOM rather than a text representation of the
684 // renderer.
685 bool dump_child_frames_as_markup_;
687 // If true, the test_shell will print out the child frame scroll offsets as
688 // well.
689 bool dump_child_frame_scroll_positions_;
691 // If true, the test_shell will print out the icon change notifications.
692 bool dump_icon_changes_;
694 // If true, the test_shell will output a base64 encoded WAVE file.
695 bool dump_as_audio_;
697 // If true, the test_shell will output a descriptive line for each frame
698 // load callback.
699 bool dump_frame_load_callbacks_;
701 // If true, the test_shell will output a descriptive line for each
702 // PingLoader dispatched.
703 bool dump_ping_loader_callbacks_;
705 // If true, the test_shell will output a line of the user gesture status
706 // text for some frame load callbacks.
707 bool dump_user_gesture_in_frame_load_callbacks_;
709 // If true, output a message when the page title is changed.
710 bool dump_title_changes_;
712 // If true, output a descriptive line each time WebViewClient::createView
713 // is invoked.
714 bool dump_create_view_;
716 // If true, new windows can be opened via javascript or by plugins. By
717 // default, set to false and can be toggled to true using
718 // setCanOpenWindows().
719 bool can_open_windows_;
721 // If true, the test_shell will output a descriptive line for each resource
722 // load callback.
723 bool dump_resource_load_callbacks_;
725 // If true, the test_shell will output a descriptive line for each resource
726 // request callback.
727 bool dump_resource_request_callbacks_;
729 // If true, the test_shell will output the MIME type for each resource that
730 // was loaded.
731 bool dump_resource_reqponse_mime_types_;
733 // If true, the test_shell will dump all changes to window.status.
734 bool dump_window_status_changes_;
736 // If true, the test_shell will output a descriptive line for the progress
737 // finished callback.
738 bool dump_progress_finished_callback_;
740 // If true, the test_shell will output descriptive test for spellcheck
741 // execution.
742 bool dump_spell_check_callbacks_;
744 // If true, the test_shell will produce a dump of the back forward list as
745 // well.
746 bool dump_back_forward_list_;
748 // If true, the test_shell will draw the bounds of the current selection rect
749 // taking possible transforms of the selection rect into account.
750 bool dump_selection_rect_;
752 // If true, the test_shell will dump the drag image as pixel results.
753 bool dump_drag_image_;
755 // If true, pixel dump will be produced as a series of 1px-tall, view-wide
756 // individual paints over the height of the view.
757 bool test_repaint_;
759 // If true and test_repaint_ is true as well, pixel dump will be produced as
760 // a series of 1px-wide, view-tall paints across the width of the view.
761 bool sweep_horizontally_;
763 // If true, layout is to target printed pages.
764 bool is_printing_;
766 // If false, MockWebMIDIAccessor fails on startSession() for testing.
767 bool midi_accessor_result_;
769 bool should_stay_on_page_after_handling_before_unload_;
771 bool should_dump_resource_priorities_;
773 bool has_custom_text_output_;
774 std::string custom_text_output_;
776 std::set<std::string> http_headers_to_clear_;
778 // WAV audio data is stored here.
779 std::vector<unsigned char> audio_data_;
781 // Used for test timeouts.
782 WebTaskList task_list_;
784 TestInterfaces* test_interfaces_;
785 WebTestDelegate* delegate_;
786 blink::WebView* web_view_;
787 TestPageOverlay* page_overlay_;
788 WebTestProxyBase* proxy_;
790 // This is non-0 IFF a load is in progress.
791 blink::WebFrame* top_loading_frame_;
793 // WebPermissionClient mock object.
794 scoped_ptr<WebPermissions> web_permissions_;
796 bool pointer_locked_;
797 enum {
798 PointerLockWillSucceed,
799 PointerLockWillRespondAsync,
800 PointerLockWillFailSync,
801 } pointer_lock_planned_result_;
802 bool use_mock_theme_;
804 base::WeakPtrFactory<TestRunner> weak_factory_;
806 DISALLOW_COPY_AND_ASSIGN(TestRunner);
809 } // namespace content
811 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_TEST_RUNNER_H_