Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <CoreFoundation/CoreFoundation.h> | 5 #include <CoreFoundation/CoreFoundation.h> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/mac/scoped_cftyperef.h" | 10 #include "base/mac/scoped_cftyperef.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 testing::Values(TestHarness::Create)); | 130 testing::Values(TestHarness::Create)); |
| 131 | 131 |
| 132 // TODO(joaodasilva): instantiate Configuration3rdPartyPolicyProviderTest too | 132 // TODO(joaodasilva): instantiate Configuration3rdPartyPolicyProviderTest too |
| 133 // once the mac loader supports 3rd party policy. http://crbug.com/108995 | 133 // once the mac loader supports 3rd party policy. http://crbug.com/108995 |
| 134 | 134 |
| 135 // Special test cases for some mac preferences details. | 135 // Special test cases for some mac preferences details. |
| 136 class PolicyLoaderMacTest : public PolicyTestBase { | 136 class PolicyLoaderMacTest : public PolicyTestBase { |
| 137 protected: | 137 protected: |
| 138 PolicyLoaderMacTest() | 138 PolicyLoaderMacTest() |
| 139 : prefs_(new MockPreferences()) {} | 139 : prefs_(new MockPreferences()) {} |
| 140 virtual ~PolicyLoaderMacTest() {} | |
|
erikwright (departed)
2015/01/09 21:06:51
Chromium guidelines encourage consistent declarati
dcheng
2015/01/09 22:09:32
The reason we declare them is so we can define the
Mattias Nissler (ping if slow)
2015/01/13 10:03:13
The reason this dtor is here is actually because t
erikwright (departed)
2015/01/13 12:03:27
I re-read C++ Dos and Don'ts, "What about code out
| |
| 141 | 140 |
| 142 virtual void SetUp() override { | 141 void SetUp() override { |
| 143 PolicyTestBase::SetUp(); | 142 PolicyTestBase::SetUp(); |
| 144 scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderMac( | 143 scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderMac( |
| 145 loop_.message_loop_proxy(), base::FilePath(), prefs_)); | 144 loop_.message_loop_proxy(), base::FilePath(), prefs_)); |
| 146 provider_.reset(new AsyncPolicyProvider(&schema_registry_, loader.Pass())); | 145 provider_.reset(new AsyncPolicyProvider(&schema_registry_, loader.Pass())); |
| 147 provider_->Init(&schema_registry_); | 146 provider_->Init(&schema_registry_); |
| 148 } | 147 } |
| 149 | 148 |
| 150 virtual void TearDown() override { | 149 void TearDown() override { |
| 151 provider_->Shutdown(); | 150 provider_->Shutdown(); |
| 152 PolicyTestBase::TearDown(); | 151 PolicyTestBase::TearDown(); |
| 153 } | 152 } |
| 154 | 153 |
| 155 MockPreferences* prefs_; | 154 MockPreferences* prefs_; |
| 156 scoped_ptr<AsyncPolicyProvider> provider_; | 155 scoped_ptr<AsyncPolicyProvider> provider_; |
| 157 }; | 156 }; |
| 158 | 157 |
| 159 TEST_F(PolicyLoaderMacTest, Invalid) { | 158 TEST_F(PolicyLoaderMacTest, Invalid) { |
| 160 ScopedCFTypeRef<CFStringRef> name( | 159 ScopedCFTypeRef<CFStringRef> name( |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 190 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) | 189 expected_bundle.Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())) |
| 191 .Set(test_keys::kKeyString, | 190 .Set(test_keys::kKeyString, |
| 192 POLICY_LEVEL_RECOMMENDED, | 191 POLICY_LEVEL_RECOMMENDED, |
| 193 POLICY_SCOPE_USER, | 192 POLICY_SCOPE_USER, |
| 194 new base::StringValue("string value"), | 193 new base::StringValue("string value"), |
| 195 NULL); | 194 NULL); |
| 196 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); | 195 EXPECT_TRUE(provider_->policies().Equals(expected_bundle)); |
| 197 } | 196 } |
| 198 | 197 |
| 199 } // namespace policy | 198 } // namespace policy |
| OLD | NEW |