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

Side by Side Diff: extensions/common/file_util_unittest.cc

Issue 1908953003: Convert //extensions/{common,shell} from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase? Created 4 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
« no previous file with comments | « extensions/common/file_util.cc ('k') | extensions/common/manifest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/common/file_util.h" 5 #include "extensions/common/file_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 return extension; 42 return extension;
43 } 43 }
44 44
45 scoped_refptr<Extension> LoadExtensionManifest( 45 scoped_refptr<Extension> LoadExtensionManifest(
46 const std::string& manifest_value, 46 const std::string& manifest_value,
47 const base::FilePath& manifest_dir, 47 const base::FilePath& manifest_dir,
48 Manifest::Location location, 48 Manifest::Location location,
49 int extra_flags, 49 int extra_flags,
50 std::string* error) { 50 std::string* error) {
51 JSONStringValueDeserializer deserializer(manifest_value); 51 JSONStringValueDeserializer deserializer(manifest_value);
52 scoped_ptr<base::Value> result = deserializer.Deserialize(NULL, error); 52 std::unique_ptr<base::Value> result = deserializer.Deserialize(NULL, error);
53 if (!result.get()) 53 if (!result.get())
54 return NULL; 54 return NULL;
55 CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); 55 CHECK_EQ(base::Value::TYPE_DICTIONARY, result->GetType());
56 return LoadExtensionManifest( 56 return LoadExtensionManifest(
57 *base::DictionaryValue::From(std::move(result)).get(), manifest_dir, 57 *base::DictionaryValue::From(std::move(result)).get(), manifest_dir,
58 location, extra_flags, error); 58 location, extra_flags, error);
59 } 59 }
60 60
61 } // namespace 61 } // namespace
62 62
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 std::vector<extensions::InstallWarning> warnings; 277 std::vector<extensions::InstallWarning> warnings;
278 EXPECT_TRUE(file_util::ValidateExtension(extension.get(), &error, &warnings)) 278 EXPECT_TRUE(file_util::ValidateExtension(extension.get(), &error, &warnings))
279 << error; 279 << error;
280 EXPECT_EQ(0U, warnings.size()); 280 EXPECT_EQ(0U, warnings.size());
281 } 281 }
282 282
283 TEST_F(FileUtilTest, BackgroundScriptsMustExist) { 283 TEST_F(FileUtilTest, BackgroundScriptsMustExist) {
284 base::ScopedTempDir temp; 284 base::ScopedTempDir temp;
285 ASSERT_TRUE(temp.CreateUniqueTempDir()); 285 ASSERT_TRUE(temp.CreateUniqueTempDir());
286 286
287 scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue()); 287 std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
288 value->SetString("name", "test"); 288 value->SetString("name", "test");
289 value->SetString("version", "1"); 289 value->SetString("version", "1");
290 value->SetInteger("manifest_version", 1); 290 value->SetInteger("manifest_version", 1);
291 291
292 base::ListValue* scripts = new base::ListValue(); 292 base::ListValue* scripts = new base::ListValue();
293 scripts->Append(new base::StringValue("foo.js")); 293 scripts->Append(new base::StringValue("foo.js"));
294 value->Set("background.scripts", scripts); 294 value->Set("background.scripts", scripts);
295 295
296 std::string error; 296 std::string error;
297 std::vector<extensions::InstallWarning> warnings; 297 std::vector<extensions::InstallWarning> warnings;
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 base::FilePath actual_path = 543 base::FilePath actual_path =
544 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path); 544 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path);
545 EXPECT_EQ(expected_path.value(), actual_path.value()) << 545 EXPECT_EQ(expected_path.value(), actual_path.value()) <<
546 " For the path " << url; 546 " For the path " << url;
547 } 547 }
548 // Remove temp files. 548 // Remove temp files.
549 ASSERT_TRUE(base::DeleteFile(root_path, true)); 549 ASSERT_TRUE(base::DeleteFile(root_path, true));
550 } 550 }
551 551
552 } // namespace extensions 552 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/file_util.cc ('k') | extensions/common/manifest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698