| 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/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" | 9 #include "chrome/browser/ui/webui/options/options_ui_browsertest.h" |
| 10 #include "components/policy/core/browser/browser_policy_connector.h" | 10 #include "components/policy/core/browser/browser_policy_connector.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 42 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 43 .WillRepeatedly(Return(true)); | 43 .WillRepeatedly(Return(true)); |
| 44 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 44 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 45 } | 45 } |
| 46 | 46 |
| 47 #if defined(OS_CHROMEOS) | 47 #if defined(OS_CHROMEOS) |
| 48 void LoadONCPolicy(const std::string& filename) { | 48 void LoadONCPolicy(const std::string& filename) { |
| 49 const std::string& user_policy_blob = | 49 const std::string& user_policy_blob = |
| 50 chromeos::onc::test_utils::ReadTestData(filename); | 50 chromeos::onc::test_utils::ReadTestData(filename); |
| 51 policy::PolicyMap policy; | 51 policy::PolicyMap policy; |
| 52 policy.Set( | 52 policy.Set(policy::key::kOpenNetworkConfiguration, |
| 53 policy::key::kOpenNetworkConfiguration, policy::POLICY_LEVEL_MANDATORY, | 53 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, |
| 54 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, | 54 policy::POLICY_SOURCE_CLOUD, |
| 55 base::WrapUnique(new base::StringValue(user_policy_blob)), nullptr); | 55 base::MakeUnique<base::StringValue>(user_policy_blob), nullptr); |
| 56 provider_.UpdateChromePolicy(policy); | 56 provider_.UpdateChromePolicy(policy); |
| 57 content::RunAllPendingInMessageLoop(); | 57 content::RunAllPendingInMessageLoop(); |
| 58 } | 58 } |
| 59 #endif | 59 #endif |
| 60 | 60 |
| 61 void ClickElement(const std::string& selector) { | 61 void ClickElement(const std::string& selector) { |
| 62 EXPECT_TRUE(content::ExecuteScript( | 62 EXPECT_TRUE(content::ExecuteScript( |
| 63 GetSettingsFrame(), | 63 GetSettingsFrame(), |
| 64 "document.querySelector(\"" + selector + "\").click()")); | 64 "document.querySelector(\"" + selector + "\").click()")); |
| 65 } | 65 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // managed setting indicator (only on Chrome OS). | 98 // managed setting indicator (only on Chrome OS). |
| 99 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, | 99 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, |
| 100 PolicyCertificateWithWebTrustHasIndicator) { | 100 PolicyCertificateWithWebTrustHasIndicator) { |
| 101 LoadONCPolicy("certificate-web-authority.onc"); | 101 LoadONCPolicy("certificate-web-authority.onc"); |
| 102 NavigateToSettings(); | 102 NavigateToSettings(); |
| 103 ClickElement("#certificatesManageButton"); | 103 ClickElement("#certificatesManageButton"); |
| 104 ClickElement("#ca-certs-nav-tab"); | 104 ClickElement("#ca-certs-nav-tab"); |
| 105 EXPECT_TRUE(HasElement(".cert-policy")); | 105 EXPECT_TRUE(HasElement(".cert-policy")); |
| 106 } | 106 } |
| 107 #endif | 107 #endif |
| OLD | NEW |