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

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

Issue 583113002: Abstract class WebTestDelegate to chromium c++ style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test_runner Created 6 years, 3 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
« no previous file with comments | « content/shell/BUILD.gn ('k') | content/shell/renderer/test_runner/event_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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_WEBTESTDELEGATE_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBTESTDELEGATE_H_
7
8 #include <string>
9
10 #include "third_party/WebKit/public/platform/WebScreenOrientationType.h"
11 #include "third_party/WebKit/public/platform/WebString.h"
12 #include "third_party/WebKit/public/platform/WebURL.h"
13 #include "third_party/WebKit/public/platform/WebVector.h"
14 #include "third_party/WebKit/public/web/WebNotificationPresenter.h"
15
16 #define WEBTESTRUNNER_NEW_HISTORY_CAPTURE
17
18 namespace blink {
19 class WebBatteryStatus;
20 class WebDeviceMotionData;
21 class WebDeviceOrientationData;
22 class WebFrame;
23 class WebGamepad;
24 class WebGamepads;
25 class WebHistoryItem;
26 struct WebRect;
27 struct WebSize;
28 struct WebURLError;
29 }
30
31 namespace content {
32
33 class DeviceLightData;
34 class RendererGamepadProvider;
35 class WebTask;
36 class WebTestProxyBase;
37 struct TestPreferences;
38
39 class WebTestDelegate {
40 public:
41 // Set and clear the edit command to execute on the next call to
42 // WebViewClient::handleCurrentKeyboardEvent().
43 virtual void clearEditCommand() = 0;
44 virtual void setEditCommand(const std::string& name, const std::string& valu e) = 0;
45
46 // Sets gamepad provider to be used for tests.
47 virtual void setGamepadProvider(scoped_ptr<RendererGamepadProvider>) = 0;
48
49 // Set data to return when registering via
50 // Platform::setDeviceLightListener().
51 virtual void setDeviceLightData(const double) = 0;
52 // Set data to return when registering via
53 // Platform::setDeviceMotionListener().
54 virtual void setDeviceMotionData(const blink::WebDeviceMotionData&) = 0;
55 // Set data to return when registering via Platform::setDeviceOrientationLis tener().
56 virtual void setDeviceOrientationData(const blink::WebDeviceOrientationData& ) = 0;
57
58 // Set orientation to set when registering via Platform::setScreenOrientatio nListener().
59 virtual void setScreenOrientation(const blink::WebScreenOrientationType&) = 0;
60
61 // Reset the screen orientation data used for testing.
62 virtual void resetScreenOrientation() = 0;
63
64 // Notifies blink about a change in battery status.
65 virtual void didChangeBatteryStatus(const blink::WebBatteryStatus&) = 0;
66
67 // Add a message to the text dump for the layout test.
68 virtual void printMessage(const std::string& message) = 0;
69
70 // The delegate takes ownership of the WebTask objects and is responsible
71 // for deleting them.
72 virtual void postTask(WebTask*) = 0;
73 virtual void postDelayedTask(WebTask*, long long ms) = 0;
74
75 // Register a new isolated filesystem with the given files, and return the
76 // new filesystem id.
77 virtual blink::WebString registerIsolatedFileSystem(const blink::WebVector<b link::WebString>& absoluteFilenames) = 0;
78
79 // Gets the current time in milliseconds since the UNIX epoch.
80 virtual long long getCurrentTimeInMillisecond() = 0;
81
82 // Convert the provided relative path into an absolute path.
83 virtual blink::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0;
84
85 // Reads in the given file and returns its contents as data URL.
86 virtual blink::WebURL localFileToDataURL(const blink::WebURL&) = 0;
87
88 // Replaces file:///tmp/LayoutTests/ with the actual path to the
89 // LayoutTests directory.
90 virtual blink::WebURL rewriteLayoutTestsURL(const std::string& utf8URL) = 0;
91
92 // Manages the settings to used for layout tests.
93 virtual TestPreferences* preferences() = 0;
94 virtual void applyPreferences() = 0;
95
96 // Enables or disables synchronous resize mode. When enabled, all window-siz ing machinery is
97 // short-circuited inside the renderer. This mode is necessary for some test s that were written
98 // before browsers had multi-process architecture and rely on window resizes to happen synchronously.
99 // The function has "unfortunate" it its name because we must strive to remo ve all tests
100 // that rely on this... well, unfortunate behavior. See http://crbug.com/309 760 for the plan.
101 virtual void useUnfortunateSynchronousResizeMode(bool) = 0;
102
103 // Controls auto resize mode.
104 virtual void enableAutoResizeMode(const blink::WebSize& minSize, const blink ::WebSize& maxSize) = 0;
105 virtual void disableAutoResizeMode(const blink::WebSize&) = 0;
106
107 // Clears DevTools' localStorage when an inspector test is started.
108 virtual void clearDevToolsLocalStorage() = 0;
109
110 // Opens and closes the inspector.
111 virtual void showDevTools(const std::string& settings,
112 const std::string& frontend_url) = 0;
113 virtual void closeDevTools() = 0;
114
115 // Evaluate the given script in the DevTools agent.
116 virtual void evaluateInWebInspector(long callID, const std::string& script) = 0;
117
118 // Controls WebSQL databases.
119 virtual void clearAllDatabases() = 0;
120 virtual void setDatabaseQuota(int) = 0;
121
122 // Controls Web Notification permissions.
123 virtual blink::WebNotificationPresenter::Permission
124 checkWebNotificationPermission(const GURL& origin) = 0;
125 virtual void grantWebNotificationPermission(const GURL& origin,
126 bool permission_granted) = 0;
127 virtual void clearWebNotificationPermissions() = 0;
128
129 // Controls the device scale factor of the main WebView for hidpi tests.
130 virtual void setDeviceScaleFactor(float) = 0;
131
132 // Change the device color profile while running a layout test.
133 virtual void setDeviceColorProfile(const std::string& name) = 0;
134
135 // Controls which WebView should be focused.
136 virtual void setFocus(WebTestProxyBase*, bool) = 0;
137
138 // Controls whether all cookies should be accepted or writing cookies in a
139 // third-party context is blocked.
140 virtual void setAcceptAllCookies(bool) = 0;
141
142 // The same as rewriteLayoutTestsURL unless the resource is a path starting
143 // with /tmp/, then return a file URL to a temporary file.
144 virtual std::string pathToLocalResource(const std::string& resource) = 0;
145
146 // Sets the POSIX locale of the current process.
147 virtual void setLocale(const std::string&) = 0;
148
149 // Invoked when the test finished.
150 virtual void testFinished() = 0;
151
152 // Invoked when the embedder should close all but the main WebView.
153 virtual void closeRemainingWindows() = 0;
154
155 virtual void deleteAllCookies() = 0;
156
157 // Returns the length of the back/forward history of the main WebView.
158 virtual int navigationEntryCount() = 0;
159
160 // The following trigger navigations on the main WebViwe.
161 virtual void goToOffset(int offset) = 0;
162 virtual void reload() = 0;
163 virtual void loadURLForFrame(const blink::WebURL&, const std::string& frameN ame) = 0;
164
165 // Returns true if resource requests to external URLs should be permitted.
166 virtual bool allowExternalPages() = 0;
167
168 // Returns a text dump the back/forward history for the WebView associated
169 // with the given WebTestProxyBase.
170 virtual std::string dumpHistoryForWindow(WebTestProxyBase*) = 0;
171 };
172
173 } // namespace content
174
175 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBTESTDELEGATE_H_
OLDNEW
« no previous file with comments | « content/shell/BUILD.gn ('k') | content/shell/renderer/test_runner/event_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698