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

Unified Diff: content/shell/renderer/test_runner/web_test_proxy.h

Issue 297043002: Some class comments for WebTestProxy and WebTestProxyBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notify_language_changed
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/web_test_proxy.h
diff --git a/content/shell/renderer/test_runner/web_test_proxy.h b/content/shell/renderer/test_runner/web_test_proxy.h
index d62b4a787bac896a4bda3f9f9304cdf0c5cb69f3..b5011e6d91e6ecb921b28c7a069dd374b5ea56a8 100644
--- a/content/shell/renderer/test_runner/web_test_proxy.h
+++ b/content/shell/renderer/test_runner/web_test_proxy.h
@@ -82,6 +82,11 @@ class WebTestDelegate;
class WebTestInterfaces;
class WebUserMediaClientMock;
+// WebTestProxyBase is the "brain" of WebTestProxy in the sense that
+// WebTestProxy does the bridge between RenderViewImpl and WebTestProxyBase and
+// when it requires a behavior to be different from the usual, it will call
+// WebTestProxyBase that implements the expected behavior.
+// See WebTestProxy class comments for more information.
class WebTestProxyBase : public blink::WebCompositeAndReadbackAsyncCallback {
public:
void SetInterfaces(WebTestInterfaces* interfaces);
@@ -246,8 +251,22 @@ class WebTestProxyBase : public blink::WebCompositeAndReadbackAsyncCallback {
DISALLOW_COPY_AND_ASSIGN(WebTestProxyBase);
};
-// Use this template to inject methods into your WebViewClient/WebFrameClient
-// implementation required for the running layout tests.
+// WebTestProxy is used during LayoutTests and always instantiated, at time of
+// writing with Base=RenderViewImpl. It does not directly inherit from it for
+// layering purposes.
+// The intent of that class is to wrap RenderViewImpl for tests purposes in
+// order to reduce the amount of test specific code in the production code.
+// WebTestProxy is only doing the glue between RenderViewImpl and
+// WebTestProxyBase, that means that there is no logic living in this class
+// except deciding which base class should be called (could be both).
+//
+// Examples of usage:
+// * when a fooClient has a mock implementation, WebTestProxy can override the
+// fooClient() call and have WebTestProxyBase return the mock implementation.
+// * when a value needs to be overridden by LayoutTests, WebTestProxy can
+// override RenderViewImpl's getter and call a getter from WebTestProxyBase
+// instead. In addition, WebTestProxyBase will have a public setter that
+// could be called from the TestRunner.
template <class Base, typename T>
class WebTestProxy : public Base, public WebTestProxyBase {
public:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698