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

Unified Diff: chrome/browser/chromeos/cros/onc_network_parser_unittest.cc

Issue 11174006: Implement ScopedTestNSSDB instead of OpenTestNSSDB() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another test Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/cros/onc_network_parser_unittest.cc
diff --git a/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc b/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc
index 291f3794c7029151559c50f13ac51ad4a9e473fd..789bb8a2dc43c7ac7c641ee284d972f17c6aecbd 100644
--- a/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc
+++ b/chrome/browser/chromeos/cros/onc_network_parser_unittest.cc
@@ -54,19 +54,10 @@ net::CertType GetCertType(const net::X509Certificate* cert) {
class OncNetworkParserTest : public testing::Test {
public:
- static void SetUpTestCase() {
- // Ideally, we'd open a test DB for each test case, and close it
- // again, removing the temp dir, but unfortunately, there's a
- // bug in NSS that prevents this from working, so we just open
- // it once, and empty it for each test case. Here's the bug:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=588269
- ASSERT_TRUE(crypto::OpenTestNSSDB());
- // There is no matching TearDownTestCase call to close the test NSS DB
- // because that would leave NSS in a potentially broken state for further
- // tests, due to https://bugzilla.mozilla.org/show_bug.cgi?id=588269
- }
-
virtual void SetUp() {
+ test_nssdb_.reset(new crypto::ScopedTestNSSDB());
+ ASSERT_TRUE(test_nssdb_->is_open());
+
slot_ = net::NSSCertDatabase::GetInstance()->GetPublicModule();
// Don't run the test if the setup failed.
@@ -79,6 +70,7 @@ class OncNetworkParserTest : public testing::Test {
virtual void TearDown() {
EXPECT_TRUE(CleanupSlotContents(slot_->os_module_handle()));
EXPECT_EQ(0U, ListCertsInSlot(slot_->os_module_handle()).size());
+ test_nssdb_.reset();
}
virtual void GetTestData(const std::string& filename, std::string* contents) {
@@ -137,6 +129,7 @@ class OncNetworkParserTest : public testing::Test {
}
ScopedStubCrosEnabler stub_cros_enabler_;
+ scoped_ptr<crypto::ScopedTestNSSDB> test_nssdb_;
Ryan Sleevi 2012/10/16 18:19:02 Doesn't need to be a scoped_ptr here - GTest creat
Takashi Toyoshima 2012/10/17 04:58:53 Done.
};
const base::Value* OncNetworkParserTest::GetExpectedProperty(

Powered by Google App Engine
This is Rietveld 408576698