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

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

Issue 2010463002: Mocker for OSCrypt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/simple_password_store_mac.h" 5 #include "chrome/browser/password_manager/simple_password_store_mac.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "components/os_crypt/os_crypt.h" 10 #include "components/os_crypt/os_crypt_mocker.h"
11 #include "components/password_manager/core/browser/login_database.h" 11 #include "components/password_manager/core/browser/login_database.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 #include "content/public/test/test_browser_thread_bundle.h" 13 #include "content/public/test/test_browser_thread_bundle.h"
14 #include "content/public/test/test_utils.h" 14 #include "content/public/test/test_utils.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 using content::BrowserThread; 18 using content::BrowserThread;
19 using password_manager::PasswordStoreChange; 19 using password_manager::PasswordStoreChange;
20 using testing::ElementsAreArray; 20 using testing::ElementsAreArray;
(...skipping 10 matching lines...) Expand all
31 class SimplePasswordStoreMacTest : public testing::Test { 31 class SimplePasswordStoreMacTest : public testing::Test {
32 public: 32 public:
33 SimplePasswordStoreMacTest() 33 SimplePasswordStoreMacTest()
34 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD) {} 34 : thread_bundle_(content::TestBrowserThreadBundle::REAL_FILE_THREAD) {}
35 35
36 void SetUp() override { 36 void SetUp() override {
37 ASSERT_TRUE(db_dir_.CreateUniqueTempDir()); 37 ASSERT_TRUE(db_dir_.CreateUniqueTempDir());
38 38
39 // Ensure that LoginDatabase will use the mock keychain if it needs to 39 // Ensure that LoginDatabase will use the mock keychain if it needs to
40 // encrypt/decrypt a password. 40 // encrypt/decrypt a password.
41 OSCrypt::UseMockKeychain(true); 41 OSCryptMocker::SetUpWithSingleton();
vabr (Chromium) 2016/05/24 13:33:44 Should there also be the matching OSCryptMocker::T
cfroussios 2016/05/25 13:13:09 Done.
42 42
43 // Setup LoginDatabase. 43 // Setup LoginDatabase.
44 std::unique_ptr<password_manager::LoginDatabase> login_db( 44 std::unique_ptr<password_manager::LoginDatabase> login_db(
45 new password_manager::LoginDatabase(test_login_db_file_path())); 45 new password_manager::LoginDatabase(test_login_db_file_path()));
46 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner = 46 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner =
47 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE); 47 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE);
48 ASSERT_TRUE(file_task_runner); 48 ASSERT_TRUE(file_task_runner);
49 file_task_runner->PostTask( 49 file_task_runner->PostTask(
50 FROM_HERE, 50 FROM_HERE,
51 base::Bind(&InitOnBackgroundThread, base::Unretained(login_db.get()))); 51 base::Bind(&InitOnBackgroundThread, base::Unretained(login_db.get())));
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 PasswordStoreChange(PasswordStoreChange::ADD, form), 107 PasswordStoreChange(PasswordStoreChange::ADD, form),
108 }; 108 };
109 EXPECT_CALL(observer, 109 EXPECT_CALL(observer,
110 OnLoginsChanged(ElementsAreArray(expected_add_changes))); 110 OnLoginsChanged(ElementsAreArray(expected_add_changes)));
111 // Adding a login should trigger a notification. 111 // Adding a login should trigger a notification.
112 store()->AddLogin(form); 112 store()->AddLogin(form);
113 FinishAsyncProcessing(); 113 FinishAsyncProcessing();
114 } 114 }
115 115
116 } // namespace 116 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698