Commit 4ea2bcac authored by mkwst's avatar mkwst Committed by Commit bot

Credential Manager: Refactor password_manager::CredentialManagerClient.

password_manager::CredentialManagerClient was a RenderProcessObserver,
and sent messages via RenderThread. This couldn't possibly have ever
worked; the messages it sent were simply dropped on the floor.

After this patch, it's a RenderViewObserver and its messages
successfully land in the ChromePasswordManagerClient, just as they
ought to.

BUG=400674

Review URL: https://codereview.chromium.org/533493004

Cr-Commit-Position: refs/heads/master@{#292932}
parent c5cfa642
...@@ -319,9 +319,6 @@ void ChromeContentRendererClient::RenderThreadStarted() { ...@@ -319,9 +319,6 @@ void ChromeContentRendererClient::RenderThreadStarted() {
#endif #endif
search_bouncer_.reset(new SearchBouncer()); search_bouncer_.reset(new SearchBouncer());
credential_manager_client_.reset(
new password_manager::CredentialManagerClient());
thread->AddObserver(chrome_observer_.get()); thread->AddObserver(chrome_observer_.get());
thread->AddObserver(extension_dispatcher_.get()); thread->AddObserver(extension_dispatcher_.get());
#if defined(FULL_SAFE_BROWSING) #if defined(FULL_SAFE_BROWSING)
...@@ -330,7 +327,6 @@ void ChromeContentRendererClient::RenderThreadStarted() { ...@@ -330,7 +327,6 @@ void ChromeContentRendererClient::RenderThreadStarted() {
thread->AddObserver(visited_link_slave_.get()); thread->AddObserver(visited_link_slave_.get());
thread->AddObserver(prerender_dispatcher_.get()); thread->AddObserver(prerender_dispatcher_.get());
thread->AddObserver(search_bouncer_.get()); thread->AddObserver(search_bouncer_.get());
thread->AddObserver(credential_manager_client_.get());
#if defined(ENABLE_WEBRTC) #if defined(ENABLE_WEBRTC)
thread->AddFilter(webrtc_logging_message_filter_.get()); thread->AddFilter(webrtc_logging_message_filter_.get());
...@@ -507,8 +503,7 @@ void ChromeContentRendererClient::RenderViewCreated( ...@@ -507,8 +503,7 @@ void ChromeContentRendererClient::RenderViewCreated(
new ChromeRenderViewObserver(render_view, chrome_observer_.get()); new ChromeRenderViewObserver(render_view, chrome_observer_.get());
if (credential_manager_client_) new password_manager::CredentialManagerClient(render_view);
credential_manager_client_->OnRenderViewCreated(render_view);
} }
void ChromeContentRendererClient::SetNumberOfViews(int number_of_views) { void ChromeContentRendererClient::SetNumberOfViews(int number_of_views) {
......
...@@ -432,7 +432,6 @@ ...@@ -432,7 +432,6 @@
'sources': [ 'sources': [
'autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc', 'autofill/content/renderer/renderer_save_password_progress_logger_unittest.cc',
'dom_distiller/content/dom_distiller_viewer_source_unittest.cc', 'dom_distiller/content/dom_distiller_viewer_source_unittest.cc',
'password_manager/content/renderer/credential_manager_client_unittest.cc',
'power/origin_power_map_unittest.cc', 'power/origin_power_map_unittest.cc',
'usb_service/usb_context_unittest.cc', 'usb_service/usb_context_unittest.cc',
'usb_service/usb_device_filter_unittest.cc', 'usb_service/usb_device_filter_unittest.cc',
...@@ -462,10 +461,6 @@ ...@@ -462,10 +461,6 @@
# Dependencies of precache/content # Dependencies of precache/content
'components.gyp:precache_content', 'components.gyp:precache_content',
# Dependencies of password_manager
'components.gyp:password_manager_content_renderer',
'components.gyp:password_manager_content_renderer_test_support',
# Dependencies of power # Dependencies of power
'components.gyp:power', 'components.gyp:power',
...@@ -845,6 +840,7 @@ ...@@ -845,6 +840,7 @@
'components.gyp:autofill_content_browser', 'components.gyp:autofill_content_browser',
'components.gyp:dom_distiller_content', 'components.gyp:dom_distiller_content',
'components.gyp:dom_distiller_core', 'components.gyp:dom_distiller_core',
'components.gyp:password_manager_content_renderer',
'components.gyp:pref_registry_test_support', 'components.gyp:pref_registry_test_support',
'components_resources.gyp:components_resources', 'components_resources.gyp:components_resources',
'../content/content.gyp:content_common', '../content/content.gyp:content_common',
...@@ -868,6 +864,7 @@ ...@@ -868,6 +864,7 @@
'sources': [ 'sources': [
'autofill/content/browser/risk/fingerprint_browsertest.cc', 'autofill/content/browser/risk/fingerprint_browsertest.cc',
'dom_distiller/content/distiller_page_web_contents_browsertest.cc', 'dom_distiller/content/distiller_page_web_contents_browsertest.cc',
'password_manager/content/renderer/credential_manager_client_browsertest.cc',
], ],
'actions': [ 'actions': [
{ {
......
...@@ -198,26 +198,6 @@ ...@@ -198,26 +198,6 @@
'password_manager/content/renderer/credential_manager_client.h', 'password_manager/content/renderer/credential_manager_client.h',
], ],
}, },
{
# GN version: //components/password_manager/core/browser:test_support
'target_name': 'password_manager_content_renderer_test_support',
'type': 'static_library',
'dependencies': [
'password_manager_content_common',
'../base/base.gyp:base',
'../testing/gmock.gyp:gmock',
'../testing/gtest.gyp:gtest',
'../third_party/WebKit/public/blink.gyp:blink',
],
'include_dirs': [
'..',
],
'sources': [
# Note: sources list duplicated in GN build.
'password_manager/content/renderer/test_credential_manager_client.cc',
'password_manager/content/renderer/test_credential_manager_client.h',
],
},
{ {
# GN version: //components/password_manager/content/browser # GN version: //components/password_manager/content/browser
'target_name': 'password_manager_content_browser', 'target_name': 'password_manager_content_browser',
......
...@@ -17,26 +17,13 @@ static_library("renderer") { ...@@ -17,26 +17,13 @@ static_library("renderer") {
] ]
} }
static_library("test_support") { source_set("browser_tests") {
sources = [ sources = [
"test_credential_manager_client.cc", "credential_manager_client_browsertest.cc"
"test_credential_manager_client.h",
]
deps = [
"//testing/gmock",
"//third_party/WebKit/public:blink",
]
}
source_set("unit_tests") {
sources = [
"credential_manager_client_unittest.cc"
] ]
deps = [ deps = [
":renderer", ":renderer",
":test_support",
"//testing/gmock", "//testing/gmock",
"//testing/gtest", "//testing/gtest",
"//third_party/WebKit/public:blink", "//third_party/WebKit/public:blink",
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "components/password_manager/content/common/credential_manager_messages.h" #include "components/password_manager/content/common/credential_manager_messages.h"
#include "components/password_manager/content/common/credential_manager_types.h" #include "components/password_manager/content/common/credential_manager_types.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h" #include "content/public/renderer/render_view.h"
#include "third_party/WebKit/public/platform/WebCredential.h" #include "third_party/WebKit/public/platform/WebCredential.h"
#include "third_party/WebKit/public/platform/WebCredentialManagerError.h" #include "third_party/WebKit/public/platform/WebCredentialManagerError.h"
...@@ -31,45 +30,19 @@ void ClearCallbacksMapWithErrors(T* callbacks_map) { ...@@ -31,45 +30,19 @@ void ClearCallbacksMapWithErrors(T* callbacks_map) {
} // namespace } // namespace
CredentialManagerClient::CredentialManagerClient() CredentialManagerClient::CredentialManagerClient(
: routing_id_(MSG_ROUTING_NONE), content::RenderView* render_view)
render_thread_(content::RenderThread::Get()) { : content::RenderViewObserver(render_view) {
DCHECK(render_thread_); render_view->GetWebView()->setCredentialManagerClient(this);
} }
CredentialManagerClient::~CredentialManagerClient() { CredentialManagerClient::~CredentialManagerClient() {
DisconnectFromRenderThread();
ClearCallbacksMapWithErrors(&failed_sign_in_callbacks_); ClearCallbacksMapWithErrors(&failed_sign_in_callbacks_);
ClearCallbacksMapWithErrors(&signed_in_callbacks_); ClearCallbacksMapWithErrors(&signed_in_callbacks_);
ClearCallbacksMapWithErrors(&signed_out_callbacks_); ClearCallbacksMapWithErrors(&signed_out_callbacks_);
ClearCallbacksMapWithErrors(&request_callbacks_); ClearCallbacksMapWithErrors(&request_callbacks_);
} }
void CredentialManagerClient::OnRenderViewCreated(
content::RenderView* render_view) {
render_view->GetWebView()->setCredentialManagerClient(this);
}
void CredentialManagerClient::OnRenderProcessShutdown() {
DisconnectFromRenderThread();
}
int CredentialManagerClient::GetRoutingID() {
if (render_thread_ && routing_id_ == MSG_ROUTING_NONE) {
routing_id_ = render_thread_->GenerateRoutingID();
render_thread_->AddRoute(routing_id_, this);
}
return routing_id_;
}
void CredentialManagerClient::DisconnectFromRenderThread() {
if (render_thread_ && routing_id_ != MSG_ROUTING_NONE)
render_thread_->RemoveRoute(routing_id_);
render_thread_ = NULL;
routing_id_ = MSG_ROUTING_NONE;
}
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Handle messages from the browser. // Handle messages from the browser.
...@@ -119,10 +92,8 @@ void CredentialManagerClient::dispatchFailedSignIn( ...@@ -119,10 +92,8 @@ void CredentialManagerClient::dispatchFailedSignIn(
int request_id = failed_sign_in_callbacks_.Add(callbacks); int request_id = failed_sign_in_callbacks_.Add(callbacks);
CredentialInfo info( CredentialInfo info(
credential.id(), credential.name(), credential.avatarURL()); credential.id(), credential.name(), credential.avatarURL());
if (render_thread_) { Send(new CredentialManagerHostMsg_NotifyFailedSignIn(
render_thread_->Send(new CredentialManagerHostMsg_NotifyFailedSignIn( routing_id(), request_id, info));
GetRoutingID(), request_id, info));
}
} }
void CredentialManagerClient::dispatchSignedIn( void CredentialManagerClient::dispatchSignedIn(
...@@ -131,19 +102,14 @@ void CredentialManagerClient::dispatchSignedIn( ...@@ -131,19 +102,14 @@ void CredentialManagerClient::dispatchSignedIn(
int request_id = signed_in_callbacks_.Add(callbacks); int request_id = signed_in_callbacks_.Add(callbacks);
CredentialInfo info( CredentialInfo info(
credential.id(), credential.name(), credential.avatarURL()); credential.id(), credential.name(), credential.avatarURL());
if (render_thread_) { Send(new CredentialManagerHostMsg_NotifySignedIn(
render_thread_->Send(new CredentialManagerHostMsg_NotifySignedIn( routing_id(), request_id, info));
GetRoutingID(), request_id, info));
}
} }
void CredentialManagerClient::dispatchSignedOut( void CredentialManagerClient::dispatchSignedOut(
NotificationCallbacks* callbacks) { NotificationCallbacks* callbacks) {
int request_id = signed_out_callbacks_.Add(callbacks); int request_id = signed_out_callbacks_.Add(callbacks);
if (render_thread_) { Send(new CredentialManagerHostMsg_NotifySignedOut(routing_id(), request_id));
render_thread_->Send(new CredentialManagerHostMsg_NotifySignedOut(
GetRoutingID(), request_id));
}
} }
void CredentialManagerClient::dispatchRequest( void CredentialManagerClient::dispatchRequest(
...@@ -154,10 +120,8 @@ void CredentialManagerClient::dispatchRequest( ...@@ -154,10 +120,8 @@ void CredentialManagerClient::dispatchRequest(
std::vector<GURL> federation_vector; std::vector<GURL> federation_vector;
for (size_t i = 0; i < std::min(federations.size(), kMaxFederations); ++i) for (size_t i = 0; i < std::min(federations.size(), kMaxFederations); ++i)
federation_vector.push_back(federations[i]); federation_vector.push_back(federations[i]);
if (render_thread_) { Send(new CredentialManagerHostMsg_RequestCredential(
render_thread_->Send(new CredentialManagerHostMsg_RequestCredential( routing_id(), request_id, zeroClickOnly, federation_vector));
GetRoutingID(), request_id, zeroClickOnly, federation_vector));
}
} }
void CredentialManagerClient::RespondToNotificationCallback( void CredentialManagerClient::RespondToNotificationCallback(
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/basictypes.h" #include "base/basictypes.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/id_map.h" #include "base/id_map.h"
#include "content/public/renderer/render_process_observer.h" #include "content/public/renderer/render_view_observer.h"
#include "ipc/ipc_listener.h" #include "ipc/ipc_listener.h"
#include "third_party/WebKit/public/platform/WebCredentialManagerClient.h" #include "third_party/WebKit/public/platform/WebCredentialManagerClient.h"
#include "third_party/WebKit/public/platform/WebVector.h" #include "third_party/WebKit/public/platform/WebVector.h"
...@@ -45,19 +45,12 @@ struct CredentialInfo; ...@@ -45,19 +45,12 @@ struct CredentialInfo;
// CredentialManagerClient (set in 'OnRenderViewCreated()'). The client is // CredentialManagerClient (set in 'OnRenderViewCreated()'). The client is
// guaranteed to outlive the views that point to it. // guaranteed to outlive the views that point to it.
class CredentialManagerClient : public blink::WebCredentialManagerClient, class CredentialManagerClient : public blink::WebCredentialManagerClient,
public content::RenderProcessObserver, public content::RenderViewObserver {
public IPC::Listener {
public: public:
CredentialManagerClient(); explicit CredentialManagerClient(content::RenderView* render_view);
virtual ~CredentialManagerClient(); virtual ~CredentialManagerClient();
// When a RenderView is created, we need to set this object as its client. // RenderViewObserver:
void OnRenderViewCreated(content::RenderView*);
// content::RenderProcessObserver:
virtual void OnRenderProcessShutdown() OVERRIDE;
// IPC::Listener:
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
// Message handlers for messages from the browser process: // Message handlers for messages from the browser process:
...@@ -80,9 +73,6 @@ class CredentialManagerClient : public blink::WebCredentialManagerClient, ...@@ -80,9 +73,6 @@ class CredentialManagerClient : public blink::WebCredentialManagerClient,
const blink::WebVector<blink::WebURL>& federations, const blink::WebVector<blink::WebURL>& federations,
RequestCallbacks* callbacks) OVERRIDE; RequestCallbacks* callbacks) OVERRIDE;
protected:
virtual int GetRoutingID();
private: private:
typedef IDMap<blink::WebCredentialManagerClient::RequestCallbacks, typedef IDMap<blink::WebCredentialManagerClient::RequestCallbacks,
IDMapOwnPointer> RequestCallbacksMap; IDMapOwnPointer> RequestCallbacksMap;
...@@ -92,13 +82,6 @@ class CredentialManagerClient : public blink::WebCredentialManagerClient, ...@@ -92,13 +82,6 @@ class CredentialManagerClient : public blink::WebCredentialManagerClient,
void RespondToNotificationCallback(int request_id, void RespondToNotificationCallback(int request_id,
NotificationCallbacksMap* map); NotificationCallbacksMap* map);
// Nulls out the raw pointer to |render_thread_| after ensuring that any
// message routing is removed.
void DisconnectFromRenderThread();
int routing_id_;
content::RenderThread* render_thread_;
// Track the various blink::WebCredentialManagerClient::*Callbacks objects // Track the various blink::WebCredentialManagerClient::*Callbacks objects
// generated from Blink. This class takes ownership of these objects. // generated from Blink. This class takes ownership of these objects.
NotificationCallbacksMap failed_sign_in_callbacks_; NotificationCallbacksMap failed_sign_in_callbacks_;
......
...@@ -4,9 +4,7 @@ ...@@ -4,9 +4,7 @@
#include "components/password_manager/content/common/credential_manager_messages.h" #include "components/password_manager/content/common/credential_manager_messages.h"
#include "components/password_manager/content/renderer/credential_manager_client.h" #include "components/password_manager/content/renderer/credential_manager_client.h"
#include "components/password_manager/content/renderer/test_credential_manager_client.h" #include "content/public/test/render_view_test.h"
#include "content/public/test/mock_render_thread.h"
#include "content/test/blink_test_environment.h"
#include "ipc/ipc_test_sink.h" #include "ipc/ipc_test_sink.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebCredential.h" #include "third_party/WebKit/public/platform/WebCredential.h"
...@@ -17,22 +15,24 @@ namespace password_manager { ...@@ -17,22 +15,24 @@ namespace password_manager {
namespace { namespace {
class CredentialManagerClientTest : public testing::Test { class CredentialManagerClientTest : public content::RenderViewTest {
public: public:
CredentialManagerClientTest() CredentialManagerClientTest()
: callback_errored_(false), : callback_errored_(false), callback_succeeded_(false) {}
callback_succeeded_(false) {
blink::WebString string = blink::WebString::fromUTF8("");
GURL url("https://example.com/image");
credential_.reset(new blink::WebCredential(string, string, url));
}
virtual ~CredentialManagerClientTest() {} virtual ~CredentialManagerClientTest() {}
static void SetUpTestCase() { content::SetUpBlinkTestEnvironment(); } virtual void SetUp() OVERRIDE {
content::RenderViewTest::SetUp();
credential_.reset(new blink::WebCredential("", "", GURL()));
client_.reset(new CredentialManagerClient(view_));
}
static void TearDownTestCase() { content::TearDownBlinkTestEnvironment(); } virtual void TearDown() OVERRIDE {
credential_.reset();
content::RenderViewTest::TearDown();
}
IPC::TestSink& sink() { return render_thread_.sink(); } IPC::TestSink& sink() { return render_thread_->sink(); }
blink::WebCredential* credential() { return credential_.get(); } blink::WebCredential* credential() { return credential_.get(); }
...@@ -91,8 +91,7 @@ class CredentialManagerClientTest : public testing::Test { ...@@ -91,8 +91,7 @@ class CredentialManagerClientTest : public testing::Test {
void set_callback_succeeded(bool state) { callback_succeeded_ = state; } void set_callback_succeeded(bool state) { callback_succeeded_ = state; }
protected: protected:
content::MockRenderThread render_thread_; scoped_ptr<CredentialManagerClient> client_;
TestCredentialManagerClient client_;
// True if a message's callback's 'onSuccess'/'onError' methods were called, // True if a message's callback's 'onSuccess'/'onError' methods were called,
// false otherwise. We put these on the test object rather than on the // false otherwise. We put these on the test object rather than on the
...@@ -109,8 +108,7 @@ class TestNotificationCallbacks ...@@ -109,8 +108,7 @@ class TestNotificationCallbacks
: public blink::WebCredentialManagerClient::NotificationCallbacks { : public blink::WebCredentialManagerClient::NotificationCallbacks {
public: public:
explicit TestNotificationCallbacks(CredentialManagerClientTest* test) explicit TestNotificationCallbacks(CredentialManagerClientTest* test)
: test_(test) { : test_(test) {}
}
virtual ~TestNotificationCallbacks() {} virtual ~TestNotificationCallbacks() {}
...@@ -128,8 +126,7 @@ class TestRequestCallbacks ...@@ -128,8 +126,7 @@ class TestRequestCallbacks
: public blink::WebCredentialManagerClient::RequestCallbacks { : public blink::WebCredentialManagerClient::RequestCallbacks {
public: public:
explicit TestRequestCallbacks(CredentialManagerClientTest* test) explicit TestRequestCallbacks(CredentialManagerClientTest* test)
: test_(test) { : test_(test) {}
}
virtual ~TestRequestCallbacks() {} virtual ~TestRequestCallbacks() {}
...@@ -154,12 +151,12 @@ TEST_F(CredentialManagerClientTest, SendNotifyFailedSignIn) { ...@@ -154,12 +151,12 @@ TEST_F(CredentialManagerClientTest, SendNotifyFailedSignIn) {
scoped_ptr<TestNotificationCallbacks> callbacks( scoped_ptr<TestNotificationCallbacks> callbacks(
new TestNotificationCallbacks(this)); new TestNotificationCallbacks(this));
client_.dispatchFailedSignIn(*credential(), callbacks.release()); client_->dispatchFailedSignIn(*credential(), callbacks.release());
EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifyFailedSignIn::ID, EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifyFailedSignIn::ID,
request_id)); request_id));
client_.OnAcknowledgeFailedSignIn(request_id); client_->OnAcknowledgeFailedSignIn(request_id);
EXPECT_TRUE(callback_succeeded()); EXPECT_TRUE(callback_succeeded());
EXPECT_FALSE(callback_errored()); EXPECT_FALSE(callback_errored());
} }
...@@ -171,12 +168,12 @@ TEST_F(CredentialManagerClientTest, SendNotifySignedIn) { ...@@ -171,12 +168,12 @@ TEST_F(CredentialManagerClientTest, SendNotifySignedIn) {
scoped_ptr<TestNotificationCallbacks> callbacks( scoped_ptr<TestNotificationCallbacks> callbacks(
new TestNotificationCallbacks(this)); new TestNotificationCallbacks(this));
client_.dispatchSignedIn(*credential(), callbacks.release()); client_->dispatchSignedIn(*credential(), callbacks.release());
EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedIn::ID, EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedIn::ID,
request_id)); request_id));
client_.OnAcknowledgeSignedIn(request_id); client_->OnAcknowledgeSignedIn(request_id);
EXPECT_TRUE(callback_succeeded()); EXPECT_TRUE(callback_succeeded());
EXPECT_FALSE(callback_errored()); EXPECT_FALSE(callback_errored());
} }
...@@ -188,12 +185,12 @@ TEST_F(CredentialManagerClientTest, SendNotifySignedOut) { ...@@ -188,12 +185,12 @@ TEST_F(CredentialManagerClientTest, SendNotifySignedOut) {
scoped_ptr<TestNotificationCallbacks> callbacks( scoped_ptr<TestNotificationCallbacks> callbacks(
new TestNotificationCallbacks(this)); new TestNotificationCallbacks(this));
client_.dispatchSignedOut(callbacks.release()); client_->dispatchSignedOut(callbacks.release());
EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedOut::ID, EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedOut::ID,
request_id)); request_id));
client_.OnAcknowledgeSignedOut(request_id); client_->OnAcknowledgeSignedOut(request_id);
EXPECT_TRUE(callback_succeeded()); EXPECT_TRUE(callback_succeeded());
EXPECT_FALSE(callback_errored()); EXPECT_FALSE(callback_errored());
} }
...@@ -205,13 +202,13 @@ TEST_F(CredentialManagerClientTest, SendRequestCredential) { ...@@ -205,13 +202,13 @@ TEST_F(CredentialManagerClientTest, SendRequestCredential) {
scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this)); scoped_ptr<TestRequestCallbacks> callbacks(new TestRequestCallbacks(this));
std::vector<GURL> federations; std::vector<GURL> federations;
client_.dispatchRequest(false, federations, callbacks.release()); client_->dispatchRequest(false, federations, callbacks.release());
EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID, EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_RequestCredential::ID,
request_id)); request_id));
CredentialInfo info; CredentialInfo info;
client_.OnSendCredential(request_id, info); client_->OnSendCredential(request_id, info);
EXPECT_TRUE(callback_succeeded()); EXPECT_TRUE(callback_succeeded());
EXPECT_FALSE(callback_errored()); EXPECT_FALSE(callback_errored());
} }
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/password_manager/content/renderer/test_credential_manager_client.h"
namespace password_manager {
TestCredentialManagerClient::TestCredentialManagerClient() {
}
TestCredentialManagerClient::~TestCredentialManagerClient() {
}
int TestCredentialManagerClient::GetRoutingID() {
// Chosen by fair dice roll.
return 4;
}
} // namespace password_manager
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_PASSWORD_MANAGER_CONTENT_RENDERER_TEST_CREDENTIAL_MANAGER_CLIENT_H_
#define COMPONENTS_PASSWORD_MANAGER_CONTENT_RENDERER_TEST_CREDENTIAL_MANAGER_CLIENT_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "components/password_manager/content/renderer/credential_manager_client.h"
namespace password_manager {
class TestCredentialManagerClient : public CredentialManagerClient {
public:
TestCredentialManagerClient();
virtual ~TestCredentialManagerClient();
virtual int GetRoutingID() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(TestCredentialManagerClient);
};
} // namespace password_manager
#endif // COMPONENTS_PASSWORD_MANAGER_CONTENT_RENDERER_TEST_CREDENTIAL_MANAGER_CLIENT_H_
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