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

Side by Side Diff: chrome/browser/ui/webui/options/certificate_manager_browsertest.cc

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: rebase Created 7 years, 1 month 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 unified diff | Download patch
OLDNEW
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/device_policy_cros_browser_test.h" 24 #include "chrome/browser/chromeos/policy/device_policy_cros_browser_test.h"
25 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" 25 #include "chrome/browser/chromeos/policy/network_configuration_updater.h"
26 #include "chromeos/network/onc/onc_test_utils.h" 26 #include "chromeos/network/onc/onc_test_utils.h"
27 #include "crypto/nss_util.h" 27 #include "crypto/nss_util.h"
28 #endif 28 #endif
29 29
30 using testing::AnyNumber;
31 using testing::Return; 30 using testing::Return;
32 using testing::_; 31 using testing::_;
33 32
34 class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest { 33 class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest {
35 public: 34 public:
36 CertificateManagerBrowserTest() {} 35 CertificateManagerBrowserTest() {}
37 virtual ~CertificateManagerBrowserTest() {} 36 virtual ~CertificateManagerBrowserTest() {}
38 37
39 protected: 38 protected:
40 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 39 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
41 #if defined(OS_CHROMEOS) 40 #if defined(OS_CHROMEOS)
42 device_policy_test_helper_.MarkAsEnterpriseOwned(); 41 device_policy_test_helper_.MarkAsEnterpriseOwned();
43 #endif 42 #endif
44 // Setup the policy provider for injecting certs through ONC policy. 43 // Setup the policy provider for injecting certs through ONC policy.
45 EXPECT_CALL(provider_, IsInitializationComplete(_)) 44 EXPECT_CALL(provider_, IsInitializationComplete(_))
46 .WillRepeatedly(Return(true)); 45 .WillRepeatedly(Return(true));
47 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber());
48 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 46 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
49 } 47 }
50 48
51 virtual void SetUpOnMainThread() OVERRIDE { 49 virtual void SetUpOnMainThread() OVERRIDE {
52 content::RunAllPendingInMessageLoop(); 50 content::RunAllPendingInMessageLoop();
53 } 51 }
54 52
55 #if defined(OS_CHROMEOS) 53 #if defined(OS_CHROMEOS)
56 void LoadONCPolicy(const std::string& filename) { 54 void LoadONCPolicy(const std::string& filename) {
57 const std::string& user_policy_blob = 55 const std::string& user_policy_blob =
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // managed setting indicator (only on Chrome OS). 108 // managed setting indicator (only on Chrome OS).
111 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, 109 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest,
112 PolicyCertificateWithWebTrustHasIndicator) { 110 PolicyCertificateWithWebTrustHasIndicator) {
113 LoadONCPolicy("certificate-web-authority.onc"); 111 LoadONCPolicy("certificate-web-authority.onc");
114 NavigateToSettings(); 112 NavigateToSettings();
115 ClickElement("#certificatesManageButton"); 113 ClickElement("#certificatesManageButton");
116 ClickElement("#ca-certs-nav-tab"); 114 ClickElement("#ca-certs-nav-tab");
117 EXPECT_TRUE(HasElement(".cert-policy")); 115 EXPECT_TRUE(HasElement(".cert-policy"));
118 } 116 }
119 #endif 117 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698