Support policies referencing external data for device-local accounts
[chromium-blink-merge.git] / chrome / browser / chromeos / policy / cloud_external_data_manager_base_test_util.h
blobd1b85910652c335c66c7fae3664048e3877c9435
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.
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_
8 #include <string>
10 #include "base/callback_forward.h"
11 #include "base/memory/scoped_ptr.h"
13 namespace base {
14 class DictionaryValue;
17 namespace policy {
19 class CloudPolicyCore;
21 namespace test {
23 // Passes |data| to |destination| and invokes |done_callback| to indicate that
24 // the |data| has been retrieved.
25 void ExternalDataFetchCallback(scoped_ptr<std::string>* destination,
26 const base::Closure& done_callback,
27 scoped_ptr<std::string> data);
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|.
31 scoped_ptr<base::DictionaryValue> ConstructExternalDataReference(
32 const std::string& url,
33 const std::string& data);
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.
40 void SetExternalDataReference(CloudPolicyCore* core,
41 const std::string& policy,
42 scoped_ptr<base::DictionaryValue> metadata);
44 } // namespace test
45 } // namespace policy
47 #endif // CHROME_BROWSER_CHROMEOS_POLICY_CLOUD_EXTERNAL_DATA_MANAGER_BASE_TEST_UTIL_H_