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