| 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..e86b312113261612fd8b4c337bf7663da7555344 100644
|
| --- a/chrome/browser/ui/webui/options/certificate_manager_browsertest.cc
|
| +++ b/chrome/browser/ui/webui/options/certificate_manager_browsertest.cc
|
| @@ -2,13 +2,9 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "base/callback.h"
|
| #include "base/values.h"
|
| -#include "chrome/browser/browser_process.h"
|
| -#include "chrome/browser/ui/browser.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| #include "chrome/browser/ui/webui/options/options_ui_browsertest.h"
|
| -#include "chrome/common/url_constants.h"
|
| #include "components/policy/core/browser/browser_policy_connector.h"
|
| #include "components/policy/core/common/external_data_fetcher.h"
|
| #include "components/policy/core/common/mock_configuration_policy_provider.h"
|
| @@ -24,12 +20,7 @@
|
|
|
| #if defined(OS_CHROMEOS)
|
| #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
|
| -#include "chrome/browser/chromeos/policy/user_network_configuration_updater.h"
|
| -#include "chrome/browser/chromeos/policy/user_network_configuration_updater_factory.h"
|
| -#include "chrome/browser/net/nss_context.h"
|
| -#include "chromeos/network/onc/onc_certificate_importer_impl.h"
|
| #include "chromeos/network/onc/onc_test_utils.h"
|
| -#include "crypto/nss_util.h"
|
| #endif
|
|
|
| using testing::Return;
|
| @@ -41,22 +32,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 +42,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 +76,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
|
| };
|
|
|
|
|