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

Side by Side Diff: chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed another test. Created 5 years, 3 months 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/files/scoped_temp_dir.h" 12 #include "base/files/scoped_temp_dir.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
16 #include "chromeos/dbus/mock_cryptohome_client.h" 16 #include "chromeos/dbus/mock_cryptohome_client.h"
17 #include "chromeos/dbus/mock_session_manager_client.h" 17 #include "chromeos/dbus/mock_session_manager_client.h"
18 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 18 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
19 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" 19 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h"
20 #include "components/policy/core/common/cloud/policy_builder.h" 20 #include "components/policy/core/common/cloud/policy_builder.h"
21 #include "components/policy/core/common/policy_types.h"
21 #include "policy/policy_constants.h" 22 #include "policy/policy_constants.h"
22 #include "policy/proto/cloud_policy.pb.h" 23 #include "policy/proto/cloud_policy.pb.h"
23 #include "policy/proto/device_management_local.pb.h" 24 #include "policy/proto/device_management_local.pb.h"
24 #include "testing/gmock/include/gmock/gmock.h" 25 #include "testing/gmock/include/gmock/gmock.h"
25 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
26 27
27 namespace em = enterprise_management; 28 namespace em = enterprise_management;
28 29
29 using testing::AllOf; 30 using testing::AllOf;
30 using testing::AnyNumber; 31 using testing::AnyNumber;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 Mock::VerifyAndClearExpectations(&session_manager_client_); 150 Mock::VerifyAndClearExpectations(&session_manager_client_);
150 ASSERT_FALSE(store_callback.is_null()); 151 ASSERT_FALSE(store_callback.is_null());
151 152
152 // The new policy shouldn't be present yet. 153 // The new policy shouldn't be present yet.
153 PolicyMap previous_policy; 154 PolicyMap previous_policy;
154 EXPECT_EQ(previous_value != NULL, store_->policy() != NULL); 155 EXPECT_EQ(previous_value != NULL, store_->policy() != NULL);
155 if (previous_value) { 156 if (previous_value) {
156 previous_policy.Set(key::kHomepageLocation, 157 previous_policy.Set(key::kHomepageLocation,
157 POLICY_LEVEL_MANDATORY, 158 POLICY_LEVEL_MANDATORY,
158 POLICY_SCOPE_USER, 159 POLICY_SCOPE_USER,
160 POLICY_SOURCE_CLOUD,
159 new base::StringValue(previous_value), NULL); 161 new base::StringValue(previous_value), NULL);
160 } 162 }
161 EXPECT_TRUE(previous_policy.Equals(store_->policy_map())); 163 EXPECT_TRUE(previous_policy.Equals(store_->policy_map()));
162 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); 164 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status());
163 165
164 // Store the new public key so that the validation after the retrieve 166 // Store the new public key so that the validation after the retrieve
165 // operation completes can verify the signature. 167 // operation completes can verify the signature.
166 if (new_public_key) 168 if (new_public_key)
167 StoreUserPolicyKey(*new_public_key); 169 StoreUserPolicyKey(*new_public_key);
168 170
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 Mock::VerifyAndClearExpectations(&cryptohome_client_); 669 Mock::VerifyAndClearExpectations(&cryptohome_client_);
668 670
669 EXPECT_FALSE(store_->policy()); 671 EXPECT_FALSE(store_->policy());
670 EXPECT_TRUE(store_->policy_map().empty()); 672 EXPECT_TRUE(store_->policy_map().empty());
671 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status()); 673 EXPECT_EQ(CloudPolicyStore::STATUS_VALIDATION_ERROR, store_->status());
672 } 674 }
673 675
674 } // namespace 676 } // namespace
675 677
676 } // namespace policy 678 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698