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

Side by Side Diff: content/public/test/web_contents_binding_set_test_binder.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 unified diff | Download patch
« no previous file with comments | « content/public/browser/web_contents_binding_set.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 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 #include "content/public/browser/web_contents_binding_set.h"
6
7 #include "mojo/public/cpp/bindings/associated_interface_request.h"
8
9 namespace content {
10
11 // Helper class which test code can use with
12 // WebContentsImpl::OverrideBinderForTesting() in order to override
13 // WebContentsBindingSet interface binding behavior in tests.
14 template <typename Interface>
15 class WebContentsBindingSetTestBinder : public WebContentsBindingSet::Binder {
16 public:
17 ~WebContentsBindingSetTestBinder() override {}
18
19 // Call for every new incoming interface request for a frame.
20 virtual void BindRequest(
21 RenderFrameHost* render_frame_host,
22 mojo::AssociatedInterfaceRequest<Interface> request) = 0;
23
24 private:
25 // Binder:
26 void OnRequestForFrame(RenderFrameHost* render_frame_host,
27 mojo::ScopedInterfaceEndpointHandle handle) override {
28 mojo::AssociatedInterfaceRequest<Interface> request;
29 request.Bind(std::move(handle));
30 BindRequest(render_frame_host, std::move(request));
31 }
32 };
33
34 } // namespace content
OLDNEW
« no previous file with comments | « content/public/browser/web_contents_binding_set.cc ('k') | content/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698