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

Side by Side Diff: chrome/browser/ui/webui/policy_ui_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
« no previous file with comments | « chrome/browser/ui/webui/policy_ui.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <vector> 5 #include <vector>
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
11 #include "chrome/browser/policy/browser_policy_connector.h" 11 #include "chrome/browser/policy/browser_policy_connector.h"
12 #include "chrome/browser/policy/external_data_fetcher.h" 12 #include "chrome/browser/policy/external_data_fetcher.h"
13 #include "chrome/browser/policy/mock_configuration_policy_provider.h" 13 #include "chrome/browser/policy/mock_configuration_policy_provider.h"
14 #include "chrome/browser/policy/policy_map.h" 14 #include "chrome/browser/policy/policy_map.h"
15 #include "chrome/browser/policy/policy_types.h" 15 #include "chrome/browser/policy/policy_types.h"
16 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/test/base/in_process_browser_test.h" 18 #include "chrome/test/base/in_process_browser_test.h"
19 #include "chrome/test/base/ui_test_utils.h" 19 #include "chrome/test/base/ui_test_utils.h"
20 #include "content/public/browser/web_contents.h" 20 #include "content/public/browser/web_contents.h"
21 #include "content/public/test/browser_test_utils.h" 21 #include "content/public/test/browser_test_utils.h"
22 #include "grit/generated_resources.h" 22 #include "grit/generated_resources.h"
23 #include "policy/policy_constants.h" 23 #include "policy/policy_constants.h"
24 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 25 #include "testing/gtest/include/gtest/gtest.h"
26 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
27 #include "url/gurl.h" 27 #include "url/gurl.h"
28 28
29 using testing::AnyNumber;
30 using testing::Return; 29 using testing::Return;
31 using testing::_; 30 using testing::_;
32 31
33 namespace { 32 namespace {
34 33
35 std::vector<std::string> PopulateExpectedPolicy( 34 std::vector<std::string> PopulateExpectedPolicy(
36 const std::string& name, 35 const std::string& name,
37 const std::string& value, 36 const std::string& value,
38 const policy::PolicyMap::Entry* metadata, 37 const policy::PolicyMap::Entry* metadata,
39 bool unknown) { 38 bool unknown) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 99
101 PolicyUITest::PolicyUITest() { 100 PolicyUITest::PolicyUITest() {
102 } 101 }
103 102
104 PolicyUITest::~PolicyUITest() { 103 PolicyUITest::~PolicyUITest() {
105 } 104 }
106 105
107 void PolicyUITest::SetUpInProcessBrowserTestFixture() { 106 void PolicyUITest::SetUpInProcessBrowserTestFixture() {
108 EXPECT_CALL(provider_, IsInitializationComplete(_)) 107 EXPECT_CALL(provider_, IsInitializationComplete(_))
109 .WillRepeatedly(Return(true)); 108 .WillRepeatedly(Return(true));
110 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber());
111 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 109 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
112 } 110 }
113 111
114 void PolicyUITest::UpdateProviderPolicy(const policy::PolicyMap& policy) { 112 void PolicyUITest::UpdateProviderPolicy(const policy::PolicyMap& policy) {
115 provider_.UpdateChromePolicy(policy); 113 provider_.UpdateChromePolicy(policy);
116 base::RunLoop loop; 114 base::RunLoop loop;
117 loop.RunUntilIdle(); 115 loop.RunUntilIdle();
118 } 116 }
119 117
120 void PolicyUITest::VerifyPolicies( 118 void PolicyUITest::VerifyPolicies(
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 expected_policies.begin() + first_unset_position++, 257 expected_policies.begin() + first_unset_position++,
260 PopulateExpectedPolicy(kUnknownPolicy, 258 PopulateExpectedPolicy(kUnknownPolicy,
261 expected_values[kUnknownPolicy], 259 expected_values[kUnknownPolicy],
262 values.Get(kUnknownPolicy), 260 values.Get(kUnknownPolicy),
263 true)); 261 true));
264 262
265 // Retrieve the contents of the policy table from the UI and verify that it 263 // Retrieve the contents of the policy table from the UI and verify that it
266 // matches the expectation. 264 // matches the expectation.
267 VerifyPolicies(expected_policies); 265 VerifyPolicies(expected_policies);
268 } 266 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/policy_ui.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698