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