[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 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 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 5 | #ifndef COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
| 6 | #define COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 7 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 10 | #include <deque> |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 11 | #include <memory> |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 12 | #include <set> |
| 13 | #include <string> |
benwells | 0c0d3f1 | 2015-05-25 01:03:17 | [diff] [blame] | 14 | #include <vector> |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 15 | |
avi | 5dd91f8 | 2015-12-25 22:30:46 | [diff] [blame] | 16 | #include "base/macros.h" |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 17 | #include "base/memory/weak_ptr.h" |
lukasza | 083b4f1 | 2016-03-24 16:51:43 | [diff] [blame] | 18 | #include "components/test_runner/layout_test_runtime_flags.h" |
jochen | 746754c5 | 2015-06-05 16:40:41 | [diff] [blame] | 19 | #include "components/test_runner/test_runner_export.h" |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 20 | #include "components/test_runner/web_test_runner.h" |
toyoshim | 729663f | 2016-10-17 08:54:13 | [diff] [blame] | 21 | #include "media/midi/midi_service.mojom.h" |
jkarlin | 3bddb7d | 2016-09-21 18:44:16 | [diff] [blame] | 22 | #include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h" |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 23 | #include "third_party/WebKit/public/platform/WebImage.h" |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 24 | #include "v8/include/v8.h" |
| 25 | |
[email protected] | 945babb | 2014-07-30 14:25:32 | [diff] [blame] | 26 | class GURL; |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 27 | class SkBitmap; |
| 28 | |
awdf | f8bdbe8 | 2016-10-14 09:42:32 | [diff] [blame] | 29 | namespace base { |
| 30 | class NullableString16; |
| 31 | } |
| 32 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 33 | namespace blink { |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 34 | class WebContentSettingsClient; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 35 | class WebFrame; |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 36 | class WebLocalFrame; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 37 | class WebString; |
| 38 | class WebView; |
lukasza | df92022f | 2016-05-03 16:42:31 | [diff] [blame] | 39 | class WebWidget; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | namespace gin { |
| 43 | class ArrayBufferView; |
| 44 | class Arguments; |
| 45 | } |
| 46 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 47 | namespace test_runner { |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 48 | |
lukasza | 2135323 | 2016-04-12 19:52:11 | [diff] [blame] | 49 | class MockContentSettingsClient; |
lukasza | 5c2279c | 2016-04-05 16:44:47 | [diff] [blame] | 50 | class MockCredentialManagerClient; |
lukasza | 6a113ae1 | 2016-03-17 22:41:20 | [diff] [blame] | 51 | class MockScreenOrientationClient; |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 52 | class MockWebSpeechRecognizer; |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 53 | class MockWebUserMediaClient; |
lukasza | 5c2279c | 2016-04-05 16:44:47 | [diff] [blame] | 54 | class SpellCheckClient; |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 55 | class TestInterfaces; |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 56 | class TestRunnerForSpecificView; |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 57 | class WebTestDelegate; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 58 | |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 59 | // TestRunner class currently has dual purpose: |
| 60 | // 1. It implements |testRunner| javascript bindings for "global" / "ambient". |
| 61 | // Examples: |
| 62 | // - testRunner.dumpAsText (test flag affecting test behavior) |
carlosk | 5f1c517 | 2016-09-08 18:59:31 | [diff] [blame] | 63 | // - testRunner.setAllowRunningOfInsecureContent (test flag affecting product |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 64 | // behavior) |
| 65 | // - testRunner.setTextSubpixelPositioning (directly interacts with product). |
| 66 | // Note that "per-view" (non-"global") bindings are handled by |
| 67 | // instances of TestRunnerForSpecificView class. |
| 68 | // 2. It manages global test state. Example: |
| 69 | // - Tracking topLoadingFrame that can finish the test when it loads. |
| 70 | // - WorkQueue holding load requests from the TestInterfaces |
| 71 | // - LayoutTestRuntimeFlags |
lukasza | c935882 | 2016-04-07 14:43:46 | [diff] [blame] | 72 | class TestRunner : public WebTestRunner { |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 73 | public: |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 74 | explicit TestRunner(TestInterfaces*); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 75 | virtual ~TestRunner(); |
| 76 | |
lukasza | b2ad050 | 2016-04-27 15:51:42 | [diff] [blame] | 77 | void Install(blink::WebLocalFrame* frame, |
| 78 | base::WeakPtr<TestRunnerForSpecificView> view_test_runner); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 79 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 80 | void SetDelegate(WebTestDelegate*); |
lukasza | 8973c52 | 2016-04-27 16:32:28 | [diff] [blame] | 81 | void SetMainView(blink::WebView*); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 82 | |
| 83 | void Reset(); |
| 84 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 85 | void SetTestIsRunning(bool); |
| 86 | bool TestIsRunning() const { return test_is_running_; } |
| 87 | |
| 88 | bool UseMockTheme() const { return use_mock_theme_; } |
| 89 | |
| 90 | // WebTestRunner implementation. |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 91 | bool ShouldGeneratePixelResults() override; |
| 92 | bool ShouldDumpAsAudio() const override; |
| 93 | void GetAudioData(std::vector<unsigned char>* buffer_view) const override; |
lukasza | ef264fc5 | 2016-03-17 22:49:19 | [diff] [blame] | 94 | bool IsRecursiveLayoutDumpRequested() override; |
| 95 | std::string DumpLayout(blink::WebLocalFrame* frame) override; |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 96 | void DumpPixelsAsync( |
| 97 | blink::WebView* web_view, |
| 98 | const base::Callback<void(const SkBitmap&)>& callback) override; |
lukasza | 083b4f1 | 2016-03-24 16:51:43 | [diff] [blame] | 99 | void ReplicateLayoutTestRuntimeFlagsChanges( |
lukasza | c9cbe71 | 2016-03-14 14:06:43 | [diff] [blame] | 100 | const base::DictionaryValue& changed_values) override; |
lukasza | a896046 | 2016-01-27 22:27:33 | [diff] [blame] | 101 | bool HasCustomTextDump(std::string* custom_text_dump) const override; |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 102 | bool ShouldDumpBackForwardList() const override; |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 103 | blink::WebContentSettingsClient* GetWebContentSettings() const override; |
lukasza | 5c2279c | 2016-04-05 16:44:47 | [diff] [blame] | 104 | void InitializeWebViewWithMocks(blink::WebView* web_view) override; |
lukasza | 95416be14 | 2016-04-14 15:06:33 | [diff] [blame] | 105 | void SetFocus(blink::WebView* web_view, bool focus) override; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 106 | |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 107 | // Methods used by WebViewTestClient and WebFrameTestClient. |
blundell | 987cb78 | 2016-08-17 17:25:37 | [diff] [blame] | 108 | void OnNavigationBegin(blink::WebFrame* frame); |
| 109 | void OnNavigationEnd() { will_navigate_ = false; } |
lukasza | df92022f | 2016-05-03 16:42:31 | [diff] [blame] | 110 | void OnAnimationScheduled(blink::WebWidget* widget); |
| 111 | void OnAnimationBegun(blink::WebWidget* widget); |
lukasza | a0b624a | 2016-04-04 15:00:49 | [diff] [blame] | 112 | std::string GetAcceptLanguages() const; |
lukasza | e26c3d6 | 2016-03-14 23:30:59 | [diff] [blame] | 113 | bool shouldStayOnPageAfterHandlingBeforeUnload() const; |
lukasza | 6a113ae1 | 2016-03-17 22:41:20 | [diff] [blame] | 114 | MockScreenOrientationClient* getMockScreenOrientationClient(); |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 115 | MockWebUserMediaClient* getMockWebUserMediaClient(); |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 116 | MockWebSpeechRecognizer* getMockWebSpeechRecognizer(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 117 | bool isPrinting() const; |
[email protected] | f24836a | 2014-05-06 01:02:44 | [diff] [blame] | 118 | bool shouldDumpAsCustomText() const; |
| 119 | std:: string customDumpText() const; |
abhishek.a21 | ca9b560 | 2014-09-19 07:33:33 | [diff] [blame] | 120 | void ShowDevTools(const std::string& settings, |
[email protected] | 06c25301 | 2014-04-16 18:35:33 | [diff] [blame] | 121 | const std::string& frontend_url); |
abhishek.a21 | ca9b560 | 2014-09-19 07:33:33 | [diff] [blame] | 122 | void ClearDevToolsLocalStorage(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 123 | void setShouldDumpAsText(bool); |
| 124 | void setShouldDumpAsMarkup(bool); |
ki.stfu | 939799a4 | 2015-09-28 04:41:20 | [diff] [blame] | 125 | void setCustomTextOutput(const std::string& text); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 126 | void setShouldGeneratePixelResults(bool); |
| 127 | void setShouldDumpFrameLoadCallbacks(bool); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 128 | void setShouldEnableViewSource(bool); |
| 129 | bool shouldDumpEditingCallbacks() const; |
| 130 | bool shouldDumpFrameLoadCallbacks() const; |
| 131 | bool shouldDumpPingLoaderCallbacks() const; |
| 132 | bool shouldDumpUserGestureInFrameLoadCallbacks() const; |
| 133 | bool shouldDumpTitleChanges() const; |
| 134 | bool shouldDumpIconChanges() const; |
| 135 | bool shouldDumpCreateView() const; |
| 136 | bool canOpenWindows() const; |
| 137 | bool shouldDumpResourceLoadCallbacks() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 138 | bool shouldDumpResourceResponseMIMETypes() const; |
| 139 | bool shouldDumpStatusCallbacks() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 140 | bool shouldDumpSpellCheckCallbacks() const; |
[email protected] | a79cb991 | 2014-04-26 22:07:33 | [diff] [blame] | 141 | bool shouldWaitUntilExternalURLLoad() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 142 | const std::set<std::string>* httpHeadersToClear() const; |
tkent | 2edc979d | 2016-05-27 04:58:25 | [diff] [blame] | 143 | bool is_web_platform_tests_mode() const { |
| 144 | return is_web_platform_tests_mode_; |
| 145 | } |
| 146 | void set_is_web_platform_tests_mode() { is_web_platform_tests_mode_ = true; } |
lukasza | 10cd876 | 2016-04-27 20:03:02 | [diff] [blame] | 147 | |
| 148 | // To be called when |frame| starts loading - TestRunner will check if |
| 149 | // there is currently no top-loading-frame being tracked and if so, then it |
| 150 | // will return true and start tracking |frame| as the top-loading-frame. |
| 151 | bool tryToSetTopLoadingFrame(blink::WebFrame* frame); |
| 152 | |
| 153 | // To be called when |frame| finishes loading - TestRunner will check if |
| 154 | // |frame| is currently tracked as the top-loading-frame, and if yes, then it |
| 155 | // will return true, stop top-loading-frame tracking, and potentially finish |
| 156 | // the test (unless testRunner.waitUntilDone() was called and/or there are |
| 157 | // pending load requests in WorkQueue). |
| 158 | bool tryToClearTopLoadingFrame(blink::WebFrame*); |
| 159 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 160 | blink::WebFrame* topLoadingFrame() const; |
| 161 | void policyDelegateDone(); |
| 162 | bool policyDelegateEnabled() const; |
| 163 | bool policyDelegateIsPermissive() const; |
| 164 | bool policyDelegateShouldNotifyDone() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 165 | void setToolTipText(const blink::WebString&); |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 166 | void setDragImage(const blink::WebImage& drag_image); |
jochen | c3a98da1 | 2015-03-10 13:59:58 | [diff] [blame] | 167 | bool shouldDumpNavigationPolicy() const; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 168 | |
toyoshim | 729663f | 2016-10-17 08:54:13 | [diff] [blame] | 169 | midi::mojom::Result midiAccessorResult(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 170 | |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 171 | // Methods used by MockColorChooser: |
| 172 | void DidOpenChooser(); |
| 173 | void DidCloseChooser(); |
| 174 | |
caseq | cb222783 | 2016-05-24 18:52:04 | [diff] [blame] | 175 | bool ShouldDumpConsoleMessages() const; |
tkent | 217ff885 | 2016-11-14 04:43:49 | [diff] [blame^] | 176 | bool ShouldDumpJavaScriptDialogs() const; |
caseq | cb222783 | 2016-05-24 18:52:04 | [diff] [blame] | 177 | |
jkarlin | 3bddb7d | 2016-09-21 18:44:16 | [diff] [blame] | 178 | blink::WebEffectiveConnectionType effective_connection_type() const { |
| 179 | return effective_connection_type_; |
| 180 | } |
| 181 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 182 | // A single item in the work queue. |
| 183 | class WorkItem { |
| 184 | public: |
| 185 | virtual ~WorkItem() {} |
| 186 | |
| 187 | // Returns true if this started a load. |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 188 | virtual bool Run(WebTestDelegate*, blink::WebView*) = 0; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 189 | }; |
| 190 | |
| 191 | private: |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 192 | friend class TestRunnerBindings; |
| 193 | friend class WorkQueue; |
| 194 | |
| 195 | // Helper class for managing events queued by methods like queueLoad or |
| 196 | // queueScript. |
| 197 | class WorkQueue { |
| 198 | public: |
| 199 | explicit WorkQueue(TestRunner* controller); |
| 200 | virtual ~WorkQueue(); |
| 201 | void ProcessWorkSoon(); |
| 202 | |
| 203 | // Reset the state of the class between tests. |
| 204 | void Reset(); |
| 205 | |
| 206 | void AddWork(WorkItem*); |
| 207 | |
| 208 | void set_frozen(bool frozen) { frozen_ = frozen; } |
| 209 | bool is_empty() { return queue_.empty(); } |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 210 | |
| 211 | private: |
| 212 | void ProcessWork(); |
| 213 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 214 | std::deque<WorkItem*> queue_; |
| 215 | bool frozen_; |
| 216 | TestRunner* controller_; |
lukasza | c935882 | 2016-04-07 14:43:46 | [diff] [blame] | 217 | |
| 218 | base::WeakPtrFactory<WorkQueue> weak_factory_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 219 | }; |
| 220 | |
| 221 | /////////////////////////////////////////////////////////////////////////// |
| 222 | // Methods dealing with the test logic |
| 223 | |
| 224 | // By default, tests end when page load is complete. These methods are used |
| 225 | // to delay the completion of the test until notifyDone is called. |
| 226 | void NotifyDone(); |
| 227 | void WaitUntilDone(); |
| 228 | |
| 229 | // Methods for adding actions to the work queue. Used in conjunction with |
| 230 | // waitUntilDone/notifyDone above. |
| 231 | void QueueBackNavigation(int how_far_back); |
| 232 | void QueueForwardNavigation(int how_far_forward); |
| 233 | void QueueReload(); |
| 234 | void QueueLoadingScript(const std::string& script); |
| 235 | void QueueNonLoadingScript(const std::string& script); |
| 236 | void QueueLoad(const std::string& url, const std::string& target); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 237 | |
| 238 | // Causes navigation actions just printout the intended navigation instead |
| 239 | // of taking you to the page. This is used for cases like mailto, where you |
| 240 | // don't actually want to open the mail program. |
| 241 | void SetCustomPolicyDelegate(gin::Arguments* args); |
| 242 | |
| 243 | // Delays completion of the test until the policy delegate runs. |
| 244 | void WaitForPolicyDelegate(); |
| 245 | |
| 246 | // Functions for dealing with windows. By default we block all new windows. |
| 247 | int WindowCount(); |
| 248 | void SetCloseRemainingWindowsWhenComplete(bool close_remaining_windows); |
| 249 | void ResetTestHelperControllers(); |
| 250 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 251 | // Allows layout tests to manage origins' whitelisting. |
| 252 | void AddOriginAccessWhitelistEntry(const std::string& source_origin, |
| 253 | const std::string& destination_protocol, |
| 254 | const std::string& destination_host, |
| 255 | bool allow_destination_subdomains); |
| 256 | void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
| 257 | const std::string& destination_protocol, |
| 258 | const std::string& destination_host, |
| 259 | bool allow_destination_subdomains); |
| 260 | |
dcheng | 9000dbd | 2015-04-03 05:39:40 | [diff] [blame] | 261 | // Add |source_code| as an injected stylesheet to the active document of the |
| 262 | // window of the current V8 context. |
| 263 | void InsertStyleSheet(const std::string& source_code); |
| 264 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 265 | // Enables or disables subpixel positioning (i.e. fractional X positions for |
| 266 | // glyphs) in text rendering on Linux. Since this method changes global |
| 267 | // settings, tests that call it must use their own custom font family for |
| 268 | // all text that they render. If not, an already-cached style will be used, |
| 269 | // resulting in the changed setting being ignored. |
| 270 | void SetTextSubpixelPositioning(bool value); |
| 271 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 272 | // After this function is called, all window-sizing machinery is |
| 273 | // short-circuited inside the renderer. This mode is necessary for |
| 274 | // some tests that were written before browsers had multi-process architecture |
| 275 | // and rely on window resizes to happen synchronously. |
| 276 | // The function has "unfortunate" it its name because we must strive to remove |
| 277 | // all tests that rely on this... well, unfortunate behavior. See |
| 278 | // http://crbug.com/309760 for the plan. |
| 279 | void UseUnfortunateSynchronousResizeMode(); |
| 280 | |
| 281 | bool EnableAutoResizeMode(int min_width, |
| 282 | int min_height, |
| 283 | int max_width, |
| 284 | int max_height); |
| 285 | bool DisableAutoResizeMode(int new_width, int new_height); |
| 286 | |
[email protected] | 2ad7e62 | 2014-06-30 17:44:21 | [diff] [blame] | 287 | void SetMockDeviceLight(double value); |
| 288 | void ResetDeviceLight(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 289 | // Device Motion / Device Orientation related functions |
| 290 | void SetMockDeviceMotion(bool has_acceleration_x, double acceleration_x, |
| 291 | bool has_acceleration_y, double acceleration_y, |
| 292 | bool has_acceleration_z, double acceleration_z, |
| 293 | bool has_acceleration_including_gravity_x, |
| 294 | double acceleration_including_gravity_x, |
| 295 | bool has_acceleration_including_gravity_y, |
| 296 | double acceleration_including_gravity_y, |
| 297 | bool has_acceleration_including_gravity_z, |
| 298 | double acceleration_including_gravity_z, |
| 299 | bool has_rotation_rate_alpha, |
| 300 | double rotation_rate_alpha, |
| 301 | bool has_rotation_rate_beta, |
| 302 | double rotation_rate_beta, |
| 303 | bool has_rotation_rate_gamma, |
| 304 | double rotation_rate_gamma, |
| 305 | double interval); |
| 306 | void SetMockDeviceOrientation(bool has_alpha, double alpha, |
| 307 | bool has_beta, double beta, |
| 308 | bool has_gamma, double gamma, |
philipj | 9790645 | 2016-03-02 14:46:22 | [diff] [blame] | 309 | bool absolute); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 310 | |
[email protected] | e0bc2cb | 2014-03-20 17:34:24 | [diff] [blame] | 311 | void SetMockScreenOrientation(const std::string& orientation); |
dgozman | 3c16f7f | 2016-02-26 01:21:18 | [diff] [blame] | 312 | void DisableMockScreenOrientation(); |
[email protected] | e0bc2cb | 2014-03-20 17:34:24 | [diff] [blame] | 313 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 314 | /////////////////////////////////////////////////////////////////////////// |
| 315 | // Methods modifying WebPreferences. |
| 316 | |
| 317 | // Set the WebPreference that controls webkit's popup blocking. |
| 318 | void SetPopupBlockingEnabled(bool block_popups); |
| 319 | |
| 320 | void SetJavaScriptCanAccessClipboard(bool can_access); |
| 321 | void SetXSSAuditorEnabled(bool enabled); |
| 322 | void SetAllowUniversalAccessFromFileURLs(bool allow); |
| 323 | void SetAllowFileAccessFromFileURLs(bool allow); |
ki.stfu | 939799a4 | 2015-09-28 04:41:20 | [diff] [blame] | 324 | void OverridePreference(const std::string& key, v8::Local<v8::Value> value); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 325 | |
[email protected] | ebd5ea5 | 2014-05-28 14:51:15 | [diff] [blame] | 326 | // Modify accept_languages in RendererPreferences. |
| 327 | void SetAcceptLanguages(const std::string& accept_languages); |
| 328 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 329 | // Enable or disable plugins. |
| 330 | void SetPluginsEnabled(bool enabled); |
| 331 | |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 332 | // Returns |true| if an animation has been scheduled in one or more WebViews |
| 333 | // participating in the layout test. |
| 334 | bool GetAnimationScheduled() const; |
chrishtr | aea6066d | 2016-02-19 04:49:12 | [diff] [blame] | 335 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 336 | /////////////////////////////////////////////////////////////////////////// |
| 337 | // Methods that modify the state of TestRunner |
| 338 | |
| 339 | // This function sets a flag that tells the test_shell to print a line of |
| 340 | // descriptive text for each editing command. It takes no arguments, and |
| 341 | // ignores any that may be present. |
| 342 | void DumpEditingCallbacks(); |
| 343 | |
| 344 | // This function sets a flag that tells the test_shell to dump pages as |
| 345 | // plain text, rather than as a text representation of the renderer's state. |
| 346 | // The pixel results will not be generated for this test. |
| 347 | void DumpAsText(); |
| 348 | |
| 349 | // This function sets a flag that tells the test_shell to dump pages as |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 350 | // the DOM contents, rather than as a text representation of the renderer's |
| 351 | // state. The pixel results will not be generated for this test. |
| 352 | void DumpAsMarkup(); |
| 353 | |
| 354 | // This function sets a flag that tells the test_shell to dump pages as |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 355 | // plain text, rather than as a text representation of the renderer's state. |
| 356 | // It will also generate a pixel dump for the test. |
| 357 | void DumpAsTextWithPixelResults(); |
| 358 | |
| 359 | // This function sets a flag that tells the test_shell to print out the |
| 360 | // scroll offsets of the child frames. It ignores all. |
| 361 | void DumpChildFrameScrollPositions(); |
| 362 | |
| 363 | // This function sets a flag that tells the test_shell to recursively |
| 364 | // dump all frames as plain text if the DumpAsText flag is set. |
| 365 | // It takes no arguments, and ignores any that may be present. |
| 366 | void DumpChildFramesAsText(); |
| 367 | |
[email protected] | fdc433c0 | 2014-06-02 19:27:14 | [diff] [blame] | 368 | // This function sets a flag that tells the test_shell to recursively |
| 369 | // dump all frames as the DOM contents if the DumpAsMarkup flag is set. |
| 370 | // It takes no arguments, and ignores any that may be present. |
| 371 | void DumpChildFramesAsMarkup(); |
| 372 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 373 | // This function sets a flag that tells the test_shell to print out the |
| 374 | // information about icon changes notifications from WebKit. |
| 375 | void DumpIconChanges(); |
| 376 | |
| 377 | // Deals with Web Audio WAV file data. |
| 378 | void SetAudioData(const gin::ArrayBufferView& view); |
| 379 | |
| 380 | // This function sets a flag that tells the test_shell to print a line of |
| 381 | // descriptive text for each frame load callback. It takes no arguments, and |
| 382 | // ignores any that may be present. |
| 383 | void DumpFrameLoadCallbacks(); |
| 384 | |
| 385 | // This function sets a flag that tells the test_shell to print a line of |
| 386 | // descriptive text for each PingLoader dispatch. It takes no arguments, and |
| 387 | // ignores any that may be present. |
| 388 | void DumpPingLoaderCallbacks(); |
| 389 | |
| 390 | // This function sets a flag that tells the test_shell to print a line of |
| 391 | // user gesture status text for some frame load callbacks. It takes no |
| 392 | // arguments, and ignores any that may be present. |
| 393 | void DumpUserGestureInFrameLoadCallbacks(); |
| 394 | |
| 395 | void DumpTitleChanges(); |
| 396 | |
| 397 | // This function sets a flag that tells the test_shell to dump all calls to |
| 398 | // WebViewClient::createView(). |
| 399 | // It takes no arguments, and ignores any that may be present. |
| 400 | void DumpCreateView(); |
| 401 | |
| 402 | void SetCanOpenWindows(); |
| 403 | |
| 404 | // This function sets a flag that tells the test_shell to dump a descriptive |
| 405 | // line for each resource load callback. It takes no arguments, and ignores |
| 406 | // any that may be present. |
| 407 | void DumpResourceLoadCallbacks(); |
| 408 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 409 | // This function sets a flag that tells the test_shell to dump the MIME type |
| 410 | // for each resource that was loaded. It takes no arguments, and ignores any |
| 411 | // that may be present. |
| 412 | void DumpResourceResponseMIMETypes(); |
| 413 | |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 414 | // WebContentSettingsClient related. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 415 | void SetImagesAllowed(bool allowed); |
| 416 | void SetScriptsAllowed(bool allowed); |
| 417 | void SetStorageAllowed(bool allowed); |
| 418 | void SetPluginsAllowed(bool allowed); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 419 | void SetAllowRunningOfInsecureContent(bool allowed); |
mlamouri | 426f286 | 2016-04-29 18:35:01 | [diff] [blame] | 420 | void SetAutoplayAllowed(bool allowed); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 421 | void DumpPermissionClientCallbacks(); |
| 422 | |
engedy | 9ae0424 | 2016-06-08 13:31:18 | [diff] [blame] | 423 | // Sets up a mock DocumentSubresourceFilter to disallow subsequent subresource |
| 424 | // loads within the current document with the given path |suffixes|. The |
| 425 | // filter is created and injected even if |suffixes| is empty. If |suffixes| |
| 426 | // contains the empty string, all subresource loads will be disallowed. |
| 427 | void SetDisallowedSubresourcePathSuffixes( |
| 428 | const std::vector<std::string>& suffixes); |
| 429 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 430 | // This function sets a flag that tells the test_shell to dump all calls |
| 431 | // to window.status(). |
| 432 | // It takes no arguments, and ignores any that may be present. |
| 433 | void DumpWindowStatusChanges(); |
| 434 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 435 | // This function sets a flag that tells the test_shell to dump all |
| 436 | // the lines of descriptive text about spellcheck execution. |
| 437 | void DumpSpellCheckCallbacks(); |
| 438 | |
| 439 | // This function sets a flag that tells the test_shell to print out a text |
| 440 | // representation of the back/forward list. It ignores all arguments. |
| 441 | void DumpBackForwardList(); |
| 442 | |
| 443 | void DumpSelectionRect(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 444 | |
| 445 | // Causes layout to happen as if targetted to printed pages. |
| 446 | void SetPrinting(); |
| 447 | |
[email protected] | 5284610 | 2014-06-24 04:26:44 | [diff] [blame] | 448 | // Clears the state from SetPrinting(). |
| 449 | void ClearPrinting(); |
| 450 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 451 | void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); |
| 452 | |
| 453 | // Causes WillSendRequest to clear certain headers. |
| 454 | void SetWillSendRequestClearHeader(const std::string& header); |
| 455 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 456 | // Sets a flag to enable the mock theme. |
| 457 | void SetUseMockTheme(bool use); |
| 458 | |
[email protected] | a79cb991 | 2014-04-26 22:07:33 | [diff] [blame] | 459 | // Sets a flag that causes the test to be marked as completed when the |
| 460 | // WebFrameClient receives a loadURLExternally() call. |
| 461 | void WaitUntilExternalURLLoad(); |
| 462 | |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 463 | // This function sets a flag to dump the drag image when the next drag&drop is |
| 464 | // initiated. It is equivalent to DumpAsTextWithPixelResults but the pixel |
| 465 | // results will be the drag image instead of a snapshot of the page. |
jackhou | 656fc85 | 2015-02-13 09:04:17 | [diff] [blame] | 466 | void DumpDragImage(); |
| 467 | |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 468 | // Sets a flag that tells the WebViewTestProxy to dump the default navigation |
jochen | c3a98da1 | 2015-03-10 13:59:58 | [diff] [blame] | 469 | // policy passed to the decidePolicyForNavigation callback. |
| 470 | void DumpNavigationPolicy(); |
| 471 | |
caseq | cb222783 | 2016-05-24 18:52:04 | [diff] [blame] | 472 | // Controls whether console messages produced by the page are dumped |
| 473 | // to test output. |
| 474 | void SetDumpConsoleMessages(bool value); |
| 475 | |
tkent | 217ff885 | 2016-11-14 04:43:49 | [diff] [blame^] | 476 | // Controls whether JavaScript dialogs such as alert() are dumped to test |
| 477 | // output. |
| 478 | void SetDumpJavaScriptDialogs(bool value); |
| 479 | |
jkarlin | 3bddb7d | 2016-09-21 18:44:16 | [diff] [blame] | 480 | // Overrides the NetworkQualityEstimator's estimated network type. If |type| |
| 481 | // is TypeUnknown the NQE's value is used. Be sure to call this with |
| 482 | // TypeUnknown at the end of your test if you use this. |
| 483 | void SetEffectiveConnectionType( |
| 484 | blink::WebEffectiveConnectionType connection_type); |
| 485 | |
xiaochengh | 2fa3e76 | 2016-08-24 11:27:04 | [diff] [blame] | 486 | // Controls whether the mock spell checker is enabled. |
| 487 | void SetMockSpellCheckerEnabled(bool enabled); |
| 488 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 489 | /////////////////////////////////////////////////////////////////////////// |
lfg | 05e4137 | 2016-07-22 15:38:10 | [diff] [blame] | 490 | // Methods interacting with the WebViewTestProxy |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 491 | |
| 492 | /////////////////////////////////////////////////////////////////////////// |
| 493 | // Methods forwarding to the WebTestDelegate |
| 494 | |
| 495 | // Shows DevTools window. |
[email protected] | 06c25301 | 2014-04-16 18:35:33 | [diff] [blame] | 496 | void ShowWebInspector(const std::string& str, |
| 497 | const std::string& frontend_url); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 498 | void CloseWebInspector(); |
| 499 | |
| 500 | // Inspect chooser state |
| 501 | bool IsChooserShown(); |
| 502 | |
| 503 | // Allows layout tests to exec scripts at WebInspector side. |
| 504 | void EvaluateInWebInspector(int call_id, const std::string& script); |
sergeyv | 0cd842b4 | 2015-10-09 16:07:11 | [diff] [blame] | 505 | // Allows layout tests to evaluate scripts in InspectorOverlay page. |
| 506 | // Script may have an output represented as a string, return values of other |
| 507 | // types would be ignored. |
| 508 | std::string EvaluateInWebInspectorOverlay(const std::string& script); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 509 | |
| 510 | // Clears all databases. |
| 511 | void ClearAllDatabases(); |
| 512 | // Sets the default quota for all origins |
| 513 | void SetDatabaseQuota(int quota); |
| 514 | |
tyoshino | a6b9146 | 2016-07-11 09:15:09 | [diff] [blame] | 515 | // Sets the cookie policy to: |
| 516 | // - allow all cookies when |block| is false |
| 517 | // - block only third-party cookies when |block| is true |
| 518 | void SetBlockThirdPartyCookies(bool block); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 519 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 520 | // Converts a URL starting with file:///tmp/ to the local mapping. |
| 521 | std::string PathToLocalResource(const std::string& path); |
| 522 | |
mlamouri | d5098d0 | 2015-04-21 12:17:30 | [diff] [blame] | 523 | // Sets the permission's |name| to |value| for a given {origin, embedder} |
| 524 | // tuple. |
| 525 | void SetPermission(const std::string& name, |
| 526 | const std::string& value, |
| 527 | const GURL& origin, |
| 528 | const GURL& embedding_origin); |
| 529 | |
dominickn | 09f7b57 | 2016-10-28 01:44:15 | [diff] [blame] | 530 | // Resolve the in-flight beforeinstallprompt event. |
| 531 | void ResolveBeforeInstallPromptPromise(const std::string& platform); |
benwells | 0c0d3f1 | 2015-05-25 01:03:17 | [diff] [blame] | 532 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 533 | // Calls setlocale(LC_ALL, ...) for a specified locale. |
| 534 | // Resets between tests. |
| 535 | void SetPOSIXLocale(const std::string& locale); |
| 536 | |
| 537 | // MIDI function to control permission handling. |
toyoshim | 729663f | 2016-10-17 08:54:13 | [diff] [blame] | 538 | void SetMIDIAccessorResult(midi::mojom::Result result); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 539 | |
peter | d98157d | 2014-11-20 13:15:01 | [diff] [blame] | 540 | // Simulates a click on a Web Notification. |
awdf | f8bdbe8 | 2016-10-14 09:42:32 | [diff] [blame] | 541 | void SimulateWebNotificationClick(const std::string& title, |
| 542 | int action_index, |
| 543 | const base::NullableString16& reply); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 544 | |
nsatragno | 24bd34b | 2016-02-09 10:30:02 | [diff] [blame] | 545 | // Simulates closing a Web Notification. |
| 546 | void SimulateWebNotificationClose(const std::string& title, bool by_user); |
| 547 | |
[email protected] | 56e365d4 | 2014-05-02 22:18:24 | [diff] [blame] | 548 | // Speech recognition related functions. |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 549 | void AddMockSpeechRecognitionResult(const std::string& transcript, |
| 550 | double confidence); |
| 551 | void SetMockSpeechRecognitionError(const std::string& error, |
| 552 | const std::string& message); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 553 | |
mkwst | 41667ab | 2014-09-16 06:52:43 | [diff] [blame] | 554 | // Credential Manager mock functions |
| 555 | // TODO(mkwst): Support FederatedCredential. |
tyoshino | 5138b3b9 | 2016-09-27 09:11:50 | [diff] [blame] | 556 | void SetMockCredentialManagerResponse(const std::string& id, |
mkwst | 41667ab | 2014-09-16 06:52:43 | [diff] [blame] | 557 | const std::string& name, |
| 558 | const std::string& avatar, |
| 559 | const std::string& password); |
tyoshino | 5138b3b9 | 2016-09-27 09:11:50 | [diff] [blame] | 560 | void ClearMockCredentialManagerResponse(); |
| 561 | void SetMockCredentialManagerError(const std::string& error); |
mkwst | 41667ab | 2014-09-16 06:52:43 | [diff] [blame] | 562 | |
lukasza | 083b4f1 | 2016-03-24 16:51:43 | [diff] [blame] | 563 | // Takes care of notifying the delegate after a change to layout test runtime |
| 564 | // flags. |
| 565 | void OnLayoutTestRuntimeFlagsChanged(); |
lukasza | c9cbe71 | 2016-03-14 14:06:43 | [diff] [blame] | 566 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 567 | /////////////////////////////////////////////////////////////////////////// |
| 568 | // Internal helpers |
[email protected] | eec9e78e | 2014-06-16 21:38:48 | [diff] [blame] | 569 | |
lukasza | 10cd876 | 2016-04-27 20:03:02 | [diff] [blame] | 570 | bool IsFramePartOfMainTestWindow(blink::WebFrame*) const; |
| 571 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 572 | void CheckResponseMimeType(); |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 573 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 574 | // In the Mac code, this is called to trigger the end of a test after the |
| 575 | // page has finished loading. From here, we can generate the dump for the |
| 576 | // test. |
| 577 | void LocationChangeDone(); |
| 578 | |
| 579 | bool test_is_running_; |
| 580 | |
| 581 | // When reset is called, go through and close all but the main test shell |
| 582 | // window. By default, set to true but toggled to false using |
| 583 | // setCloseRemainingWindowsWhenComplete(). |
| 584 | bool close_remaining_windows_; |
| 585 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 586 | WorkQueue work_queue_; |
| 587 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 588 | // Bound variable to return the name of this platform (chromium). |
| 589 | std::string platform_name_; |
| 590 | |
| 591 | // Bound variable to store the last tooltip text |
| 592 | std::string tooltip_text_; |
| 593 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 594 | // Bound variable counting the number of top URLs visited. |
| 595 | int web_history_item_count_; |
| 596 | |
lukasza | 9b9d70e | 2016-02-25 23:45:44 | [diff] [blame] | 597 | // Flags controlling what content gets dumped as a layout text result. |
lukasza | 083b4f1 | 2016-03-24 16:51:43 | [diff] [blame] | 598 | LayoutTestRuntimeFlags layout_test_runtime_flags_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 599 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 600 | // If true, the test_shell will output a base64 encoded WAVE file. |
| 601 | bool dump_as_audio_; |
| 602 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 603 | // If true, the test_shell will produce a dump of the back forward list as |
| 604 | // well. |
| 605 | bool dump_back_forward_list_; |
| 606 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 607 | // If true, pixel dump will be produced as a series of 1px-tall, view-wide |
| 608 | // individual paints over the height of the view. |
| 609 | bool test_repaint_; |
| 610 | |
| 611 | // If true and test_repaint_ is true as well, pixel dump will be produced as |
| 612 | // a series of 1px-wide, view-tall paints across the width of the view. |
| 613 | bool sweep_horizontally_; |
| 614 | |
toyoshim | 729663f | 2016-10-17 08:54:13 | [diff] [blame] | 615 | // startSession() result of MockWebMIDIAccessor for testing. |
| 616 | midi::mojom::Result midi_accessor_result_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 617 | |
[email protected] | f24836a | 2014-05-06 01:02:44 | [diff] [blame] | 618 | bool has_custom_text_output_; |
| 619 | std::string custom_text_output_; |
| 620 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 621 | std::set<std::string> http_headers_to_clear_; |
| 622 | |
| 623 | // WAV audio data is stored here. |
| 624 | std::vector<unsigned char> audio_data_; |
| 625 | |
[email protected] | 79ecada | 2014-05-04 05:16:16 | [diff] [blame] | 626 | TestInterfaces* test_interfaces_; |
| 627 | WebTestDelegate* delegate_; |
lukasza | 8973c52 | 2016-04-27 16:32:28 | [diff] [blame] | 628 | blink::WebView* main_view_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 629 | |
| 630 | // This is non-0 IFF a load is in progress. |
| 631 | blink::WebFrame* top_loading_frame_; |
| 632 | |
mlamouri | 007f9d7 | 2015-02-27 16:27:25 | [diff] [blame] | 633 | // WebContentSettingsClient mock object. |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 634 | std::unique_ptr<MockContentSettingsClient> mock_content_settings_client_; |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 635 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 636 | bool use_mock_theme_; |
| 637 | |
blundell | 987cb78 | 2016-08-17 17:25:37 | [diff] [blame] | 638 | // This is true in the period between the start of a navigation and when the |
| 639 | // provisional load for that navigation is started. Note that when |
| 640 | // browser-side navigation is enabled there is an arbitrary gap between these |
| 641 | // two events. |
| 642 | bool will_navigate_; |
| 643 | |
dcheng | 82beb4f | 2016-04-26 00:35:02 | [diff] [blame] | 644 | std::unique_ptr<MockCredentialManagerClient> credential_manager_client_; |
| 645 | std::unique_ptr<MockScreenOrientationClient> mock_screen_orientation_client_; |
| 646 | std::unique_ptr<MockWebSpeechRecognizer> speech_recognizer_; |
| 647 | std::unique_ptr<MockWebUserMediaClient> user_media_client_; |
| 648 | std::unique_ptr<SpellCheckClient> spellcheck_; |
lukasza | fd12460 | 2016-04-01 16:53:30 | [diff] [blame] | 649 | |
| 650 | // Number of currently active color choosers. |
| 651 | int chooser_count_; |
lukasza | 6a113ae1 | 2016-03-17 22:41:20 | [diff] [blame] | 652 | |
lukasza | 1b546c1 | 2016-04-04 16:19:20 | [diff] [blame] | 653 | // Captured drag image. |
| 654 | blink::WebImage drag_image_; |
| 655 | |
lukasza | 95416be14 | 2016-04-14 15:06:33 | [diff] [blame] | 656 | // View that was focused by a previous call to TestRunner::SetFocus method. |
| 657 | // Note - this can be a dangling pointer to an already destroyed WebView (this |
| 658 | // is ok, because this is taken care of in WebTestDelegate::SetFocus). |
| 659 | blink::WebView* previously_focused_view_; |
| 660 | |
lukasza | df92022f | 2016-05-03 16:42:31 | [diff] [blame] | 661 | std::set<blink::WebWidget*> widgets_with_scheduled_animations_; |
lukasza | 01da260 | 2016-04-05 14:51:26 | [diff] [blame] | 662 | |
tkent | 2edc979d | 2016-05-27 04:58:25 | [diff] [blame] | 663 | // True if we run a test in LayoutTests/imported/{csswg-test,wpt}/. |
| 664 | bool is_web_platform_tests_mode_; |
tkent | 00340348 | 2016-05-26 08:18:41 | [diff] [blame] | 665 | |
jkarlin | 3bddb7d | 2016-09-21 18:44:16 | [diff] [blame] | 666 | // An effective connection type settable by layout tests. |
| 667 | blink::WebEffectiveConnectionType effective_connection_type_; |
| 668 | |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 669 | base::WeakPtrFactory<TestRunner> weak_factory_; |
| 670 | |
| 671 | DISALLOW_COPY_AND_ASSIGN(TestRunner); |
| 672 | }; |
| 673 | |
jochen | f5f3175 | 2015-06-03 12:06:34 | [diff] [blame] | 674 | } // namespace test_runner |
[email protected] | 97f9a795 | 2014-03-14 11:50:33 | [diff] [blame] | 675 | |
jochen | 73e711c | 2015-06-03 10:01:46 | [diff] [blame] | 676 | #endif // COMPONENTS_TEST_RUNNER_TEST_RUNNER_H_ |