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

Unified Diff: components/password_manager/content/renderer/credential_manager_client_unittest.cc

Issue 500543002: Fixing LSan: Moving credential creation to a scoped_ptr for correct removal. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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: components/password_manager/content/renderer/credential_manager_client_unittest.cc
diff --git a/components/password_manager/content/renderer/credential_manager_client_unittest.cc b/components/password_manager/content/renderer/credential_manager_client_unittest.cc
index 92f6a6ec80982daa493b6fca079b0557a174a361..31d5c7300f2097c8e684e7a6693467178ec39a78 100644
--- a/components/password_manager/content/renderer/credential_manager_client_unittest.cc
+++ b/components/password_manager/content/renderer/credential_manager_client_unittest.cc
@@ -21,7 +21,11 @@ class CredentialManagerClientTest : public testing::Test {
public:
CredentialManagerClientTest()
: 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() {}
static void SetUpTestCase() { content::SetUpBlinkTestEnvironment(); }
@@ -30,6 +34,8 @@ class CredentialManagerClientTest : public testing::Test {
IPC::TestSink& sink() { return render_thread_.sink(); }
+ blink::WebCredential* credential() { return credential_.get(); }
+
// The browser's response to any of the messages the client sends must contain
// a request ID so that the client knows which request is being serviced. This
// method grabs the ID from an outgoing |message_id| message, and sets the
@@ -95,6 +101,8 @@ class CredentialManagerClientTest : public testing::Test {
// pending Blink-side Promise.
bool callback_errored_;
bool callback_succeeded_;
+
+ scoped_ptr<blink::WebCredential> credential_;
};
class TestNotificationCallbacks
@@ -144,11 +152,9 @@ TEST_F(CredentialManagerClientTest, SendNotifyFailedSignIn) {
EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_NotifyFailedSignIn::ID,
request_id));
- blink::WebCredential credential(
- "id", "user", GURL("https://example.com/img.png"));
scoped_ptr<TestNotificationCallbacks> callbacks(
new TestNotificationCallbacks(this));
- client_.dispatchFailedSignIn(credential, callbacks.release());
+ client_.dispatchFailedSignIn(*credential(), callbacks.release());
EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifyFailedSignIn::ID,
request_id));
@@ -163,11 +169,9 @@ TEST_F(CredentialManagerClientTest, SendNotifySignedIn) {
EXPECT_FALSE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedIn::ID,
request_id));
- blink::WebCredential credential(
- "id", "user", GURL("https://example.com/img.png"));
scoped_ptr<TestNotificationCallbacks> callbacks(
new TestNotificationCallbacks(this));
- client_.dispatchSignedIn(credential, callbacks.release());
+ client_.dispatchSignedIn(*credential(), callbacks.release());
EXPECT_TRUE(ExtractRequestId(CredentialManagerHostMsg_NotifySignedIn::ID,
request_id));
« 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