forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_runner.h
676 lines (528 loc) · 25.7 KB
/
test_runner.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_SHELL_TEST_RUNNER_TEST_RUNNER_H_
#define CONTENT_SHELL_TEST_RUNNER_TEST_RUNNER_H_
#include <stdint.h>
#include <memory>
#include <set>
#include <string>
#include <vector>
#include "base/callback_forward.h"
#include "base/containers/circular_deque.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/optional.h"
#include "base/strings/string16.h"
#include "content/shell/test_runner/mock_screen_orientation_client.h"
#include "content/shell/test_runner/test_runner_export.h"
#include "content/shell/test_runner/web_test_runtime_flags.h"
#include "third_party/blink/public/platform/web_effective_connection_type.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "v8/include/v8.h"
class GURL;
class SkBitmap;
namespace base {
class DictionaryValue;
}
namespace blink {
class WebContentSettingsClient;
class WebFrame;
class WebLocalFrame;
class WebString;
class WebTextCheckClient;
class WebView;
}
namespace content {
class RenderView;
}
namespace gin {
class ArrayBufferView;
class Arguments;
}
namespace test_runner {
class MockContentSettingsClient;
class MockScreenOrientationClient;
class SpellCheckClient;
class TestInterfaces;
class TestRunnerForSpecificView;
class WebTestDelegate;
// TestRunner class currently has dual purpose:
// 1. It implements TestRunner javascript bindings for "global" / "ambient".
// Examples:
// - TestRunner.DumpAsText (test flag affecting test behavior)
// - TestRunner.SetAllowRunningOfInsecureContent (test flag affecting product
// behavior)
// - TestRunner.SetTextSubpixelPositioning (directly interacts with product).
// Note that "per-view" (non-"global") bindings are handled by
// instances of TestRunnerForSpecificView class.
// 2. It manages global test state. Example:
// - Tracking topLoadingFrame that can finish the test when it loads.
// - WorkQueue holding load requests from the TestInterfaces
// - WebTestRuntimeFlags
class TEST_RUNNER_EXPORT TestRunner {
public:
explicit TestRunner(TestInterfaces*);
virtual ~TestRunner();
void Install(blink::WebLocalFrame* frame,
base::WeakPtr<TestRunnerForSpecificView> view_test_runner);
void SetDelegate(WebTestDelegate*);
void SetMainView(blink::WebView*);
void Reset();
void SetTestIsRunning(bool);
bool TestIsRunning() const { return test_is_running_; }
// Finishes the test if it is ready. This should be called before running
// tasks that will change state, so that the test can capture the current
// state. Specifically, should run before the BeginMainFrame step which does
// layout and animation etc.
// This does *not* run as part of loading finishing because that happens in
// the middle of blink call stacks that have inconsistent state.
void FinishTestIfReady();
// Returns a mock WebContentSettings that is used for web tests. An
// embedder should use this for all WebViews it creates.
blink::WebContentSettingsClient* GetWebContentSettings() const;
// Returns a mock WebTextCheckClient that is used for web tests. An
// embedder should use this for all WebLocalFrames it creates.
blink::WebTextCheckClient* GetWebTextCheckClient() const;
// After WebTestDelegate::TestFinished was invoked, the following methods
// can be used to determine what kind of dump the main WebViewTestProxy can
// provide.
// If true, WebTestDelegate::audioData returns an audio dump and no text
// or pixel results are available.
bool ShouldDumpAsAudio() const;
void GetAudioData(std::vector<unsigned char>* buffer_view) const;
// Reports if tests requested a recursive layout dump of all frames
// (i.e. by calling testRunner.dumpChildFramesAsText() from javascript).
bool IsRecursiveLayoutDumpRequested();
// Dumps layout of |frame| using the mode requested by the current test
// (i.e. text mode if testRunner.dumpAsText() was called from javascript).
std::string DumpLayout(blink::WebLocalFrame* frame);
// Returns true if the selection window should be painted onto captured
// pixels.
bool ShouldDumpSelectionRect() const;
// Returns false if the browser should capture the pixel output, true if it
// can be done locally in the renderer via DumpPixelsAsync().
bool CanDumpPixelsFromRenderer() const;
// Snapshots the content of |render_view| using the mode requested by the
// current test and calls |callback| with the result. Caller needs to ensure
// that |render_view| stays alive until |callback| is called.
void DumpPixelsAsync(content::RenderView* render_view,
base::OnceCallback<void(const SkBitmap&)> callback);
// Replicates changes to web test runtime flags (i.e. changes that happened in
// another renderer). See also WebTestDelegate::OnWebTestRuntimeFlagsChanged.
void ReplicateWebTestRuntimeFlagsChanges(
const base::DictionaryValue& changed_values);
// If custom text dump is present (i.e. if testRunner.setCustomTextOutput has
// been called from javascript), then returns |true| and populates the
// |custom_text_dump| argument. Otherwise returns |false|.
bool HasCustomTextDump(std::string* custom_text_dump) const;
// Returns true if the history should be included in text results generated at
// the end of the test.
bool ShouldDumpBackForwardList() const;
// Returns true if pixel results should be generated at the end of the test.
bool ShouldGeneratePixelResults();
// Sets focus on the given view. Internally tracks currently focused view,
// to aid in defocusing previously focused views at the right time.
void SetFocus(blink::WebView* web_view, bool focus);
// Methods used by WebViewTestClient and WebFrameTestClient.
std::string GetAcceptLanguages() const;
bool ShouldStayOnPageAfterHandlingBeforeUnload() const;
MockScreenOrientationClient* GetMockScreenOrientationClient();
bool ShouldDumpAsCustomText() const;
std::string CustomDumpText() const;
void ShowDevTools(const std::string& settings,
const std::string& frontend_url);
void SetV8CacheDisabled(bool);
void SetShouldDumpAsText(bool);
void SetShouldDumpAsMarkup(bool);
void SetShouldDumpAsLayout(bool);
void SetCustomTextOutput(const std::string& text);
void SetShouldGeneratePixelResults(bool);
void SetShouldDumpFrameLoadCallbacks(bool);
void SetShouldEnableViewSource(bool);
bool ShouldDumpEditingCallbacks() const;
bool ShouldDumpFrameLoadCallbacks() const;
bool ShouldDumpPingLoaderCallbacks() const;
bool ShouldDumpUserGestureInFrameLoadCallbacks() const;
bool ShouldDumpTitleChanges() const;
bool ShouldDumpIconChanges() const;
bool ShouldDumpCreateView() const;
bool CanOpenWindows() const;
bool ShouldDumpSpellCheckCallbacks() const;
bool ShouldWaitUntilExternalURLLoad() const;
const std::set<std::string>* HttpHeadersToClear() const;
bool ClearReferrer() const;
bool is_web_platform_tests_mode() const {
return is_web_platform_tests_mode_;
}
void set_is_web_platform_tests_mode() { is_web_platform_tests_mode_ = true; }
bool animation_requires_raster() const { return animation_requires_raster_; }
void SetAnimationRequiresRaster(bool do_raster);
// Add |frame| to the set of loading frames.
//
// Note: Only one renderer process is really tracking the loading frames. This
// is the first to observe one. Both local and remote frames are tracked
// by this process.
void AddLoadingFrame(blink::WebFrame* frame);
// Remove |frame| from the set of loading frames.
//
// When there are no more loading frames, this potentially finishes the test,
// unless TestRunner.WaitUntilDone() was called and/or there are pending load
// requests in WorkQueue.
void RemoveLoadingFrame(blink::WebFrame* frame);
blink::WebFrame* MainFrame() const;
void PolicyDelegateDone();
bool PolicyDelegateEnabled() const;
bool PolicyDelegateIsPermissive() const;
bool PolicyDelegateShouldNotifyDone() const;
void SetToolTipText(const blink::WebString&);
void SetDragImage(const SkBitmap& drag_image);
bool ShouldDumpNavigationPolicy() const;
bool ShouldDumpConsoleMessages() const;
// Controls whether console messages produced by the page are dumped
// to test output.
void SetDumpConsoleMessages(bool value);
bool ShouldDumpJavaScriptDialogs() const;
blink::WebEffectiveConnectionType effective_connection_type() const {
return effective_connection_type_;
}
// A single item in the work queue.
class WorkItem {
public:
virtual ~WorkItem() {}
// Returns true if this started a load.
virtual bool Run(WebTestDelegate*, blink::WebView*) = 0;
};
private:
friend class TestRunnerBindings;
friend class WorkQueue;
// Helper class for managing events queued by methods like QueueLoad or
// QueueScript.
class WorkQueue {
public:
explicit WorkQueue(TestRunner* controller);
virtual ~WorkQueue();
void ProcessWorkSoon();
// Reset the state of the class between tests.
void Reset();
void AddWork(WorkItem*);
void set_frozen(bool frozen) { frozen_ = frozen; }
bool is_empty() const { return queue_.empty(); }
void set_finished_loading() { finished_loading_ = true; }
private:
void ProcessWork();
base::circular_deque<WorkItem*> queue_;
bool frozen_ = false;
bool finished_loading_ = false;
TestRunner* controller_;
base::WeakPtrFactory<WorkQueue> weak_factory_{this};
};
///////////////////////////////////////////////////////////////////////////
// Methods dealing with the test logic
// By default, tests end when page load is complete. These methods are used
// to delay the completion of the test until NotifyDone is called.
void NotifyDone();
void WaitUntilDone();
// Methods for adding actions to the work queue. Used in conjunction with
// WaitUntilDone/NotifyDone above.
void QueueBackNavigation(int how_far_back);
void QueueForwardNavigation(int how_far_forward);
void QueueReload();
void QueueLoadingScript(const std::string& script);
void QueueNonLoadingScript(const std::string& script);
void QueueLoad(const std::string& url, const std::string& target);
// Causes navigation actions just printout the intended navigation instead
// of taking you to the page. This is used for cases like mailto, where you
// don't actually want to open the mail program.
void SetCustomPolicyDelegate(gin::Arguments* args);
// Delays completion of the test until the policy delegate runs.
void WaitForPolicyDelegate();
// Functions for dealing with windows. By default we block all new windows.
int WindowCount();
void SetCloseRemainingWindowsWhenComplete(bool close_remaining_windows);
void ResetTestHelperControllers();
// Allows web tests to manage origins' allow list.
void AddOriginAccessAllowListEntry(const std::string& source_origin,
const std::string& destination_protocol,
const std::string& destination_host,
bool allow_destination_subdomains);
// Add |source_code| as an injected stylesheet to the active document of the
// window of the current V8 context.
void InsertStyleSheet(const std::string& source_code);
// Enables or disables subpixel positioning (i.e. fractional X positions for
// glyphs) in text rendering on Linux. Since this method changes global
// settings, tests that call it must use their own custom font family for
// all text that they render. If not, an already-cached style will be used,
// resulting in the changed setting being ignored.
void SetTextSubpixelPositioning(bool value);
// After this function is called, all window-sizing machinery is
// short-circuited inside the renderer. This mode is necessary for
// some tests that were written before browsers had multi-process architecture
// and rely on window resizes to happen synchronously.
// The function has "unfortunate" it its name because we must strive to remove
// all tests that rely on this... well, unfortunate behavior. See
// http://crbug.com/309760 for the plan.
void UseUnfortunateSynchronousResizeMode();
void EnableAutoResizeMode(int min_width,
int min_height,
int max_width,
int max_height);
void DisableAutoResizeMode(int new_width, int new_height);
void SetMockScreenOrientation(const std::string& orientation);
void DisableMockScreenOrientation();
///////////////////////////////////////////////////////////////////////////
// Methods modifying WebPreferences.
// Set the WebPreference that controls webkit's popup blocking.
void SetPopupBlockingEnabled(bool block_popups);
void SetJavaScriptCanAccessClipboard(bool can_access);
void SetAllowFileAccessFromFileURLs(bool allow);
void OverridePreference(gin::Arguments* arguments);
// Modify accept_languages in blink::mojom::RendererPreferences.
void SetAcceptLanguages(const std::string& accept_languages);
// Enable or disable plugins.
void SetPluginsEnabled(bool enabled);
///////////////////////////////////////////////////////////////////////////
// Methods that modify the state of TestRunner
// This function sets a flag that tells the test runner to print a line of
// descriptive text for each editing command. It takes no arguments, and
// ignores any that may be present.
void DumpEditingCallbacks();
// This function sets a flag that tells the test runner to dump pages as
// plain text. The pixel results will not be generated for this test.
// It has higher priority than DumpAsMarkup() and DumpAsLayout().
void DumpAsText();
// This function sets a flag that tells the test runner to dump pages as
// the DOM contents, rather than as a text representation of the renderer's
// state. The pixel results will not be generated for this test. It has
// higher priority than DumpAsLayout(), but lower than DumpAsText().
void DumpAsMarkup();
// This function sets a flag that tells the test runner to dump pages as
// plain text. It will also generate a pixel dump for the test.
void DumpAsTextWithPixelResults();
// This function sets a flag that tells the test runner to dump pages as
// text representation of the layout. The pixel results will not be generated
// for this test. It has lower priority than DumpAsText() and DumpAsMarkup().
void DumpAsLayout();
// This function sets a flag that tells the test runner to dump pages as
// text representation of the layout. It will also generate a pixel dump for
// the test.
void DumpAsLayoutWithPixelResults();
// This function sets a flag that tells the test runner to recursively dump
// all frames as text, markup or layout depending on which of DumpAsText,
// DumpAsMarkup and DumpAsLayout is effective.
void DumpChildFrames();
// This function sets a flag that tells the test runner to print out the
// information about icon changes notifications from WebKit.
void DumpIconChanges();
// Deals with Web Audio WAV file data.
void SetAudioData(const gin::ArrayBufferView& view);
// This function sets a flag that tells the test runner to print a line of
// descriptive text for each frame load callback. It takes no arguments, and
// ignores any that may be present.
void DumpFrameLoadCallbacks();
// This function sets a flag that tells the test runner to print a line of
// descriptive text for each PingLoader dispatch. It takes no arguments, and
// ignores any that may be present.
void DumpPingLoaderCallbacks();
// This function sets a flag that tells the test runner to print a line of
// user gesture status text for some frame load callbacks. It takes no
// arguments, and ignores any that may be present.
void DumpUserGestureInFrameLoadCallbacks();
void DumpTitleChanges();
// This function sets a flag that tells the test runner to dump all calls to
// WebViewClient::createView().
// It takes no arguments, and ignores any that may be present.
void DumpCreateView();
void SetCanOpenWindows();
// This function sets a flag that tells the test runner to dump the MIME type
// for each resource that was loaded. It takes no arguments, and ignores any
// that may be present.
void DumpResourceResponseMIMETypes();
// WebContentSettingsClient related.
void SetImagesAllowed(bool allowed);
void SetScriptsAllowed(bool allowed);
void SetStorageAllowed(bool allowed);
void SetPluginsAllowed(bool allowed);
void SetAllowRunningOfInsecureContent(bool allowed);
void DumpPermissionClientCallbacks();
// Sets up a mock DocumentSubresourceFilter to disallow subsequent subresource
// loads within the current document with the given path |suffixes|. The
// filter is created and injected even if |suffixes| is empty. If |suffixes|
// contains the empty string, all subresource loads will be disallowed. If
// |block_subresources| is false, matching resources will not be blocked but
// instead marked as matching a disallowed resource.
void SetDisallowedSubresourcePathSuffixes(
const std::vector<std::string>& suffixes,
bool block_subresources);
// This function sets a flag that tells the test runner to dump all
// the lines of descriptive text about spellcheck execution.
void DumpSpellCheckCallbacks();
// This function sets a flag that tells the test runner to print out a text
// representation of the back/forward list. It ignores all arguments.
void DumpBackForwardList();
void DumpSelectionRect();
// Causes layout to happen as if targetted to printed pages.
void SetPrinting();
void SetPrintingForFrame(const std::string& frame_name);
// Clears the state from SetPrinting().
void ClearPrinting();
void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value);
// Causes WillSendRequest to clear certain headers.
// Note: This cannot be used to clear the request's `Referer` header, as this
// header is computed later given its referrer string member. To clear it, use
// SetWillSendRequestClearReferrer() below.
void SetWillSendRequestClearHeader(const std::string& header);
// Causes WillSendRequest to clear the request's referrer string and set its
// referrer policy to the default.
void SetWillSendRequestClearReferrer();
// Sets a flag that causes the test to be marked as completed when the
// WebLocalFrameClient receives a LoadURLExternally() call.
void WaitUntilExternalURLLoad();
// This function sets a flag to dump the drag image when the next drag&drop is
// initiated. It is equivalent to DumpAsTextWithPixelResults but the pixel
// results will be the drag image instead of a snapshot of the page.
void DumpDragImage();
// Sets a flag that tells the WebViewTestProxy to dump the default navigation
// policy passed to the DecidePolicyForNavigation callback.
void DumpNavigationPolicy();
// Controls whether JavaScript dialogs such as alert() are dumped to test
// output.
void SetDumpJavaScriptDialogs(bool value);
// Overrides the NetworkQualityEstimator's estimated network type. If |type|
// is TypeUnknown the NQE's value is used. Be sure to call this with
// TypeUnknown at the end of your test if you use this.
void SetEffectiveConnectionType(
blink::WebEffectiveConnectionType connection_type);
// Controls whether the mock spell checker is enabled.
void SetMockSpellCheckerEnabled(bool enabled);
///////////////////////////////////////////////////////////////////////////
// Methods interacting with the WebViewTestProxy
///////////////////////////////////////////////////////////////////////////
// Methods forwarding to the WebTestDelegate
// Shows DevTools window.
void ShowWebInspector(const std::string& str,
const std::string& frontend_url);
void CloseWebInspector();
void NavigateSecondaryWindow(const GURL& url);
void InspectSecondaryWindow();
// Inspect chooser state
bool IsChooserShown();
// Allows web tests to exec scripts at WebInspector side.
void EvaluateInWebInspector(int call_id, const std::string& script);
// Clears all databases.
void ClearAllDatabases();
// Sets the default quota for all origins
void SetDatabaseQuota(int quota);
// Sets the cookie policy to:
// - allow all cookies when |block| is false
// - block only third-party cookies when |block| is true
void SetBlockThirdPartyCookies(bool block);
// Converts a URL starting with file:///tmp/ to the local mapping.
std::string PathToLocalResource(const std::string& path);
// Sets the permission's |name| to |value| for a given {origin, embedder}
// tuple.
void SetPermission(const std::string& name,
const std::string& value,
const GURL& origin,
const GURL& embedding_origin);
// Resolve the in-flight beforeinstallprompt event.
void ResolveBeforeInstallPromptPromise(const std::string& platform);
// Calls setlocale(LC_ALL, ...) for a specified locale.
// Resets between tests.
void SetPOSIXLocale(const std::string& locale);
// Simulates a click on a Web Notification.
void SimulateWebNotificationClick(
const std::string& title,
const base::Optional<int>& action_index,
const base::Optional<base::string16>& reply);
// Simulates closing a Web Notification.
void SimulateWebNotificationClose(const std::string& title, bool by_user);
// Simulates a user deleting a content index entry.
void SimulateWebContentIndexDelete(const std::string& id);
// Returns the absolute path to a directory this test can write data in. This
// returns the path to a fresh empty directory every time this method is
// called. Additionally when this method is called any previously created
// directories will be deleted.
base::FilePath GetWritableDirectory();
// Sets the path that should be returned when the test shows a file dialog.
void SetFilePathForMockFileDialog(const base::FilePath& path);
// Takes care of notifying the delegate after a change to web test runtime
// flags.
void OnWebTestRuntimeFlagsChanged();
///////////////////////////////////////////////////////////////////////////
// Internal helpers
bool IsFramePartOfMainTestWindow(blink::WebFrame*) const;
void CheckResponseMimeType();
bool test_is_running_ = false;
// When reset is called, go through and close all but the main test shell
// window. By default, set to true but toggled to false using
// SetCloseRemainingWindowsWhenComplete().
bool close_remaining_windows_ = false;
WorkQueue work_queue_;
// Bound variable to return the name of this platform (chromium).
std::string platform_name_;
// Bound variable to store the last tooltip text
std::string tooltip_text_;
// Bound variable counting the number of top URLs visited.
int web_history_item_count_ = 0;
// Flags controlling what content gets dumped as a layout text result.
WebTestRuntimeFlags web_test_runtime_flags_;
// If true, the test runner will output a base64 encoded WAVE file.
bool dump_as_audio_;
// If true, the test runner will produce a dump of the back forward list as
// well.
bool dump_back_forward_list_;
// If true, pixel dump will be produced as a series of 1px-tall, view-wide
// individual paints over the height of the view.
bool test_repaint_;
// If true and test_repaint_ is true as well, pixel dump will be produced as
// a series of 1px-wide, view-tall paints across the width of the view.
bool sweep_horizontally_;
std::set<std::string> http_headers_to_clear_;
bool clear_referrer_ = false;
// WAV audio data is stored here.
std::vector<unsigned char> audio_data_;
TestInterfaces* test_interfaces_;
WebTestDelegate* delegate_ = nullptr;
blink::WebView* main_view_ = nullptr;
// This is non empty when a load is in progress.
std::vector<blink::WebFrame*> loading_frames_;
// When a loading task is started, this bool is set until all loading_frames_
// are completed and removed. This bool becomes true earlier than
// loading_frames_ becomes non-empty. Starts as true for the initial load
// which does not come from the WorkQueue.
bool running_load_ = true;
// When NotifyDone() occurs, if loading is still working, it is delayed, and
// this bool tracks that NotifyDone() was called. This differentiates from a
// test that was not waiting for NotifyDone() at all.
bool did_notify_done_ = false;
// WebContentSettingsClient mock object.
std::unique_ptr<MockContentSettingsClient> mock_content_settings_client_;
bool use_mock_theme_ = false;
MockScreenOrientationClient mock_screen_orientation_client_;
std::unique_ptr<SpellCheckClient> spellcheck_;
// Number of currently active color choosers.
int chooser_count_ = 0;
// Captured drag image.
SkBitmap drag_image_;
// View that was focused by a previous call to TestRunner::SetFocus method.
// Note - this can be a dangling pointer to an already destroyed WebView (this
// is ok, because this is taken care of in WebTestDelegate::SetFocus).
blink::WebView* previously_focused_view_ = nullptr;
// True when running a test in web_tests/external/wpt/.
bool is_web_platform_tests_mode_ = false;
// True if rasterization should be performed during tests that examine
// fling-style animations. This includes middle-click auto-scroll behaviors.
// This does not include most "ordinary" animations, such as CSS animations.
bool animation_requires_raster_ = false;
// An effective connection type settable by web tests.
blink::WebEffectiveConnectionType effective_connection_type_ =
blink::WebEffectiveConnectionType::kTypeUnknown;
// Forces v8 compilation cache to be disabled (used for inspector tests).
bool disable_v8_cache_ = false;
base::WeakPtrFactory<TestRunner> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(TestRunner);
};
} // namespace test_runner
#endif // CONTENT_SHELL_TEST_RUNNER_TEST_RUNNER_H_