| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/policy/browser_policy_connector.h" | 8 #include "chrome/browser/policy/browser_policy_connector.h" |
| 9 #include "chrome/browser/policy/external_data_fetcher.h" | 9 #include "chrome/browser/policy/external_data_fetcher.h" |
| 10 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 10 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
| 11 #include "chrome/browser/policy/policy_map.h" | 11 #include "chrome/browser/policy/policy_map.h" |
| 12 #include "chrome/browser/policy/policy_types.h" | 12 #include "chrome/browser/policy/policy_types.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" | 15 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" |
| 16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| 18 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 19 #include "policy/policy_constants.h" | 19 #include "policy/policy_constants.h" |
| 20 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 22 |
| 23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
| 24 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" | 24 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" |
| 25 #include "chrome/browser/policy/profile_policy_connector.h" | 25 #include "chrome/browser/policy/profile_policy_connector.h" |
| 26 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 26 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 27 #include "chromeos/network/onc/onc_test_utils.h" | 27 #include "chromeos/network/onc/onc_test_utils.h" |
| 28 #include "crypto/nss_util.h" |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 using testing::AnyNumber; | 31 using testing::AnyNumber; |
| 31 using testing::Return; | 32 using testing::Return; |
| 32 using testing::_; | 33 using testing::_; |
| 33 | 34 |
| 34 class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest { | 35 class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest { |
| 35 public: | 36 public: |
| 36 CertificateManagerBrowserTest() {} | 37 CertificateManagerBrowserTest() {} |
| 37 virtual ~CertificateManagerBrowserTest() {} | 38 virtual ~CertificateManagerBrowserTest() {} |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractBool( | 87 EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractBool( |
| 87 browser()->tab_strip_model()->GetActiveWebContents(), | 88 browser()->tab_strip_model()->GetActiveWebContents(), |
| 88 "//div[@id='settings']/iframe", | 89 "//div[@id='settings']/iframe", |
| 89 "window.domAutomationController.send(" | 90 "window.domAutomationController.send(" |
| 90 " !!document.querySelector('" + selector + "'));", | 91 " !!document.querySelector('" + selector + "'));", |
| 91 &result)); | 92 &result)); |
| 92 return result; | 93 return result; |
| 93 } | 94 } |
| 94 | 95 |
| 95 policy::MockConfigurationPolicyProvider provider_; | 96 policy::MockConfigurationPolicyProvider provider_; |
| 97 #if defined(OS_CHROMEOS) |
| 98 crypto::ScopedTestNSSDB test_nssdb_; |
| 99 #endif |
| 96 }; | 100 }; |
| 97 | 101 |
| 98 #if defined(OS_CHROMEOS) | 102 #if defined(OS_CHROMEOS) |
| 99 // Ensure policy-installed certificates without web trust do not display | 103 // Ensure policy-installed certificates without web trust do not display |
| 100 // the managed setting indicator (only on Chrome OS). | 104 // the managed setting indicator (only on Chrome OS). |
| 101 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, | 105 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, |
| 102 PolicyCertificateWithoutWebTrustHasNoIndicator) { | 106 PolicyCertificateWithoutWebTrustHasNoIndicator) { |
| 103 LoadONCPolicy("certificate-authority.onc"); | 107 LoadONCPolicy("certificate-authority.onc"); |
| 104 NavigateToSettings(); | 108 NavigateToSettings(); |
| 105 ClickElement("#certificatesManageButton"); | 109 ClickElement("#certificatesManageButton"); |
| 106 ClickElement("#ca-certs-nav-tab"); | 110 ClickElement("#ca-certs-nav-tab"); |
| 107 EXPECT_FALSE(HasElement(".cert-policy")); | 111 EXPECT_FALSE(HasElement(".cert-policy")); |
| 108 } | 112 } |
| 109 #endif | 113 #endif |
| 110 | 114 |
| 111 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
| 112 // Ensure policy-installed certificates with web trust display the | 116 // Ensure policy-installed certificates with web trust display the |
| 113 // managed setting indicator (only on Chrome OS). | 117 // managed setting indicator (only on Chrome OS). |
| 114 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, | 118 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, |
| 115 PolicyCertificateWithWebTrustHasIndicator) { | 119 PolicyCertificateWithWebTrustHasIndicator) { |
| 116 LoadONCPolicy("certificate-web-authority.onc"); | 120 LoadONCPolicy("certificate-web-authority.onc"); |
| 117 NavigateToSettings(); | 121 NavigateToSettings(); |
| 118 ClickElement("#certificatesManageButton"); | 122 ClickElement("#certificatesManageButton"); |
| 119 ClickElement("#ca-certs-nav-tab"); | 123 ClickElement("#ca-certs-nav-tab"); |
| 120 EXPECT_TRUE(HasElement(".cert-policy")); | 124 EXPECT_TRUE(HasElement(".cert-policy")); |
| 121 } | 125 } |
| 122 #endif | 126 #endif |
| OLD | NEW |