Commit 567040bd authored by Oksana Zhuravlova's avatar Oksana Zhuravlova Committed by Commit Bot

[mojo] Convert CredentialManagerProxy to use BrowserInterfaceBroker

This change converts CredentialManagerProxy to use
BrowserInterfaceBroker, along with mocks in tests.

Bug: 995422
Change-Id: I466ea95239108af5b106651adf18517b23828717
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808300
Commit-Queue: Oksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarArthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699948}
parent c4569c7f
......@@ -21,6 +21,7 @@
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom.h"
#include "third_party/blink/public/mojom/content_index/content_index.mojom.h"
#include "third_party/blink/public/mojom/credentialmanager/credential_manager.mojom.h"
#include "third_party/blink/public/mojom/filesystem/file_system.mojom.h"
#include "third_party/blink/public/mojom/idle/idle_manager.mojom.h"
#include "third_party/blink/public/mojom/locks/lock_manager.mojom.h"
......@@ -28,6 +29,8 @@
#include "third_party/blink/public/mojom/presentation/presentation.mojom.h"
#include "third_party/blink/public/mojom/speech/speech_synthesis.mojom.h"
#include "third_party/blink/public/mojom/webaudio/audio_context_manager.mojom.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
#include "third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom.h"
#if !defined(OS_ANDROID)
#include "third_party/blink/public/mojom/hid/hid.mojom.h"
......@@ -85,6 +88,16 @@ void PopulateFrameBinders(RenderFrameHostImpl* host,
map->Add<blink::mojom::PushMessaging>(base::BindRepeating(
&RenderFrameHostImpl::GetPushMessaging, base::Unretained(host)));
map->Add<blink::mojom::CredentialManager>(base::BindRepeating(
&RenderFrameHostImpl::GetCredentialManager, base::Unretained(host)));
map->Add<blink::mojom::Authenticator>(base::BindRepeating(
&RenderFrameHostImpl::GetAuthenticator, base::Unretained(host)));
map->Add<blink::test::mojom::VirtualAuthenticatorManager>(
base::BindRepeating(&RenderFrameHostImpl::GetVirtualAuthenticatorManager,
base::Unretained(host)));
}
void PopulateBinderMapWithContext(
......
......@@ -93,6 +93,7 @@
#include "third_party/blink/public/mojom/usb/web_usb_service.mojom.h"
#include "third_party/blink/public/mojom/webaudio/audio_context_manager.mojom-forward.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
#include "third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom.h"
#include "third_party/blink/public/mojom/websockets/websocket_connector.mojom.h"
#include "third_party/blink/public/mojom/worker/dedicated_worker_host_factory.mojom.h"
#include "third_party/blink/public/platform/web_focus_type.h"
......@@ -1074,6 +1075,7 @@ class CONTENT_EXPORT RenderFrameHostImpl
void CreateLockManager(
mojo::PendingReceiver<blink::mojom::LockManager> receiver);
void GetFileChooser(
mojo::PendingReceiver<blink::mojom::FileChooser> receiver);
......@@ -1082,6 +1084,15 @@ class CONTENT_EXPORT RenderFrameHostImpl
void CreateWebBluetoothService(
mojo::PendingReceiver<blink::mojom::WebBluetoothService> receiver);
void GetCredentialManager(
mojo::PendingReceiver<blink::mojom::CredentialManager> receiver);
void GetAuthenticator(
mojo::PendingReceiver<blink::mojom::Authenticator> receiver);
void GetVirtualAuthenticatorManager(
mojo::PendingReceiver<blink::test::mojom::VirtualAuthenticatorManager>
receiver);
void GetPushMessaging(
mojo::PendingReceiver<blink::mojom::PushMessaging> receiver);
......@@ -1596,13 +1607,6 @@ class CONTENT_EXPORT RenderFrameHostImpl
void GetFrameHostTestInterface(
mojo::PendingReceiver<blink::mojom::FrameHostTestInterface> receiver)
override;
void GetCredentialManager(
mojo::PendingReceiver<blink::mojom::CredentialManager> receiver) override;
void GetAuthenticator(
mojo::PendingReceiver<blink::mojom::Authenticator> receiver) override;
void GetVirtualAuthenticatorManager(
mojo::PendingReceiver<blink::test::mojom::VirtualAuthenticatorManager>
receiver) override;
// Allows tests to disable the swapout event timer to simulate bugs that
// happen before it fires (to avoid flakiness).
......
......@@ -460,12 +460,11 @@ class WebAuthLocalClientBrowserTest : public WebAuthBrowserTestBase {
}
void ConnectToAuthenticator() {
auto* broker = static_cast<blink::mojom::DocumentInterfaceBroker*>(
static_cast<RenderFrameHostImpl*>(
shell()->web_contents()->GetMainFrame()));
auto* render_frame_host_impl = static_cast<RenderFrameHostImpl*>(
shell()->web_contents()->GetMainFrame());
if (authenticator_remote_.is_bound())
authenticator_remote_.reset();
broker->GetAuthenticator(
render_frame_host_impl->GetAuthenticator(
authenticator_remote_.BindNewPipeAndPassReceiver());
}
......
......@@ -712,13 +712,6 @@ class TestSimpleDocumentInterfaceBrokerImpl
override {
binder_callback_.Run(std::move(receiver));
}
void GetCredentialManager(
mojo::PendingReceiver<blink::mojom::CredentialManager>) override {}
void GetAuthenticator(
mojo::PendingReceiver<blink::mojom::Authenticator> receiver) override {}
void GetVirtualAuthenticatorManager(
mojo::PendingReceiver<blink::test::mojom::VirtualAuthenticatorManager>
receiver) override {}
mojo::Receiver<blink::mojom::DocumentInterfaceBroker> receiver_{this};
BinderCallback binder_callback_;
......
......@@ -4,34 +4,15 @@
module blink.mojom;
import "third_party/blink/public/mojom/credentialmanager/credential_manager.mojom";
import "third_party/blink/public/mojom/frame/frame_host_test_interface.mojom";
import "third_party/blink/public/mojom/webauthn/authenticator.mojom";
import "third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom";
// An interface through which the renderer may request document-scoped
// interfaces from the browser.
interface DocumentInterfaceBroker {
// Binds the blink.mojom.Authenticator pending receiver to its remote
// implementation in the browser process, to allow directing authenticators to
// create or use a public key credential.
GetAuthenticator(pending_receiver<blink.mojom.Authenticator> receiver);
// Binds the blink.mojom.CredentialManager pending receiver to its remote
// implementation in the browser process, to allow storing, retrieving and
// handling credentials.
GetCredentialManager(pending_receiver<blink.mojom.CredentialManager> receiver);
// Binds the blink.mojom.FrameHostTestInterface pending receiver to its
// remote implementation in the browser process, to allow using this test
// interface to exercise requesting document-scoped interfaces from the
// RenderFrameHost through the DocumentInterfaceBroker interface.
GetFrameHostTestInterface(
pending_receiver<blink.mojom.FrameHostTestInterface> receiver);
// Binds the blink.test.mojom.VirtualAuthenticatorManager pending receiver to
// its remote implementation in the browser process, to manage a virtual
// environment that allows talking virtual authenticators via the WebAuth API.
GetVirtualAuthenticatorManager(
pending_receiver<blink.test.mojom.VirtualAuthenticatorManager> receiver);
};
......@@ -4,8 +4,7 @@
#include "third_party/blink/renderer/modules/credentialmanager/credential_manager_proxy.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/mojom/frame/document_interface_broker.mojom-blink.h"
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/core/dom/document.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
......@@ -16,10 +15,10 @@ namespace blink {
CredentialManagerProxy::CredentialManagerProxy(Document& document) {
LocalFrame* frame = document.GetFrame();
DCHECK(frame);
frame->GetDocumentInterfaceBroker().GetCredentialManager(
frame->GetBrowserInterfaceBroker().GetInterface(
credential_manager_.BindNewPipeAndPassReceiver(
frame->GetTaskRunner(TaskType::kUserInteraction)));
frame->GetDocumentInterfaceBroker().GetAuthenticator(
frame->GetBrowserInterfaceBroker().GetInterface(
authenticator_.BindNewPipeAndPassReceiver(
frame->GetTaskRunner(TaskType::kUserInteraction)));
}
......
......@@ -13,6 +13,7 @@
#include "mojo/public/cpp/bindings/receiver.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-blink.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_testing.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_gc_controller.h"
......@@ -21,7 +22,6 @@
#include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/testing/gc_object_liveness_observer.h"
#include "third_party/blink/renderer/core/testing/test_document_interface_broker.h"
#include "third_party/blink/renderer/core/typed_arrays/dom_array_buffer.h"
#include "third_party/blink/renderer/modules/credentialmanager/credential.h"
#include "third_party/blink/renderer/modules/credentialmanager/credential_creation_options.h"
......@@ -99,30 +99,6 @@ class MockCredentialManager : public mojom::blink::CredentialManager {
DISALLOW_COPY_AND_ASSIGN(MockCredentialManager);
};
class MockCredentialManagerDocumentInterfaceBroker
: public TestDocumentInterfaceBroker {
public:
MockCredentialManagerDocumentInterfaceBroker(
mojom::blink::DocumentInterfaceBroker* document_interface_broker,
mojo::PendingReceiver<mojom::blink::DocumentInterfaceBroker> receiver,
MockCredentialManager* mock_credential_manager)
: TestDocumentInterfaceBroker(document_interface_broker,
std::move(receiver)),
mock_credential_manager_(mock_credential_manager) {}
void GetCredentialManager(
mojo::PendingReceiver<::blink::mojom::blink::CredentialManager> receiver)
override {
mock_credential_manager_->Bind(std::move(receiver));
}
void GetAuthenticator(
mojo::PendingReceiver<mojom::blink::Authenticator> receiver) override {}
private:
MockCredentialManager* mock_credential_manager_;
};
class CredentialManagerTestingContext {
STACK_ALLOCATED();
......@@ -132,12 +108,23 @@ class CredentialManagerTestingContext {
: dummy_context_(KURL("https://example.test")) {
dummy_context_.GetDocument().SetSecureContextStateForTesting(
SecureContextState::kSecure);
mojo::PendingRemote<mojom::blink::DocumentInterfaceBroker> doc;
broker_ = std::make_unique<MockCredentialManagerDocumentInterfaceBroker>(
&dummy_context_.GetFrame().GetDocumentInterfaceBroker(),
doc.InitWithNewPipeAndPassReceiver(), mock_credential_manager);
dummy_context_.GetFrame().SetDocumentInterfaceBrokerForTesting(
doc.PassPipe());
dummy_context_.GetFrame().GetBrowserInterfaceBroker().SetBinderForTesting(
::blink::mojom::blink::CredentialManager::Name_,
WTF::BindRepeating(
[](MockCredentialManager* mock_credential_manager,
mojo::ScopedMessagePipeHandle handle) {
mock_credential_manager->Bind(
mojo::PendingReceiver<
::blink::mojom::blink::CredentialManager>(
std::move(handle)));
},
WTF::Unretained(mock_credential_manager)));
}
~CredentialManagerTestingContext() {
dummy_context_.GetFrame().GetBrowserInterfaceBroker().SetBinderForTesting(
::blink::mojom::blink::CredentialManager::Name_, {});
}
Document* GetDocument() { return &dummy_context_.GetDocument(); }
......@@ -146,7 +133,6 @@ class CredentialManagerTestingContext {
private:
V8TestingScope dummy_context_;
std::unique_ptr<MockCredentialManagerDocumentInterfaceBroker> broker_;
};
} // namespace
......
......@@ -2,7 +2,6 @@
<title>Credential Manager: create() basics.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -12,8 +11,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
......@@ -4,11 +4,9 @@
<script src="../resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/time.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/virtual-navigator-credentials.js"></script>
<body>
......
......@@ -2,7 +2,6 @@
<title>Credential Manager: create() with custom origins.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -12,8 +11,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
......@@ -5,10 +5,8 @@
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/time.mojom-lite.js"></script>
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/virtual-navigator-credentials.js"></script>
<body>
......
......@@ -2,7 +2,6 @@
<title>Credential Manager: get() basics.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -12,8 +11,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -11,8 +10,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
......@@ -4,11 +4,9 @@
<script src="../resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/time.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/virtual-navigator-credentials.js"></script>
<body>
......
......@@ -2,7 +2,6 @@
<title>Credential Manager: get() with custom origins.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -12,8 +11,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
......@@ -4,11 +4,9 @@
<script src="../resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/time.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/virtual-navigator-credentials.js"></script>
<body>
......
......@@ -2,7 +2,6 @@
<title>Credential Manager: preventSilentAccess() basics.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -12,8 +11,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
......@@ -2,7 +2,6 @@
<title>Credential Manager: store() basics.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -12,8 +11,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -11,8 +10,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/mock-navigator-credentials.js"></script>
<script>
......
......@@ -4,11 +4,9 @@
<script src="../resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/time.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/virtual-navigator-credentials.js"></script>
<script>
......
......@@ -14,6 +14,13 @@ function stringToMojoString16(string) {
class MockCredentialManager {
constructor() {
this.reset();
this.interceptor_ = new MojoInterfaceInterceptor(
blink.mojom.CredentialManager.$interfaceName, "context", true);
this.interceptor_.oninterfacerequest = e => {
this.bindHandleToReceiver(e.handle);
};
this.interceptor_.start();
}
bindHandleToReceiver(handle) {
......@@ -71,6 +78,13 @@ class MockCredentialManager {
class MockAuthenticator {
constructor() {
this.reset();
this.interceptor_ = new MojoInterfaceInterceptor(
blink.mojom.Authenticator.$interfaceName, "context", true);
this.interceptor_.oninterfacerequest = e => {
this.bindHandleToReceiver(e.handle);
};
this.interceptor_.start();
}
bindHandleToReceiver(handle) {
......@@ -192,12 +206,3 @@ class MockAuthenticator {
var mockAuthenticator = new MockAuthenticator();
var mockCredentialManager = new MockCredentialManager();
setDocumentInterfaceBrokerOverrides({
getAuthenticator: request => {
mockAuthenticator.bindHandleToReceiver(request.handle);
},
getCredentialManager: request => {
mockCredentialManager.bindHandleToReceiver(request.handle);
}
});
<!DOCTYPE HTML>
<script src="../../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -9,7 +8,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="test-inputs.js"></script>
<script src="mock-navigator-credentials.js"></script>
<script>
......
<!DOCTYPE HTML>
<script src="../../js-test-resources/document-interface-broker-helpers.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/big_buffer.mojom-lite.js"></script>
......@@ -9,7 +8,6 @@
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/credentialmanager/credential_manager.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="test-inputs.js"></script>
<script src="mock-navigator-credentials.js"></script>
<script>
......
......@@ -53,11 +53,10 @@ class VirtualAuthenticator {
class VirtualAuthenticatorManager {
constructor() {
const docBrokerRemote = new blink.mojom.DocumentInterfaceBrokerRemote(
Mojo.getDocumentInterfaceBrokerHandle());
this.virtualAuthenticatorManager_ = new blink.test.mojom.VirtualAuthenticatorManagerRemote;
docBrokerRemote.getVirtualAuthenticatorManager(
this.virtualAuthenticatorManager_.$.bindNewPipeAndPassReceiver());
Mojo.bindInterface(
blink.test.mojom.VirtualAuthenticatorManager.$interfaceName,
this.virtualAuthenticatorManager_.$.bindNewPipeAndPassReceiver().handle, "context", true);
}
async createAuthenticator(options = {}) {
......
......@@ -4,11 +4,9 @@
<script src="../resources/testharnessreport.js"></script>
<script src="/gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="/gen/mojo/public/mojom/base/time.mojom-lite.js"></script>
<script src="/gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="/gen/url/mojom/url.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="/gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script src="resources/test-inputs.js"></script>
<script src="resources/virtual-navigator-credentials.js"></script>
<script>
......
......@@ -3,11 +3,8 @@
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings_lite.js"></script>
<script src="file:///gen/mojo/public/mojom/base/time.mojom-lite.js"></script>
<script src="file:///gen/mojo/public/mojom/base/unguessable_token.mojom-lite.js"></script>
<script src="file:///gen/url/mojom/url.mojom-lite.js"></script>
<script src="file:///gen/third_party/blink/public/mojom/webauthn/authenticator.mojom-lite.js"></script>
<script src="file:///gen/third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-lite.js"></script>
<script src="file:///gen/third_party/blink/public/mojom/frame/frame_host_test_interface.mojom-lite.js"></script>
<script src="file:///gen/third_party/blink/public/mojom/frame/document_interface_broker.mojom-lite.js"></script>
<script>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment