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

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

Issue 1940153002: Use std::unique_ptr to express ownership of base::Value in PolicyMap::Entry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another-fix Created 4 years, 7 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 base::WrapUnique(metadata->DeepCopy())); 77 base::WrapUnique(metadata->DeepCopy()));
78 content::RunAllPendingInMessageLoop(); 78 content::RunAllPendingInMessageLoop();
79 79
80 ProfilePolicyConnector* policy_connector = 80 ProfilePolicyConnector* policy_connector =
81 ProfilePolicyConnectorFactory::GetForBrowserContext(browser()->profile()); 81 ProfilePolicyConnectorFactory::GetForBrowserContext(browser()->profile());
82 ASSERT_TRUE(policy_connector); 82 ASSERT_TRUE(policy_connector);
83 const PolicyMap& policies = policy_connector->policy_service()->GetPolicies( 83 const PolicyMap& policies = policy_connector->policy_service()->GetPolicies(
84 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())); 84 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()));
85 const PolicyMap::Entry* policy_entry = policies.Get(key::kHomepageLocation); 85 const PolicyMap::Entry* policy_entry = policies.Get(key::kHomepageLocation);
86 ASSERT_TRUE(policy_entry); 86 ASSERT_TRUE(policy_entry);
87 EXPECT_TRUE(base::Value::Equals(metadata.get(), policy_entry->value)); 87 EXPECT_TRUE(base::Value::Equals(metadata.get(), policy_entry->value.get()));
88 ASSERT_TRUE(policy_entry->external_data_fetcher); 88 ASSERT_TRUE(policy_entry->external_data_fetcher);
89 89
90 base::RunLoop run_loop; 90 base::RunLoop run_loop;
91 std::unique_ptr<std::string> fetched_external_data; 91 std::unique_ptr<std::string> fetched_external_data;
92 policy_entry->external_data_fetcher->Fetch(base::Bind( 92 policy_entry->external_data_fetcher->Fetch(base::Bind(
93 &test::ExternalDataFetchCallback, 93 &test::ExternalDataFetchCallback,
94 &fetched_external_data, 94 &fetched_external_data,
95 run_loop.QuitClosure())); 95 run_loop.QuitClosure()));
96 run_loop.Run(); 96 run_loop.Run();
97 97
98 ASSERT_TRUE(fetched_external_data); 98 ASSERT_TRUE(fetched_external_data);
99 EXPECT_EQ(external_data, *fetched_external_data); 99 EXPECT_EQ(external_data, *fetched_external_data);
100 } 100 }
101 101
102 } // namespace policy 102 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698