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

Side by Side Diff: components/password_manager/content/browser/credential_manager_impl_unittest.cc

Issue 2867743002: Use OnceCallback on Mojo interfaces in //components/password_manager (Closed)
Patch Set: . Created 3 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/password_manager/content/browser/credential_manager_impl.h" 5 #include "components/password_manager/content/browser/credential_manager_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <string> 9 #include <string>
10 #include <tuple> 10 #include <tuple>
11 #include <utility>
11 #include <vector> 12 #include <vector>
12 13
13 #include "base/bind.h" 14 #include "base/bind.h"
14 #include "base/command_line.h" 15 #include "base/command_line.h"
15 #include "base/location.h" 16 #include "base/location.h"
16 #include "base/macros.h" 17 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
18 #include "base/run_loop.h" 19 #include "base/run_loop.h"
19 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
20 #include "base/strings/string16.h" 21 #include "base/strings/string16.h"
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 344
344 EXPECT_TRUE(called); 345 EXPECT_TRUE(called);
345 EXPECT_EQ(mojom::CredentialManagerError::SUCCESS, error); 346 EXPECT_EQ(mojom::CredentialManagerError::SUCCESS, error);
346 EXPECT_EQ(type, credential->type); 347 EXPECT_EQ(type, credential->type);
347 } 348 }
348 349
349 CredentialManagerImpl* cm_service_impl() { return cm_service_impl_.get(); } 350 CredentialManagerImpl* cm_service_impl() { return cm_service_impl_.get(); }
350 351
351 // Helpers for testing CredentialManagerImpl methods. 352 // Helpers for testing CredentialManagerImpl methods.
352 void CallStore(const CredentialInfo& info, 353 void CallStore(const CredentialInfo& info,
353 const CredentialManagerImpl::StoreCallback& callback) { 354 CredentialManagerImpl::StoreCallback callback) {
354 cm_service_impl_->Store(info, callback); 355 cm_service_impl_->Store(info, std::move(callback));
355 } 356 }
356 357
357 void CallRequireUserMediation( 358 void CallRequireUserMediation(
358 const CredentialManagerImpl::RequireUserMediationCallback& callback) { 359 CredentialManagerImpl::RequireUserMediationCallback callback) {
359 cm_service_impl_->RequireUserMediation(callback); 360 cm_service_impl_->RequireUserMediation(std::move(callback));
360 } 361 }
361 362
362 void CallGet(bool zero_click_only, 363 void CallGet(bool zero_click_only,
363 bool include_passwords, 364 bool include_passwords,
364 const std::vector<GURL>& federations, 365 const std::vector<GURL>& federations,
365 const CredentialManagerImpl::GetCallback& callback) { 366 CredentialManagerImpl::GetCallback callback) {
366 cm_service_impl_->Get(zero_click_only, include_passwords, federations, 367 cm_service_impl_->Get(zero_click_only, include_passwords, federations,
367 callback); 368 std::move(callback));
368 } 369 }
369 370
370 protected: 371 protected:
371 autofill::PasswordForm form_; 372 autofill::PasswordForm form_;
372 autofill::PasswordForm affiliated_form1_; 373 autofill::PasswordForm affiliated_form1_;
373 autofill::PasswordForm affiliated_form2_; 374 autofill::PasswordForm affiliated_form2_;
374 autofill::PasswordForm origin_path_form_; 375 autofill::PasswordForm origin_path_form_;
375 autofill::PasswordForm subdomain_form_; 376 autofill::PasswordForm subdomain_form_;
376 autofill::PasswordForm cross_origin_form_; 377 autofill::PasswordForm cross_origin_form_;
377 scoped_refptr<TestPasswordStore> store_; 378 scoped_refptr<TestPasswordStore> store_;
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(_)); 1574 EXPECT_CALL(*client_, PromptUserToSavePasswordPtr(_));
1574 CallStore(info, base::Bind(&RespondCallback, &called)); 1575 CallStore(info, base::Bind(&RespondCallback, &called));
1575 // Allow the PasswordFormManager to talk to the password store 1576 // Allow the PasswordFormManager to talk to the password store
1576 RunAllPendingTasks(); 1577 RunAllPendingTasks();
1577 1578
1578 ASSERT_TRUE(client_->pending_manager()); 1579 ASSERT_TRUE(client_->pending_manager());
1579 EXPECT_TRUE(client_->pending_manager()->IsBlacklisted()); 1580 EXPECT_TRUE(client_->pending_manager()->IsBlacklisted());
1580 } 1581 }
1581 1582
1582 } // namespace password_manager 1583 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698