| Index: net/cert/nss_cert_database_chromeos_test_utils.h
|
| diff --git a/net/cert/nss_cert_database_chromeos_test_utils.h b/net/cert/nss_cert_database_chromeos_test_utils.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6a7bffef4ddab47dda2532c7270533b6f79c4761
|
| --- /dev/null
|
| +++ b/net/cert/nss_cert_database_chromeos_test_utils.h
|
| @@ -0,0 +1,48 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef NET_CERT_NSS_CERT_DATABASE_CHROMEOS_TEST_UTILS_
|
| +#define NET_CERT_NSS_CERT_DATABASE_CHROMEOS_TEST_UTILS_
|
| +
|
| +#include <string>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "crypto/nss_util.h"
|
| +#include "net/base/net_export.h"
|
| +
|
| +namespace net {
|
| +
|
| +// A ScopedTestNSSCertDatabaseChromeOS will initialize nss_util for the given
|
| +// username_hash just like ScopedTestNSSChromeOSUser, but on destruction will
|
| +// also clean up any NSSCertDatabaseChromeOS for that user.
|
| +//
|
| +// Note that constructing a ScopedTestNSSCertDatabaseChromeOS does not
|
| +// actually create the NSSCertDatabaseChromeOS, you still need to call
|
| +// NSSCertDatabaseChromeOS::GetForUser to create it.
|
| +//
|
| +// Exposed for unittests only.
|
| +class CRYPTO_EXPORT_PRIVATE ScopedTestNSSCertDatabaseChromeOS {
|
| + public:
|
| + explicit ScopedTestNSSCertDatabaseChromeOS(const std::string& username_hash);
|
| + ~ScopedTestNSSCertDatabaseChromeOS();
|
| +
|
| + std::string username_hash() const { return scoped_nss_user_.username_hash(); }
|
| + bool constructed_successfully() const {
|
| + return scoped_nss_user_.constructed_successfully();
|
| + }
|
| +
|
| + // Completes initialization of user in nss_util. Causes any waiting nss_util
|
| + // private slot callbacks and NSSCertDatabaseChromeOS::GetForUser callbacks to
|
| + // run.
|
| + void FinishInit();
|
| +
|
| + private:
|
| + crypto::ScopedTestNSSChromeOSUser scoped_nss_user_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ScopedTestNSSCertDatabaseChromeOS);
|
| +};
|
| +
|
| +} // namespace net
|
| +
|
| +#endif // NET_CERT_NSS_CERT_DATABASE_CHROMEOS_TEST_UTILS_
|
|
|