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

Side by Side Diff: net/cert/nss_cert_database_chromeos_unittest.cc

Issue 1124153005: Adding ThreadTaskRunnerHandle in lieu of MessageLoopProxy in net/cert and net/cookies module (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
« no previous file with comments | « no previous file | net/cert/nss_cert_database_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/cert/nss_cert_database_chromeos.h" 5 #include "net/cert/nss_cert_database_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop/message_loop_proxy.h"
10 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/thread_task_runner_handle.h"
11 #include "crypto/nss_util_internal.h" 11 #include "crypto/nss_util_internal.h"
12 #include "crypto/scoped_test_nss_chromeos_user.h" 12 #include "crypto/scoped_test_nss_chromeos_user.h"
13 #include "crypto/scoped_test_nss_db.h" 13 #include "crypto/scoped_test_nss_db.h"
14 #include "net/base/test_data_directory.h" 14 #include "net/base/test_data_directory.h"
15 #include "net/cert/cert_database.h" 15 #include "net/cert/cert_database.h"
16 #include "net/test/cert_test_util.h" 16 #include "net/test/cert_test_util.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 namespace net { 19 namespace net {
20 20
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 ASSERT_TRUE(user_2_.constructed_successfully()); 54 ASSERT_TRUE(user_2_.constructed_successfully());
55 user_1_.FinishInit(); 55 user_1_.FinishInit();
56 user_2_.FinishInit(); 56 user_2_.FinishInit();
57 57
58 // Create NSSCertDatabaseChromeOS for each user. 58 // Create NSSCertDatabaseChromeOS for each user.
59 db_1_.reset(new NSSCertDatabaseChromeOS( 59 db_1_.reset(new NSSCertDatabaseChromeOS(
60 crypto::GetPublicSlotForChromeOSUser(user_1_.username_hash()), 60 crypto::GetPublicSlotForChromeOSUser(user_1_.username_hash()),
61 crypto::GetPrivateSlotForChromeOSUser( 61 crypto::GetPrivateSlotForChromeOSUser(
62 user_1_.username_hash(), 62 user_1_.username_hash(),
63 base::Callback<void(crypto::ScopedPK11Slot)>()))); 63 base::Callback<void(crypto::ScopedPK11Slot)>())));
64 db_1_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); 64 db_1_->SetSlowTaskRunnerForTest(base::ThreadTaskRunnerHandle::Get());
65 db_1_->SetSystemSlot( 65 db_1_->SetSystemSlot(
66 crypto::ScopedPK11Slot(PK11_ReferenceSlot(system_db_.slot()))); 66 crypto::ScopedPK11Slot(PK11_ReferenceSlot(system_db_.slot())));
67 db_2_.reset(new NSSCertDatabaseChromeOS( 67 db_2_.reset(new NSSCertDatabaseChromeOS(
68 crypto::GetPublicSlotForChromeOSUser(user_2_.username_hash()), 68 crypto::GetPublicSlotForChromeOSUser(user_2_.username_hash()),
69 crypto::GetPrivateSlotForChromeOSUser( 69 crypto::GetPrivateSlotForChromeOSUser(
70 user_2_.username_hash(), 70 user_2_.username_hash(),
71 base::Callback<void(crypto::ScopedPK11Slot)>()))); 71 base::Callback<void(crypto::ScopedPK11Slot)>())));
72 db_2_->SetSlowTaskRunnerForTest(base::MessageLoopProxy::current()); 72 db_2_->SetSlowTaskRunnerForTest(base::ThreadTaskRunnerHandle::Get());
73 73
74 // Add observer to CertDatabase for checking that notifications from 74 // Add observer to CertDatabase for checking that notifications from
75 // NSSCertDatabaseChromeOS are proxied to the CertDatabase. 75 // NSSCertDatabaseChromeOS are proxied to the CertDatabase.
76 CertDatabase::GetInstance()->AddObserver(this); 76 CertDatabase::GetInstance()->AddObserver(this);
77 observer_added_ = true; 77 observer_added_ = true;
78 } 78 }
79 79
80 void TearDown() override { 80 void TearDown() override {
81 if (observer_added_) 81 if (observer_added_)
82 CertDatabase::GetInstance()->RemoveObserver(this); 82 CertDatabase::GetInstance()->RemoveObserver(this);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 "client_2.pem", 314 "client_2.pem",
315 "client_2.pk8", 315 "client_2.pk8",
316 system_db_.slot())); 316 system_db_.slot()));
317 CertificateList certs; 317 CertificateList certs;
318 db_2_->ListCertsSync(&certs); 318 db_2_->ListCertsSync(&certs);
319 EXPECT_TRUE(IsCertInCertificateList(cert_1.get(), certs)); 319 EXPECT_TRUE(IsCertInCertificateList(cert_1.get(), certs));
320 EXPECT_FALSE(IsCertInCertificateList(cert_2.get(), certs)); 320 EXPECT_FALSE(IsCertInCertificateList(cert_2.get(), certs));
321 } 321 }
322 322
323 } // namespace net 323 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/cert/nss_cert_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698