| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/policy/user_policy_cache.h" | 5 #include "chrome/browser/policy/user_policy_cache.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/scoped_temp_dir.h" | 12 #include "base/scoped_temp_dir.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | 14 #include "chrome/browser/policy/proto/cloud_policy.pb.h" |
| 15 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 15 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 16 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 16 #include "chrome/browser/policy/proto/device_management_local.pb.h" |
| 17 #include "chrome/browser/policy/proto/old_generic_format.pb.h" | 17 #include "chrome/browser/policy/proto/old_generic_format.pb.h" |
| 18 #include "content/test/test_browser_thread.h" | 18 #include "content/test/test_browser_thread.h" |
| 19 #include "testing/gmock/include/gmock/gmock.h" | 19 #include "testing/gmock/include/gmock/gmock.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 using content::BrowserThread; |
| 22 using testing::_; | 23 using testing::_; |
| 23 | 24 |
| 24 namespace policy { | 25 namespace policy { |
| 25 | 26 |
| 26 // Decodes a CloudPolicySettings object into two maps with mandatory and | 27 // Decodes a CloudPolicySettings object into two maps with mandatory and |
| 27 // recommended settings, respectively. The implementation is generated code | 28 // recommended settings, respectively. The implementation is generated code |
| 28 // in policy/cloud_policy_generated.cc. | 29 // in policy/cloud_policy_generated.cc. |
| 29 void DecodePolicy(const em::CloudPolicySettings& policy, | 30 void DecodePolicy(const em::CloudPolicySettings& policy, |
| 30 PolicyMap* mandatory, PolicyMap* recommended); | 31 PolicyMap* mandatory, PolicyMap* recommended); |
| 31 | 32 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // If new-style policy comes in, it should override old-style policy. | 405 // If new-style policy comes in, it should override old-style policy. |
| 405 policy = CreateHomepagePolicy("http://www.example.com", | 406 policy = CreateHomepagePolicy("http://www.example.com", |
| 406 base::Time::NowFromSystemTime(), | 407 base::Time::NowFromSystemTime(), |
| 407 em::PolicyOptions::RECOMMENDED); | 408 em::PolicyOptions::RECOMMENDED); |
| 408 SetPolicy(&cache, policy); | 409 SetPolicy(&cache, policy); |
| 409 EXPECT_TRUE(expected.Equals(recommended_policy(cache))); | 410 EXPECT_TRUE(expected.Equals(recommended_policy(cache))); |
| 410 EXPECT_TRUE(empty.Equals(mandatory_policy(cache))); | 411 EXPECT_TRUE(empty.Equals(mandatory_policy(cache))); |
| 411 } | 412 } |
| 412 | 413 |
| 413 } // namespace policy | 414 } // namespace policy |
| OLD | NEW |