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

Side by Side Diff: content/public/test/layout_tests/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 /*
6 * Copyright (C) 2012 Google Inc. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Google Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived from
20 * this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #ifndef WebTestDelegate_h
36 #define WebTestDelegate_h
37
38 #include <string>
39
40 #include "third_party/WebKit/public/platform/WebString.h"
41 #include "third_party/WebKit/public/platform/WebURL.h"
42 #include "third_party/WebKit/public/platform/WebVector.h"
43
44 #define WEBTESTRUNNER_NEW_HISTORY_CAPTURE
45
46 namespace blink {
47 class WebDeviceMotionData;
48 class WebDeviceOrientationData;
49 class WebFrame;
50 class WebGamepads;
51 class WebHistoryItem;
52 struct WebRect;
53 struct WebSize;
54 struct WebURLError;
55 }
56
57 namespace WebTestRunner {
58
59 struct WebPreferences;
60 class WebTask;
61 class WebTestProxyBase;
62
63 class WebTestDelegate {
64 public:
65 // Set and clear the edit command to execute on the next call to
66 // WebViewClient::handleCurrentKeyboardEvent().
67 virtual void clearEditCommand() = 0;
68 virtual void setEditCommand(const std::string& name, const std::string& valu e) = 0;
69
70 // Set the gamepads to return from Platform::sampleGamepads().
71 virtual void setGamepadData(const blink::WebGamepads&) = 0;
72
73 // Set data to return when registering via Platform::setDeviceMotionListener ().
74 virtual void setDeviceMotionData(const blink::WebDeviceMotionData&) = 0;
75 // Set data to return when registering via Platform::setDeviceOrientationLis tener().
76 virtual void setDeviceOrientationData(const blink::WebDeviceOrientationData& ) = 0;
77
78 // Add a message to the text dump for the layout test.
79 virtual void printMessage(const std::string& message) = 0;
80
81 // The delegate takes ownership of the WebTask objects and is responsible
82 // for deleting them.
83 virtual void postTask(WebTask*) = 0;
84 virtual void postDelayedTask(WebTask*, long long ms) = 0;
85
86 // Register a new isolated filesystem with the given files, and return the
87 // new filesystem id.
88 virtual blink::WebString registerIsolatedFileSystem(const blink::WebVector<b link::WebString>& absoluteFilenames) = 0;
89
90 // Gets the current time in milliseconds since the UNIX epoch.
91 virtual long long getCurrentTimeInMillisecond() = 0;
92
93 // Convert the provided relative path into an absolute path.
94 virtual blink::WebString getAbsoluteWebStringFromUTF8Path(const std::string& path) = 0;
95
96 // Reads in the given file and returns its contents as data URL.
97 virtual blink::WebURL localFileToDataURL(const blink::WebURL&) = 0;
98
99 // Replaces file:///tmp/LayoutTests/ with the actual path to the
100 // LayoutTests directory.
101 virtual blink::WebURL rewriteLayoutTestsURL(const std::string& utf8URL) = 0;
102
103 // Manages the settings to used for layout tests.
104 virtual WebPreferences* preferences() = 0;
105 virtual void applyPreferences() = 0;
106
107 // Enables or disables synchronous resize mode. When enabled, all window-siz ing machinery is
108 // short-circuited inside the renderer. This mode is necessary for some test s that were written
109 // before browsers had multi-process architecture and rely on window resizes to happen synchronously.
110 // The function has "unfortunate" it its name because we must strive to remo ve all tests
111 // that rely on this... well, unfortunate behavior. See http://crbug.com/309 760 for the plan.
112 virtual void useUnfortunateSynchronousResizeMode(bool) = 0;
113
114 // Controls auto resize mode.
115 virtual void enableAutoResizeMode(const blink::WebSize& minSize, const blink ::WebSize& maxSize) = 0;
116 virtual void disableAutoResizeMode(const blink::WebSize&) = 0;
117
118 // Opens and closes the inspector.
119 virtual void showDevTools() = 0;
120 virtual void closeDevTools() = 0;
121
122 // Evaluate the given script in the DevTools agent.
123 virtual void evaluateInWebInspector(long callID, const std::string& script) = 0;
124
125 // Controls WebSQL databases.
126 virtual void clearAllDatabases() = 0;
127 virtual void setDatabaseQuota(int) = 0;
128
129 // Controls the device scale factor of the main WebView for hidpi tests.
130 virtual void setDeviceScaleFactor(float) = 0;
131
132 // Controls which WebView should be focused.
133 virtual void setFocus(WebTestProxyBase*, bool) = 0;
134
135 // Controls whether all cookies should be accepted or writing cookies in a
136 // third-party context is blocked.
137 virtual void setAcceptAllCookies(bool) = 0;
138
139 // The same as rewriteLayoutTestsURL unless the resource is a path starting
140 // with /tmp/, then return a file URL to a temporary file.
141 virtual std::string pathToLocalResource(const std::string& resource) = 0;
142
143 // Sets the POSIX locale of the current process.
144 virtual void setLocale(const std::string&) = 0;
145
146 // Invoked when the test finished.
147 virtual void testFinished() = 0;
148
149 // Invoked when the embedder should close all but the main WebView.
150 virtual void closeRemainingWindows() = 0;
151
152 virtual void deleteAllCookies() = 0;
153
154 // Returns the length of the back/forward history of the main WebView.
155 virtual int navigationEntryCount() = 0;
156
157 // The following trigger navigations on the main WebViwe.
158 virtual void goToOffset(int offset) = 0;
159 virtual void reload() = 0;
160 virtual void loadURLForFrame(const blink::WebURL&, const std::string& frameN ame) = 0;
161
162 // Returns true if resource requests to external URLs should be permitted.
163 virtual bool allowExternalPages() = 0;
164
165 // Returns the back/forward history for the WebView associated with the
166 // given WebTestProxyBase as well as the index of the current entry.
167 virtual void captureHistoryForWindow(WebTestProxyBase*, blink::WebVector<bli nk::WebHistoryItem>*, size_t* currentEntryIndex) = 0;
168 };
169
170 }
171
172 #endif // WebTestDelegate_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698