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

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: 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 (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; 29 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.
30 using testing::Return; 30 using testing::Return;
31 using testing::_; 31 using testing::_;
32 32
33 namespace { 33 namespace {
34 34
35 std::vector<std::string> PopulateExpectedPolicy( 35 std::vector<std::string> PopulateExpectedPolicy(
36 const std::string& name, 36 const std::string& name,
37 const std::string& value, 37 const std::string& value,
38 const policy::PolicyMap::Entry* metadata, 38 const policy::PolicyMap::Entry* metadata,
39 bool unknown) { 39 bool unknown) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 PolicyUITest::PolicyUITest() { 101 PolicyUITest::PolicyUITest() {
102 } 102 }
103 103
104 PolicyUITest::~PolicyUITest() { 104 PolicyUITest::~PolicyUITest() {
105 } 105 }
106 106
107 void PolicyUITest::SetUpInProcessBrowserTestFixture() { 107 void PolicyUITest::SetUpInProcessBrowserTestFixture() {
108 EXPECT_CALL(provider_, IsInitializationComplete(_)) 108 EXPECT_CALL(provider_, IsInitializationComplete(_))
109 .WillRepeatedly(Return(true)); 109 .WillRepeatedly(Return(true));
110 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber());
111 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); 110 policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
112 } 111 }
113 112
114 void PolicyUITest::UpdateProviderPolicy(const policy::PolicyMap& policy) { 113 void PolicyUITest::UpdateProviderPolicy(const policy::PolicyMap& policy) {
115 provider_.UpdateChromePolicy(policy); 114 provider_.UpdateChromePolicy(policy);
116 base::RunLoop loop; 115 base::RunLoop loop;
117 loop.RunUntilIdle(); 116 loop.RunUntilIdle();
118 } 117 }
119 118
120 void PolicyUITest::VerifyPolicies( 119 void PolicyUITest::VerifyPolicies(
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 expected_policies.begin() + first_unset_position++, 258 expected_policies.begin() + first_unset_position++,
260 PopulateExpectedPolicy(kUnknownPolicy, 259 PopulateExpectedPolicy(kUnknownPolicy,
261 expected_values[kUnknownPolicy], 260 expected_values[kUnknownPolicy],
262 values.Get(kUnknownPolicy), 261 values.Get(kUnknownPolicy),
263 true)); 262 true));
264 263
265 // Retrieve the contents of the policy table from the UI and verify that it 264 // Retrieve the contents of the policy table from the UI and verify that it
266 // matches the expectation. 265 // matches the expectation.
267 VerifyPolicies(expected_policies); 266 VerifyPolicies(expected_policies);
268 } 267 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698