| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 scoped_ptr<net::URLFetcher> FakeURLFetcherFactory::CreateURLFetcher( | 91 scoped_ptr<net::URLFetcher> FakeURLFetcherFactory::CreateURLFetcher( |
| 92 int id, | 92 int id, |
| 93 const GURL& url, | 93 const GURL& url, |
| 94 net::URLFetcher::RequestType request_type, | 94 net::URLFetcher::RequestType request_type, |
| 95 net::URLFetcherDelegate* delegate) { | 95 net::URLFetcherDelegate* delegate) { |
| 96 scoped_ptr<net::URLFetcher> fetcher = | 96 scoped_ptr<net::URLFetcher> fetcher = |
| 97 net::FakeURLFetcherFactory::CreateURLFetcher(id, url, request_type, | 97 net::FakeURLFetcherFactory::CreateURLFetcher(id, url, request_type, |
| 98 delegate); | 98 delegate); |
| 99 EXPECT_TRUE(fetcher); | 99 EXPECT_TRUE(fetcher); |
| 100 return fetcher.Pass(); | 100 return fetcher; |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace | 103 } // namespace |
| 104 | 104 |
| 105 class CloudExternalDataManagerBaseTest : public testing::Test { | 105 class CloudExternalDataManagerBaseTest : public testing::Test { |
| 106 protected: | 106 protected: |
| 107 CloudExternalDataManagerBaseTest(); | 107 CloudExternalDataManagerBaseTest(); |
| 108 | 108 |
| 109 void SetUp() override; | 109 void SetUp() override; |
| 110 void TearDown() override; | 110 void TearDown() override; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 scoped_ptr<base::DictionaryValue> | 199 scoped_ptr<base::DictionaryValue> |
| 200 CloudExternalDataManagerBaseTest::ConstructMetadata( | 200 CloudExternalDataManagerBaseTest::ConstructMetadata( |
| 201 const std::string& url, | 201 const std::string& url, |
| 202 const std::string& hash) { | 202 const std::string& hash) { |
| 203 scoped_ptr<base::DictionaryValue> metadata(new base::DictionaryValue); | 203 scoped_ptr<base::DictionaryValue> metadata(new base::DictionaryValue); |
| 204 metadata->SetStringWithoutPathExpansion("url", url); | 204 metadata->SetStringWithoutPathExpansion("url", url); |
| 205 metadata->SetStringWithoutPathExpansion("hash", base::HexEncode(hash.c_str(), | 205 metadata->SetStringWithoutPathExpansion("hash", base::HexEncode(hash.c_str(), |
| 206 hash.size())); | 206 hash.size())); |
| 207 return metadata.Pass(); | 207 return metadata; |
| 208 } | 208 } |
| 209 | 209 |
| 210 void CloudExternalDataManagerBaseTest::SetExternalDataReference( | 210 void CloudExternalDataManagerBaseTest::SetExternalDataReference( |
| 211 const std::string& policy, | 211 const std::string& policy, |
| 212 scoped_ptr<base::DictionaryValue> metadata) { | 212 scoped_ptr<base::DictionaryValue> metadata) { |
| 213 cloud_policy_store_.policy_map_.Set( | 213 cloud_policy_store_.policy_map_.Set( |
| 214 policy, | 214 policy, |
| 215 POLICY_LEVEL_MANDATORY, | 215 POLICY_LEVEL_MANDATORY, |
| 216 POLICY_SCOPE_USER, | 216 POLICY_SCOPE_USER, |
| 217 POLICY_SOURCE_CLOUD, | 217 POLICY_SOURCE_CLOUD, |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 crypto::SHA256HashString(k10ByteData))); | 762 crypto::SHA256HashString(k10ByteData))); |
| 763 cloud_policy_store_.NotifyStoreLoaded(); | 763 cloud_policy_store_.NotifyStoreLoaded(); |
| 764 base::RunLoop().RunUntilIdle(); | 764 base::RunLoop().RunUntilIdle(); |
| 765 EXPECT_EQ(1u, callback_data_.size()); | 765 EXPECT_EQ(1u, callback_data_.size()); |
| 766 ASSERT_TRUE(callback_data_[1]); | 766 ASSERT_TRUE(callback_data_[1]); |
| 767 EXPECT_EQ(k10ByteData, *callback_data_[1]); | 767 EXPECT_EQ(k10ByteData, *callback_data_[1]); |
| 768 ResetCallbackData(); | 768 ResetCallbackData(); |
| 769 } | 769 } |
| 770 | 770 |
| 771 } // namespace policy | 771 } // namespace policy |
| OLD | NEW |