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

Unified Diff: Source/web/tests/FrameTestHelpers.h

Issue 271793007: Fix webkit_unit_tests to use the threaded parser and enable everywhere. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload? Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/web/tests/FrameTestHelpers.h
diff --git a/Source/web/tests/FrameTestHelpers.h b/Source/web/tests/FrameTestHelpers.h
index 944921993da43bfd02125eda492ec71cb9069f45..54e8ff0342e01c452fb7584fc95357551fdddf78 100644
--- a/Source/web/tests/FrameTestHelpers.h
+++ b/Source/web/tests/FrameTestHelpers.h
@@ -44,7 +44,22 @@ class WebSettings;
namespace FrameTestHelpers {
+class TestWebFrameClient;
+
+// Loads a url into the specified WebFrame for testing purposes. Pumps any
+// pending resource requests, as well as waiting for the threaded parser to
+// finish, before returning.
void loadFrame(WebFrame*, const std::string& url);
+// Same as above, but for WebFrame::loadHTMLString().
+void loadHTMLString(WebFrame*, const std::string& html, const WebURL& baseURL);
+// Same as above, but for WebFrame::reload().
+void reloadFrame(WebFrame*);
+void reloadFrameIgnoringCache(WebFrame*);
+
+// Pumps pending resource requests while waiting for a frame to load. Don't use
+// this. Use one of the above helpers.
+void pumpPendingRequestsDoNotUse(WebFrame*);
+
void runPendingTasks();
// Convenience class for handling the lifetime of a WebView and its associated mainframe in tests.
@@ -57,10 +72,10 @@ public:
// Creates and initializes the WebView. Implicitly calls reset() first. IF a
// WebFrameClient or a WebViewClient are passed in, they must outlive the
// WebViewHelper.
- WebViewImpl* initialize(bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0, void (*updateSettingsFunc)(WebSettings*) = 0);
+ WebViewImpl* initialize(bool enableJavascript = false, TestWebFrameClient* = 0, WebViewClient* = 0, void (*updateSettingsFunc)(WebSettings*) = 0);
// Same as initialize() but also performs the initial load of the url.
- WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0, void (*updateSettingsFunc)(WebSettings*) = 0);
+ WebViewImpl* initializeAndLoad(const std::string& url, bool enableJavascript = false, TestWebFrameClient* = 0, WebViewClient* = 0, void (*updateSettingsFunc)(WebSettings*) = 0);
void reset();
@@ -75,8 +90,17 @@ private:
// frames and need further specialization of WebFrameClient behavior should subclass this.
class TestWebFrameClient : public WebFrameClient {
public:
+ TestWebFrameClient();
+
virtual WebFrame* createChildFrame(WebLocalFrame* parent, const WebString& frameName) OVERRIDE;
virtual void frameDetached(WebFrame*) OVERRIDE;
+ virtual void didStartLoading(bool) OVERRIDE;
+ virtual void didStopLoading() OVERRIDE;
+
+ bool isLoading() { return m_loadsInProgress > 0; }
+
+private:
+ int m_loadsInProgress;
};
class TestWebViewClient : public WebViewClient {

Powered by Google App Engine
This is Rietveld 408576698