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