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