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

Side by Side Diff: chrome/browser/password_manager/password_store_mac_unittest.cc

Issue 1125653002: [chrome/browser/password_manager] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/password_manager/password_store_mac.h" 5 #include "chrome/browser/password_manager/password_store_mac.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/scoped_observer.h" 9 #include "base/scoped_observer.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
14 #include "base/thread_task_runner_handle.h"
14 #include "chrome/browser/password_manager/password_store_mac_internal.h" 15 #include "chrome/browser/password_manager/password_store_mac_internal.h"
15 #include "chrome/common/chrome_paths.h" 16 #include "chrome/common/chrome_paths.h"
16 #include "components/password_manager/core/browser/login_database.h" 17 #include "components/password_manager/core/browser/login_database.h"
17 #include "components/password_manager/core/browser/password_manager_test_utils.h " 18 #include "components/password_manager/core/browser/password_manager_test_utils.h "
18 #include "components/password_manager/core/browser/password_store_consumer.h" 19 #include "components/password_manager/core/browser/password_store_consumer.h"
19 #include "content/public/test/test_browser_thread.h" 20 #include "content/public/test/test_browser_thread.h"
20 #include "crypto/mock_apple_keychain.h" 21 #include "crypto/mock_apple_keychain.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 24
(...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1146 // Make sure deferred initialization is performed before some tests start 1147 // Make sure deferred initialization is performed before some tests start
1147 // accessing the |login_db| directly. 1148 // accessing the |login_db| directly.
1148 FinishAsyncProcessing(); 1149 FinishAsyncProcessing();
1149 } 1150 }
1150 1151
1151 void TearDown() override { ClosePasswordStore(); } 1152 void TearDown() override { ClosePasswordStore(); }
1152 1153
1153 void CreateAndInitPasswordStore( 1154 void CreateAndInitPasswordStore(
1154 scoped_ptr<password_manager::LoginDatabase> login_db) { 1155 scoped_ptr<password_manager::LoginDatabase> login_db) {
1155 store_ = new TestPasswordStoreMac( 1156 store_ = new TestPasswordStoreMac(
1156 base::MessageLoopProxy::current(), base::MessageLoopProxy::current(), 1157 base::ThreadTaskRunnerHandle::Get(),
1158 base::ThreadTaskRunnerHandle::Get(),
1157 make_scoped_ptr<AppleKeychain>(new MockAppleKeychain), login_db.Pass()); 1159 make_scoped_ptr<AppleKeychain>(new MockAppleKeychain), login_db.Pass());
1158 ASSERT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare())); 1160 ASSERT_TRUE(store_->Init(syncer::SyncableService::StartSyncFlare()));
1159 } 1161 }
1160 1162
1161 void ClosePasswordStore() { 1163 void ClosePasswordStore() {
1162 if (!store_) 1164 if (!store_)
1163 return; 1165 return;
1164 1166
1165 store_->Shutdown(); 1167 store_->Shutdown();
1166 EXPECT_FALSE(store_->GetBackgroundTaskRunner()); 1168 EXPECT_FALSE(store_->GetBackgroundTaskRunner());
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1715 query_form.password_value.clear(); 1717 query_form.password_value.clear();
1716 query_form.username_value.clear(); 1718 query_form.username_value.clear();
1717 EXPECT_CALL(mock_consumer, OnGetPasswordStoreResultsConstRef(SizeIs(1u))) 1719 EXPECT_CALL(mock_consumer, OnGetPasswordStoreResultsConstRef(SizeIs(1u)))
1718 .WillOnce( 1720 .WillOnce(
1719 DoAll(SaveACopyOfFirstForm(&returned_form), QuitUIMessageLoop())); 1721 DoAll(SaveACopyOfFirstForm(&returned_form), QuitUIMessageLoop()));
1720 store()->GetLogins(query_form, PasswordStore::ALLOW_PROMPT, &mock_consumer); 1722 store()->GetLogins(query_form, PasswordStore::ALLOW_PROMPT, &mock_consumer);
1721 base::MessageLoop::current()->Run(); 1723 base::MessageLoop::current()->Run();
1722 ::testing::Mock::VerifyAndClearExpectations(&mock_consumer); 1724 ::testing::Mock::VerifyAndClearExpectations(&mock_consumer);
1723 EXPECT_EQ(form, returned_form); 1725 EXPECT_EQ(form, returned_form);
1724 } 1726 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698