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

Side by Side Diff: chrome/common/extensions/sync_type_unittest.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Just rebased 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 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 <utility>
6
5 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/ptr_util.h"
6 #include "build/build_config.h" 9 #include "build/build_config.h"
7 #include "chrome/common/extensions/sync_helper.h" 10 #include "chrome/common/extensions/sync_helper.h"
8 #include "extensions/common/error_utils.h" 11 #include "extensions/common/error_utils.h"
9 #include "extensions/common/extension.h" 12 #include "extensions/common/extension.h"
10 #include "extensions/common/features/simple_feature.h" 13 #include "extensions/common/features/simple_feature.h"
11 #include "extensions/common/manifest.h" 14 #include "extensions/common/manifest.h"
12 #include "extensions/common/manifest_constants.h" 15 #include "extensions/common/manifest_constants.h"
13 #include "extensions/common/manifest_handlers/plugins_handler.h" 16 #include "extensions/common/manifest_handlers/plugins_handler.h"
14 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
15 #include "url/gurl.h" 18 #include "url/gurl.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 source.SetString(keys::kUpdateURL, update_url.spec()); 52 source.SetString(keys::kUpdateURL, update_url.spec());
50 } 53 }
51 if (!launch_url.is_empty()) { 54 if (!launch_url.is_empty()) {
52 source.SetString(keys::kLaunchWebURL, launch_url.spec()); 55 source.SetString(keys::kLaunchWebURL, launch_url.spec());
53 } 56 }
54 if (type != THEME) { 57 if (type != THEME) {
55 source.SetBoolean(keys::kConvertedFromUserScript, type == USER_SCRIPT); 58 source.SetBoolean(keys::kConvertedFromUserScript, type == USER_SCRIPT);
56 if (num_plugins >= 0) { 59 if (num_plugins >= 0) {
57 base::ListValue* plugins = new base::ListValue(); 60 base::ListValue* plugins = new base::ListValue();
58 for (int i = 0; i < num_plugins; ++i) { 61 for (int i = 0; i < num_plugins; ++i) {
59 base::DictionaryValue* plugin = new base::DictionaryValue(); 62 auto plugin = base::MakeUnique<base::DictionaryValue>();
60 plugin->SetString(keys::kPluginsPath, std::string()); 63 plugin->SetString(keys::kPluginsPath, std::string());
61 plugins->Set(i, plugin); 64 plugins->Set(i, std::move(plugin));
62 } 65 }
63 source.Set(keys::kPlugins, plugins); 66 source.Set(keys::kPlugins, plugins);
64 } 67 }
65 } 68 }
66 if (has_plugin_permission) { 69 if (has_plugin_permission) {
67 base::ListValue* plugins = new base::ListValue(); 70 base::ListValue* plugins = new base::ListValue();
68 plugins->Set(0, new base::Value("plugin")); 71 plugins->Set(0, base::MakeUnique<base::Value>("plugin"));
69 source.Set(keys::kPermissions, plugins); 72 source.Set(keys::kPermissions, plugins);
70 } 73 }
71 74
72 std::string error; 75 std::string error;
73 scoped_refptr<Extension> extension = Extension::Create( 76 scoped_refptr<Extension> extension = Extension::Create(
74 extension_path, location, source, creation_flags, &error); 77 extension_path, location, source, creation_flags, &error);
75 if (expected_error.empty()) 78 if (expected_error.empty())
76 EXPECT_TRUE(extension.get()); 79 EXPECT_TRUE(extension.get());
77 else 80 else
78 EXPECT_FALSE(extension.get()); 81 EXPECT_FALSE(extension.get());
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 EXTENSION, GURL(), GURL(), 311 EXTENSION, GURL(), GURL(),
309 Manifest::INTERNAL, base::FilePath(), 312 Manifest::INTERNAL, base::FilePath(),
310 Extension::NO_FLAGS, 0, true, 313 Extension::NO_FLAGS, 0, true,
311 ErrorUtils::FormatErrorMessage( 314 ErrorUtils::FormatErrorMessage(
312 errors::kPermissionNotAllowedInManifest, "plugin"))); 315 errors::kPermissionNotAllowedInManifest, "plugin")));
313 } 316 }
314 317
315 #endif // !defined(OS_CHROMEOS) 318 #endif // !defined(OS_CHROMEOS)
316 319
317 } // namespace extensions 320 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698