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

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

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years 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 | Annotate | Revision Log
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 WebTestDelegate_h
6 #define WebTestDelegate_h
7
8 #include <string>
9
10 #include "third_party/WebKit/public/platform/WebString.h"
11 #include "third_party/WebKit/public/platform/WebURL.h"
12 #include "third_party/WebKit/public/platform/WebVector.h"
13
14 #define WEBTESTRUNNER_NEW_HISTORY_CAPTURE
15
16 namespace blink {
17 class WebDeviceMotionData;
18 class WebDeviceOrientationData;
19 class WebFrame;
20 class WebGamepads;
21 class WebHistoryItem;
22 struct WebRect;
23 struct WebSize;
24 struct WebURLError;
25 }
26
27 namespace WebTestRunner {
28
29 struct WebPreferences;
30 class WebTask;
31 class WebTestProxyBase;
32
33 class WebTestDelegate {
34 public:
35 // Set and clear the edit command to execute on the next call to
36 // WebViewClient::handleCurrentKeyboardEvent().
37 virtual void clearEditCommand() = 0;
38 virtual void setEditCommand(const std::string& name, const std::string& valu e) = 0;
39
40 // Set the gamepads to return from Platform::sampleGamepads().
41 virtual void setGamepadData(const blink::WebGamepads&) = 0;
42
43 // Set data to return when registering via Platform::setDeviceMotionListener ().
44 virtual void setDeviceMotionData(const blink::WebDeviceMotionData&) = 0;
45 // Set data to return when registering via Platform::setDeviceOrientationLis tener().
46 virtual void setDeviceOrientationData(const blink::WebDeviceOrientationData& ) = 0;
47
48 // Add a message to the text dump for the layout test.
49 virtual void printMessage(const std::string& message) = 0;
50
51 // The delegate takes ownership of the WebTask objects and is responsible
52 // for deleting them.
53 virtual void postTask(WebTask*) = 0;
54 virtual void postDelayedTask(WebTask*, long long ms) = 0;
55
56 // Register a new isolated filesystem with the given files, and return the
57 // new filesystem id.
58 virtual blink::WebString registerIsolatedFileSystem(const blink::WebVector<b link::WebString>& absoluteFilenames) = 0;
59
60 // Gets the current time in milliseconds since the UNIX epoch.
61 virtual long long getCurrentTimeInMillisecond() = 0;
62
63 // Convert the provided relative path into an absolute path.
64 virtual blink::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0;
65
66 // Reads in the given file and returns its contents as data URL.
67 virtual blink::WebURL localFileToDataURL(const blink::WebURL&) = 0;
68
69 // Replaces file:///tmp/LayoutTests/ with the actual path to the
70 // LayoutTests directory.
71 virtual blink::WebURL rewriteLayoutTestsURL(const std::string& utf8URL) = 0;
72
73 // Manages the settings to used for layout tests.
74 virtual WebPreferences* preferences() = 0;
75 virtual void applyPreferences() = 0;
76
77 // Enables or disables synchronous resize mode. When enabled, all window-siz ing machinery is
78 // short-circuited inside the renderer. This mode is necessary for some test s that were written
79 // before browsers had multi-process architecture and rely on window resizes to happen synchronously.
80 // The function has "unfortunate" it its name because we must strive to remo ve all tests
81 // that rely on this... well, unfortunate behavior. See http://crbug.com/309 760 for the plan.
82 virtual void useUnfortunateSynchronousResizeMode(bool) = 0;
83
84 // Controls auto resize mode.
85 virtual void enableAutoResizeMode(const blink::WebSize& minSize, const blink ::WebSize& maxSize) = 0;
86 virtual void disableAutoResizeMode(const blink::WebSize&) = 0;
87
88 // Opens and closes the inspector.
89 virtual void showDevTools() = 0;
90 virtual void closeDevTools() = 0;
91
92 // Evaluate the given script in the DevTools agent.
93 virtual void evaluateInWebInspector(long callID, const std::string& script) = 0;
94
95 // Controls WebSQL databases.
96 virtual void clearAllDatabases() = 0;
97 virtual void setDatabaseQuota(int) = 0;
98
99 // Controls the device scale factor of the main WebView for hidpi tests.
100 virtual void setDeviceScaleFactor(float) = 0;
101
102 // Controls which WebView should be focused.
103 virtual void setFocus(WebTestProxyBase*, bool) = 0;
104
105 // Controls whether all cookies should be accepted or writing cookies in a
106 // third-party context is blocked.
107 virtual void setAcceptAllCookies(bool) = 0;
108
109 // The same as rewriteLayoutTestsURL unless the resource is a path starting
110 // with /tmp/, then return a file URL to a temporary file.
111 virtual std::string pathToLocalResource(const std::string& resource) = 0;
112
113 // Sets the POSIX locale of the current process.
114 virtual void setLocale(const std::string&) = 0;
115
116 // Invoked when the test finished.
117 virtual void testFinished() = 0;
118
119 // Invoked when the embedder should close all but the main WebView.
120 virtual void closeRemainingWindows() = 0;
121
122 virtual void deleteAllCookies() = 0;
123
124 // Returns the length of the back/forward history of the main WebView.
125 virtual int navigationEntryCount() = 0;
126
127 // The following trigger navigations on the main WebViwe.
128 virtual void goToOffset(int offset) = 0;
129 virtual void reload() = 0;
130 virtual void loadURLForFrame(const blink::WebURL&, const std::string& frameN ame) = 0;
131
132 // Returns true if resource requests to external URLs should be permitted.
133 virtual bool allowExternalPages() = 0;
134
135 // Returns the back/forward history for the WebView associated with the
136 // given WebTestProxyBase as well as the index of the current entry.
137 virtual void captureHistoryForWindow(WebTestProxyBase*, blink::WebVector<bli nk::WebHistoryItem>*, size_t* currentEntryIndex) = 0;
138 };
139
140 }
141
142 #endif // WebTestDelegate_h
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/WebTask.cpp ('k') | content/shell/renderer/test_runner/WebTestInterfaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698