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

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

Issue 23506013: Make the embedder responsible for creating the WebFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix lifetime on frame detach Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/tests/FrameLoaderClientImplTest.cpp ('k') | Source/web/tests/FrameTestHelpers.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/FrameTestHelpers.h
diff --git a/Source/web/tests/FrameTestHelpers.h b/Source/web/tests/FrameTestHelpers.h
index fa6200739a2ee02d52ac47fa2cef3b3745c9f881..f981e4bae417211bd465a342c387c07c3b015ac7 100644
--- a/Source/web/tests/FrameTestHelpers.h
+++ b/Source/web/tests/FrameTestHelpers.h
@@ -31,24 +31,46 @@
#ifndef FrameTestHelpers_h
#define FrameTestHelpers_h
-#include <string>
+#include "WebViewImpl.h"
#include "wtf/PassOwnPtr.h"
+#include <string>
namespace WebKit {
-class WebFrame;
+class WebFrameImpl;
class WebFrameClient;
-class WebView;
+class WebSettings;
class WebViewClient;
namespace FrameTestHelpers {
void loadFrame(WebFrame*, const std::string& url);
+void runPendingTasks();
-WebView* createWebView(bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0);
-WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0);
+// Convenience class for handling the lifetime of a WebView and its associated mainframe in tests.
+class WebViewHelper {
+ WTF_MAKE_NONCOPYABLE(WebViewHelper);
+public:
+ WebViewHelper();
+ ~WebViewHelper();
-void runPendingTasks();
+ // 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);
+
+ // 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);
+
+ void reset();
+
+ WebView* webView() const { return m_webView; }
+ WebViewImpl* webViewImpl() const { return m_webView; }
+
+private:
+ WebFrameImpl* m_mainFrame;
+ WebViewImpl* m_webView;
+};
} // namespace FrameTestHelpers
} // namespace WebKit
« no previous file with comments | « Source/web/tests/FrameLoaderClientImplTest.cpp ('k') | Source/web/tests/FrameTestHelpers.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698