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

Unified Diff: chrome/browser/ui/webui/options/certificate_manager_browsertest.cc

Issue 325313004: Cleanup tests using SetSkipCertificateImporterCreationForTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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/ui/webui/options/certificate_manager_browsertest.cc
diff --git a/chrome/browser/ui/webui/options/certificate_manager_browsertest.cc b/chrome/browser/ui/webui/options/certificate_manager_browsertest.cc
index 0969f20b0f2ebd1d0b3b040c0064e14f530d8925..dabbf730ecda1a8f42495598a308836063d8fd7f 100644
--- a/chrome/browser/ui/webui/options/certificate_manager_browsertest.cc
+++ b/chrome/browser/ui/webui/options/certificate_manager_browsertest.cc
@@ -41,22 +41,6 @@ class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest {
virtual ~CertificateManagerBrowserTest() {}
protected:
- virtual void SetUp() OVERRIDE {
-#if defined(OS_CHROMEOS)
- policy::UserNetworkConfigurationUpdater::
- SetSkipCertificateImporterCreationForTest(true);
-#endif
- options::OptionsUIBrowserTest::SetUp();
- }
-
- virtual void TearDown() OVERRIDE {
-#if defined(OS_CHROMEOS)
- policy::UserNetworkConfigurationUpdater::
- SetSkipCertificateImporterCreationForTest(false);
-#endif
- options::OptionsUIBrowserTest::TearDown();
- }
-
virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
#if defined(OS_CHROMEOS)
device_policy_test_helper_.MarkAsEnterpriseOwned();
@@ -67,69 +51,7 @@ class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest {
policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
}
- void SetUpOnIOThread() {
#if defined(OS_CHROMEOS)
- test_nssdb_.reset(new crypto::ScopedTestNSSDB());
-#endif
- }
-
- void TearDownOnIOThread() {
-#if defined(OS_CHROMEOS)
- test_nssdb_.reset();
-#endif
- }
-
- virtual void SetUpOnMainThread() OVERRIDE {
- content::BrowserThread::PostTask(
- content::BrowserThread::IO,
- FROM_HERE,
- base::Bind(&CertificateManagerBrowserTest::SetUpOnIOThread, this));
-
- content::RunAllPendingInMessageLoop(content::BrowserThread::IO);
- content::RunAllPendingInMessageLoop();
-
-#if defined(OS_CHROMEOS)
- // UserNetworkConfigurationUpdater's onc::CertificateImporter is usually
- // passed the NSSCertDatabase fetched during testing profile
- // constrution. Unfortunately, test database gets setup after that, so we
- // would end up with |PK11_GetInternalKeySlot|. The cause of this is in
- // |crypto::InitializeNSSForChromeOSUser|, which does not open new
- // database slot for primary user, but it just uses the singleton one (which
- // is not set in tests before |test_nssdb_| is created). To handle this,
- // creating certificate importer during the UserNetworkConfiguirationUpdater
- // service creation is set to be skipped (see |SetUp|), and cert importer
- // is set up here.
- // Note that creating |test_nssdb_| sooner (in SetUp) would break thread
- // restrictions, which require it to be used on IO thread only.
- // TODO(tbarzic): Update InitializeNSSForChromeOSUser not to special case
- // the primary user.
- GetNSSCertDatabaseForProfile(
- browser()->profile(),
- base::Bind(
- &CertificateManagerBrowserTest::UpdateNetworkConfigurationUpdater,
- base::Unretained(this)));
-
- content::RunAllPendingInMessageLoop(content::BrowserThread::IO);
- content::RunAllPendingInMessageLoop();
-#endif
- }
-
- virtual void CleanUpOnMainThread() OVERRIDE {
- content::BrowserThread::PostTask(
- content::BrowserThread::IO,
- FROM_HERE,
- base::Bind(&CertificateManagerBrowserTest::TearDownOnIOThread, this));
- content::RunAllPendingInMessageLoop(content::BrowserThread::IO);
- }
-
-#if defined(OS_CHROMEOS)
- void UpdateNetworkConfigurationUpdater(net::NSSCertDatabase* database) {
- policy::UserNetworkConfigurationUpdaterFactory::GetForProfile(
- browser()->profile())->SetCertificateImporterForTest(
- scoped_ptr<chromeos::onc::CertificateImporter>(
- new chromeos::onc::CertificateImporterImpl(database)));
- }
-
void LoadONCPolicy(const std::string& filename) {
const std::string& user_policy_blob =
chromeos::onc::test_utils::ReadTestData(filename);
@@ -163,7 +85,6 @@ class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest {
policy::MockConfigurationPolicyProvider provider_;
#if defined(OS_CHROMEOS)
policy::DevicePolicyCrosTestHelper device_policy_test_helper_;
- scoped_ptr<crypto::ScopedTestNSSDB> test_nssdb_;
#endif
};

Powered by Google App Engine
This is Rietveld 408576698