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