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

Side by Side Diff: chrome/browser/component_updater/supervised_user_whitelist_installer_unittest.cc

Issue 2811673002: Reland: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Workaround with std::move Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
11 #include "base/files/scoped_temp_dir.h" 13 #include "base/files/scoped_temp_dir.h"
12 #include "base/json/json_file_value_serializer.h" 14 #include "base/json/json_file_value_serializer.h"
13 #include "base/json/json_reader.h" 15 #include "base/json/json_reader.h"
14 #include "base/json/json_writer.h" 16 #include "base/json/json_writer.h"
15 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
16 #include "base/path_service.h" 18 #include "base/path_service.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 ASSERT_TRUE( 231 ASSERT_TRUE(
230 PathService::Get(chrome::DIR_SUPERVISED_USER_INSTALLED_WHITELISTS, 232 PathService::Get(chrome::DIR_SUPERVISED_USER_INSTALLED_WHITELISTS,
231 &installed_whitelist_directory_)); 233 &installed_whitelist_directory_));
232 std::string crx_id(kCrxId); 234 std::string crx_id(kCrxId);
233 whitelist_path_ = 235 whitelist_path_ =
234 installed_whitelist_directory_.AppendASCII(crx_id + ".json"); 236 installed_whitelist_directory_.AppendASCII(crx_id + ".json");
235 237
236 std::unique_ptr<base::DictionaryValue> whitelist_dict( 238 std::unique_ptr<base::DictionaryValue> whitelist_dict(
237 new base::DictionaryValue); 239 new base::DictionaryValue);
238 whitelist_dict->SetString("sites", kWhitelistFile); 240 whitelist_dict->SetString("sites", kWhitelistFile);
239 manifest_.Set("whitelisted_content", whitelist_dict.release()); 241 manifest_.Set("whitelisted_content", std::move(whitelist_dict));
240 242
241 large_icon_path_ = whitelist_version_directory_.AppendASCII(kLargeIconFile); 243 large_icon_path_ = whitelist_version_directory_.AppendASCII(kLargeIconFile);
242 std::unique_ptr<base::DictionaryValue> icons_dict( 244 std::unique_ptr<base::DictionaryValue> icons_dict(
243 new base::DictionaryValue); 245 new base::DictionaryValue);
244 icons_dict->SetString("128", kLargeIconFile); 246 icons_dict->SetString("128", kLargeIconFile);
245 manifest_.Set("icons", icons_dict.release()); 247 manifest_.Set("icons", std::move(icons_dict));
246 248
247 manifest_.SetString("version", kVersion); 249 manifest_.SetString("version", kVersion);
248 250
249 std::unique_ptr<base::DictionaryValue> crx_dict(new base::DictionaryValue); 251 std::unique_ptr<base::DictionaryValue> crx_dict(new base::DictionaryValue);
250 crx_dict->SetString("name", kName); 252 crx_dict->SetString("name", kName);
251 std::unique_ptr<base::ListValue> clients(new base::ListValue); 253 std::unique_ptr<base::ListValue> clients(new base::ListValue);
252 clients->AppendString(kClientId); 254 clients->AppendString(kClientId);
253 clients->AppendString(kOtherClientId); 255 clients->AppendString(kOtherClientId);
254 crx_dict->Set("clients", clients.release()); 256 crx_dict->Set("clients", std::move(clients));
255 pref_.Set(kCrxId, crx_dict.release()); 257 pref_.Set(kCrxId, std::move(crx_dict));
256 } 258 }
257 259
258 protected: 260 protected:
259 ProfileAttributesStorage* profile_attributes_storage() { 261 ProfileAttributesStorage* profile_attributes_storage() {
260 return testing_profile_manager_.profile_attributes_storage(); 262 return testing_profile_manager_.profile_attributes_storage();
261 } 263 }
262 264
263 base::FilePath GetProfilePath(const std::string& profile_name) { 265 base::FilePath GetProfilePath(const std::string& profile_name) {
264 return testing_profile_manager_.profiles_dir().AppendASCII(profile_name); 266 return testing_profile_manager_.profiles_dir().AppendASCII(profile_name);
265 } 267 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 // but it exercises a different code path. 427 // but it exercises a different code path.
426 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId)); 428 profile_attributes_storage()->RemoveProfile(GetProfilePath(kOtherClientId));
427 run_loop.RunUntilIdle(); 429 run_loop.RunUntilIdle();
428 } 430 }
429 EXPECT_FALSE(component_update_service_.registered_component()); 431 EXPECT_FALSE(component_update_service_.registered_component());
430 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_)); 432 EXPECT_FALSE(base::DirectoryExists(whitelist_directory_));
431 EXPECT_FALSE(base::PathExists(whitelist_path_)); 433 EXPECT_FALSE(base::PathExists(whitelist_path_));
432 } 434 }
433 435
434 } // namespace component_updater 436 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698