Chromium Code Reviews| Index: chrome/browser/chromeos/cros/network_library_unittest.cc |
| diff --git a/chrome/browser/chromeos/cros/network_library_unittest.cc b/chrome/browser/chromeos/cros/network_library_unittest.cc |
| index 751e22cb3ea820efc8f7ae5a146d31b273d9f918..c2dd3d5f4e8f2fa304f7fa511344ec0f1c6cd4ac 100644 |
| --- a/chrome/browser/chromeos/cros/network_library_unittest.cc |
| +++ b/chrome/browser/chromeos/cros/network_library_unittest.cc |
| @@ -138,20 +138,11 @@ class NetworkLibraryStubTest : public testing::Test { |
| public: |
| NetworkLibraryStubTest() : cros_(NULL) {} |
| - 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 |
| - } |
| - |
| protected: |
| virtual void SetUp() { |
| + test_nssdb_.reset(new crypto::ScopedTestNSSDB()); |
| + ASSERT_TRUE(test_nssdb_->is_open()); |
| + |
| slot_ = net::NSSCertDatabase::GetInstance()->GetPublicModule(); |
| cros_ = CrosLibrary::Get()->GetNetworkLibrary(); |
| ASSERT_TRUE(cros_) << "GetNetworkLibrary() Failed!"; |
| @@ -163,6 +154,7 @@ class NetworkLibraryStubTest : public testing::Test { |
| cros_ = NULL; |
| 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) { |
| @@ -207,6 +199,7 @@ class NetworkLibraryStubTest : public testing::Test { |
| } |
| scoped_refptr<net::CryptoModule> slot_; |
| + scoped_ptr<crypto::ScopedTestNSSDB> test_nssdb_; |
|
Takashi Toyoshima
2012/10/17 04:58:53
I think I should not use scoped_ptr here too.
|
| }; |
| // Default stub state: |