Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_util.cc

Issue 1557693002: Convert Pass()→std::move() in //chrome/browser/chromeos/policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_test_u til.h" 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u til.h"
6 6
7 #include <utility>
8
7 #include "base/callback.h" 9 #include "base/callback.h"
8 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
9 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
10 #include "base/values.h" 12 #include "base/values.h"
11 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" 13 #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
12 #include "components/policy/core/common/cloud/cloud_policy_core.h" 14 #include "components/policy/core/common/cloud/cloud_policy_core.h"
13 #include "components/policy/core/common/cloud/cloud_policy_store.h" 15 #include "components/policy/core/common/cloud/cloud_policy_store.h"
14 #include "components/policy/core/common/external_data_fetcher.h" 16 #include "components/policy/core/common/external_data_fetcher.h"
15 #include "components/policy/core/common/policy_map.h" 17 #include "components/policy/core/common/policy_map.h"
16 #include "components/policy/core/common/policy_types.h" 18 #include "components/policy/core/common/policy_types.h"
17 #include "crypto/sha2.h" 19 #include "crypto/sha2.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
19 21
20 namespace policy { 22 namespace policy {
21 namespace test { 23 namespace test {
22 24
23 void ExternalDataFetchCallback(scoped_ptr<std::string>* destination, 25 void ExternalDataFetchCallback(scoped_ptr<std::string>* destination,
24 const base::Closure& done_callback, 26 const base::Closure& done_callback,
25 scoped_ptr<std::string> data) { 27 scoped_ptr<std::string> data) {
26 *destination = data.Pass(); 28 *destination = std::move(data);
27 done_callback.Run(); 29 done_callback.Run();
28 } 30 }
29 31
30 scoped_ptr<base::DictionaryValue> ConstructExternalDataReference( 32 scoped_ptr<base::DictionaryValue> ConstructExternalDataReference(
31 const std::string& url, 33 const std::string& url,
32 const std::string& data) { 34 const std::string& data) {
33 const std::string hash = crypto::SHA256HashString(data); 35 const std::string hash = crypto::SHA256HashString(data);
34 scoped_ptr<base::DictionaryValue> metadata(new base::DictionaryValue); 36 scoped_ptr<base::DictionaryValue> metadata(new base::DictionaryValue);
35 metadata->SetStringWithoutPathExpansion("url", url); 37 metadata->SetStringWithoutPathExpansion("url", url);
36 metadata->SetStringWithoutPathExpansion("hash", base::HexEncode(hash.c_str(), 38 metadata->SetStringWithoutPathExpansion("hash", base::HexEncode(hash.c_str(),
37 hash.size())); 39 hash.size()));
38 return metadata.Pass(); 40 return metadata;
39 } 41 }
40 42
41 void SetExternalDataReference(CloudPolicyCore* core, 43 void SetExternalDataReference(CloudPolicyCore* core,
42 const std::string& policy, 44 const std::string& policy,
43 scoped_ptr<base::DictionaryValue> metadata) { 45 scoped_ptr<base::DictionaryValue> metadata) {
44 CloudPolicyStore* store = core->store(); 46 CloudPolicyStore* store = core->store();
45 ASSERT_TRUE(store); 47 ASSERT_TRUE(store);
46 PolicyMap policy_map; 48 PolicyMap policy_map;
47 policy_map.Set(policy, 49 policy_map.Set(policy,
48 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 50 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD,
49 metadata.release(), 51 metadata.release(),
50 new ExternalDataFetcher(store->external_data_manager(), 52 new ExternalDataFetcher(store->external_data_manager(),
51 policy)); 53 policy));
52 store->SetPolicyMapForTesting(policy_map); 54 store->SetPolicyMapForTesting(policy_map);
53 } 55 }
54 56
55 } // namespace test 57 } // namespace test
56 } // namespace policy 58 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698