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

Unified Diff: content/browser/web_contents/web_contents_impl.h

Issue 2752283004: Add the ability to override WebContentsBindingSet binders for testing (Closed)
Patch Set: . Created 3 years, 9 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 | content/browser/web_contents_binding_set_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl.h
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 9978654a34422637c3204e7771c975e740d3b29c..d9af4167886aa600f5f10b87f18632f8a29b8041 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -37,6 +37,7 @@
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_binding_set.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/common/page_importance_signals.h"
#include "content/public/common/renderer_preferences.h"
@@ -79,7 +80,6 @@ class TestWebContents;
class TextInputManager;
class WakeLockServiceContext;
class WebContentsAudioMuter;
-class WebContentsBindingSet;
class WebContentsDelegate;
class WebContentsImpl;
class WebContentsView;
@@ -262,6 +262,18 @@ class CONTENT_EXPORT WebContentsImpl
base::Closure AddBindingSet(const std::string& interface_name,
WebContentsBindingSet* binding_set);
+ // Overrides the incoming Channel-associated interface request handler for
+ // interfaces registered with this WebContents via a WebContentsBindingSet.
+ // |binder| will live until either the binder is overridden again or the
+ // WebContents is destroyed.
+ template <typename Interface>
+ void OverrideBinderForTesting(
+ std::unique_ptr<WebContentsBindingSet::Binder> binder) {
+ auto it = binding_sets_.find(Interface::Name_);
+ DCHECK(it != binding_sets_.end());
+ it->second->SetBinderForTesting(std::move(binder));
+ }
+
// WebContents ------------------------------------------------------
WebContentsDelegate* GetDelegate() override;
void SetDelegate(WebContentsDelegate* delegate) override;
« no previous file with comments | « no previous file | content/browser/web_contents_binding_set_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698