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

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: Fixed mac tests 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; 30 using testing::AnyNumber;
bartfab (slow) 2013/11/05 15:53:04 Nit: No longer used.
Joao da Silva 2013/11/07 13:15:00 Done.
31 using testing::Return; 31 using testing::Return;
32 using testing::_; 32 using testing::_;
33 33
34 class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest { 34 class CertificateManagerBrowserTest : public options::OptionsUIBrowserTest {
35 public: 35 public:
36 CertificateManagerBrowserTest() {} 36 CertificateManagerBrowserTest() {}
37 virtual ~CertificateManagerBrowserTest() {} 37 virtual ~CertificateManagerBrowserTest() {}
38 38
39 protected: 39 protected:
40 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 40 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
41 #if defined(OS_CHROMEOS) 41 #if defined(OS_CHROMEOS)
42 device_policy_test_helper_.MarkAsEnterpriseOwned(); 42 device_policy_test_helper_.MarkAsEnterpriseOwned();
43 #endif 43 #endif
44 // Setup the policy provider for injecting certs through ONC policy. 44 // Setup the policy provider for injecting certs through ONC policy.
45 EXPECT_CALL(provider_, IsInitializationComplete(_)) 45 EXPECT_CALL(provider_, IsInitializationComplete(_))
46 .WillRepeatedly(Return(true)); 46 .WillRepeatedly(Return(true));
47 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber());
48 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 47 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
49 } 48 }
50 49
51 virtual void SetUpOnMainThread() OVERRIDE { 50 virtual void SetUpOnMainThread() OVERRIDE {
52 content::RunAllPendingInMessageLoop(); 51 content::RunAllPendingInMessageLoop();
53 } 52 }
54 53
55 #if defined(OS_CHROMEOS) 54 #if defined(OS_CHROMEOS)
56 void LoadONCPolicy(const std::string& filename) { 55 void LoadONCPolicy(const std::string& filename) {
57 const std::string& user_policy_blob = 56 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). 109 // managed setting indicator (only on Chrome OS).
111 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest, 110 IN_PROC_BROWSER_TEST_F(CertificateManagerBrowserTest,
112 PolicyCertificateWithWebTrustHasIndicator) { 111 PolicyCertificateWithWebTrustHasIndicator) {
113 LoadONCPolicy("certificate-web-authority.onc"); 112 LoadONCPolicy("certificate-web-authority.onc");
114 NavigateToSettings(); 113 NavigateToSettings();
115 ClickElement("#certificatesManageButton"); 114 ClickElement("#certificatesManageButton");
116 ClickElement("#ca-certs-nav-tab"); 115 ClickElement("#ca-certs-nav-tab");
117 EXPECT_TRUE(HasElement(".cert-policy")); 116 EXPECT_TRUE(HasElement(".cert-policy"));
118 } 117 }
119 #endif 118 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698