Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Side by Side Diff: content/shell/renderer/test_runner/test_runner.h

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

Powered by Google App Engine
This is Rietveld 408576698