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 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_TEST_UTIL_H_ 6#define CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_TEST_UTIL_H_ 7 8#include <string> 9 10#include "base/callback_forward.h" 11#include "base/memory/scoped_ptr.h" 12 13namespace base { 14class DictionaryValue; 15} 16 17namespace policy { 18 19class CloudPolicyCore; 20 21namespace test { 22 23// Passes |data| to |destination| and invokes |done_callback| to indicate that 24// the |data| has been retrieved. 25void ExternalDataFetchCallback(scoped_ptr<std::string>* destination, 26 const base::Closure& done_callback, 27 scoped_ptr<std::string> data); 28 29// Constructs a value that points a policy referencing external data at |url| 30// and sets the expected hash of the external data to that of |data|. 31scoped_ptr<base::DictionaryValue> ConstructExternalDataReference( 32 const std::string& url, 33 const std::string& data); 34 35// TODO(bartfab): Makes an arbitrary |policy| in |core| reference external data 36// as specified in |metadata|. This is only done because there are no policies 37// that reference external data yet. Once the first such policy is added, it 38// will be sufficient to set its value to |metadata| and this method should be 39// removed. 40void SetExternalDataReference(CloudPolicyCore* core, 41 const std::string& policy, 42 scoped_ptr<base::DictionaryValue> metadata); 43 44} // namespace test 45} // namespace policy 46 47#endif // CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_TEST_UTIL_H_ 48