summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/file_manager/file_tasks_unittest.cc321
-rw-r--r--chrome/browser/chromeos/power/extension_event_observer_unittest.cc26
-rw-r--r--chrome/browser/chromeos/power/renderer_freezer_unittest.cc52
-rw-r--r--chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc109
-rw-r--r--chrome/browser/extensions/active_script_controller_unittest.cc17
-rw-r--r--chrome/browser/extensions/active_tab_unittest.cc9
-rw-r--r--chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc7
-rw-r--r--chrome/browser/extensions/api/debugger/debugger_apitest.cc15
-rw-r--r--chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc8
-rw-r--r--chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc5
-rw-r--r--chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc43
-rw-r--r--chrome/browser/extensions/api/identity/identity_apitest.cc19
-rw-r--r--chrome/browser/extensions/api/omnibox/omnibox_unittest.cc288
-rw-r--r--chrome/browser/extensions/api/storage/settings_apitest.cc39
-rw-r--r--chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc26
-rw-r--r--chrome/browser/extensions/app_data_migrator_unittest.cc45
-rw-r--r--chrome/browser/extensions/extension_context_menu_model_unittest.cc5
-rw-r--r--chrome/browser/extensions/extension_install_prompt_unittest.cc43
-rw-r--r--chrome/browser/extensions/extension_message_bubble_controller_unittest.cc32
-rw-r--r--chrome/browser/extensions/extension_service_sync_unittest.cc22
-rw-r--r--chrome/browser/extensions/location_bar_controller_unittest.cc7
-rw-r--r--chrome/browser/extensions/permission_messages_unittest.cc39
-rw-r--r--chrome/browser/extensions/process_manager_browsertest.cc7
-rw-r--r--chrome/browser/extensions/scripting_permissions_modifier_unittest.cc22
-rw-r--r--chrome/browser/extensions/shared_module_service_unittest.cc31
-rw-r--r--chrome/browser/extensions/test_extension_environment.cc6
-rw-r--r--chrome/browser/extensions/webstore_installer_browsertest.cc30
-rw-r--r--chrome/browser/extensions/webstore_startup_installer_browsertest.cc26
-rw-r--r--chrome/browser/notifications/message_center_settings_controller_unittest.cc46
-rw-r--r--chrome/browser/notifications/platform_notification_service_unittest.cc7
-rw-r--r--chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc56
-rw-r--r--chrome/browser/site_details_browsertest.cc27
-rw-r--r--chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc46
-rw-r--r--chrome/browser/ui/webui/uber/uber_ui_browsertest.cc14
-rw-r--r--chrome/common/extensions/api/common_extension_api_unittest.cc22
-rw-r--r--chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc112
-rw-r--r--chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc30
-rw-r--r--chrome/common/extensions/permissions/permission_set_unittest.cc13
-rw-r--r--chrome/common/extensions/permissions/permissions_data_unittest.cc16
-rw-r--r--chrome/common/pepper_permission_util_unittest.cc10
-rw-r--r--chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc11
-rw-r--r--extensions/browser/mojo/keep_alive_impl_unittest.cc41
-rw-r--r--extensions/common/features/base_feature_provider_unittest.cc21
-rw-r--r--extensions/common/features/complex_feature_unittest.cc21
-rw-r--r--extensions/common/test_util.cc6
-rw-r--r--extensions/common/value_builder.cc17
-rw-r--r--extensions/common/value_builder.h31
-rw-r--r--extensions/common/value_builder_unittest.cc37
-rw-r--r--extensions/extensions_tests.gypi3
-rw-r--r--extensions/shell/browser/api/identity/identity_api_unittest.cc25
50 files changed, 1061 insertions, 850 deletions
diff --git a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
index 534d3af..9efaba6 100644
--- a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
+++ b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc
@@ -464,50 +464,48 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTasks) {
// Foo.app can handle "text/plain" and "text/html".
extensions::ExtensionBuilder foo_app;
- foo_app.SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Foo")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app",
- extensions::DictionaryBuilder()
- .Set("background",
- extensions::DictionaryBuilder()
- .Set("scripts",
- extensions::ListBuilder()
- .Append("background.js"))))
- .Set("file_handlers",
- extensions::DictionaryBuilder()
- .Set("text",
- extensions::DictionaryBuilder()
- .Set("title", "Text")
- .Set("types",
- extensions::ListBuilder()
- .Append("text/plain")
- .Append("text/html")))));
+ foo_app.SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Foo")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("file_handlers",
+ extensions::DictionaryBuilder().Set(
+ "text",
+ extensions::DictionaryBuilder()
+ .Set("title", "Text")
+ .Set("types", std::move(extensions::ListBuilder()
+ .Append("text/plain")
+ .Append("text/html"))))));
foo_app.SetID(kFooId);
extension_service_->AddExtension(foo_app.Build().get());
// Bar.app can only handle "text/plain".
extensions::ExtensionBuilder bar_app;
- bar_app.SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Bar")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app",
- extensions::DictionaryBuilder()
- .Set("background",
- extensions::DictionaryBuilder()
- .Set("scripts",
- extensions::ListBuilder()
- .Append("background.js"))))
- .Set("file_handlers",
- extensions::DictionaryBuilder()
- .Set("text",
- extensions::DictionaryBuilder()
- .Set("title", "Text")
- .Set("types",
- extensions::ListBuilder()
- .Append("text/plain")))));
+ bar_app.SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Bar")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("file_handlers",
+ extensions::DictionaryBuilder().Set(
+ "text",
+ extensions::DictionaryBuilder()
+ .Set("title", "Text")
+ .Set("types", std::move(extensions::ListBuilder().Append(
+ "text/plain"))))));
bar_app.SetID(kBarId);
extension_service_->AddExtension(bar_app.Build().get());
@@ -574,17 +572,17 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileBrowserHandlerTasks) {
.Set("name", "Foo")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
- .Set(
- "file_browser_handlers",
- extensions::ListBuilder().Append(
- extensions::DictionaryBuilder()
- .Set("id", "open")
- .Set("default_title", "open")
- .Set("file_filters", extensions::ListBuilder()
- .Append("filesystem:*.txt")
- .Append("filesystem:*.html")))));
+ .Set("permissions", std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
+ .Set("file_browser_handlers",
+ std::move(extensions::ListBuilder().Append(
+ extensions::DictionaryBuilder()
+ .Set("id", "open")
+ .Set("default_title", "open")
+ .Set("file_filters",
+ std::move(extensions::ListBuilder()
+ .Append("filesystem:*.txt")
+ .Append("filesystem:*.html")))))));
foo_app.SetID(kFooId);
extension_service_->AddExtension(foo_app.Build().get());
@@ -595,15 +593,16 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileBrowserHandlerTasks) {
.Set("name", "Bar")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
+ .Set("permissions", std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
.Set("file_browser_handlers",
- extensions::ListBuilder().Append(
+ std::move(extensions::ListBuilder().Append(
extensions::DictionaryBuilder()
.Set("id", "open")
.Set("default_title", "open")
- .Set("file_filters", extensions::ListBuilder().Append(
- "filesystem:*.txt")))));
+ .Set("file_filters",
+ std::move(extensions::ListBuilder().Append(
+ "filesystem:*.txt")))))));
bar_app.SetID(kBarId);
extension_service_->AddExtension(bar_app.Build().get());
@@ -652,25 +651,24 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks) {
// Foo.app can handle "text/plain".
// This is a packaged app (file handler).
extensions::ExtensionBuilder foo_app;
- foo_app.SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Foo")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app",
- extensions::DictionaryBuilder()
- .Set("background",
- extensions::DictionaryBuilder()
- .Set("scripts",
- extensions::ListBuilder()
- .Append("background.js"))))
- .Set("file_handlers",
- extensions::DictionaryBuilder()
- .Set("text",
- extensions::DictionaryBuilder()
- .Set("title", "Text")
- .Set("types",
- extensions::ListBuilder()
- .Append("text/plain")))));
+ foo_app.SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Foo")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("file_handlers",
+ extensions::DictionaryBuilder().Set(
+ "text",
+ extensions::DictionaryBuilder()
+ .Set("title", "Text")
+ .Set("types", std::move(extensions::ListBuilder().Append(
+ "text/plain"))))));
foo_app.SetID(kFooId);
extension_service_->AddExtension(foo_app.Build().get());
@@ -682,15 +680,16 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks) {
.Set("name", "Bar")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
+ .Set("permissions", std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
.Set("file_browser_handlers",
- extensions::ListBuilder().Append(
+ std::move(extensions::ListBuilder().Append(
extensions::DictionaryBuilder()
.Set("id", "open")
.Set("default_title", "open")
- .Set("file_filters", extensions::ListBuilder().Append(
- "filesystem:*.txt")))));
+ .Set("file_filters",
+ std::move(extensions::ListBuilder().Append(
+ "filesystem:*.txt")))))));
bar_app.SetID(kBarId);
extension_service_->AddExtension(bar_app.Build().get());
@@ -773,15 +772,16 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) {
.Set("name", "Bar")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
+ .Set("permissions", std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
.Set("file_browser_handlers",
- extensions::ListBuilder().Append(
+ std::move(extensions::ListBuilder().Append(
extensions::DictionaryBuilder()
.Set("id", "open")
.Set("default_title", "open")
- .Set("file_filters", extensions::ListBuilder().Append(
- "filesystem:*.gdoc")))));
+ .Set("file_filters",
+ std::move(extensions::ListBuilder().Append(
+ "filesystem:*.gdoc")))))));
bar_app.SetID(kBarId);
extension_service_->AddExtension(bar_app.Build().get());
@@ -794,15 +794,16 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) {
.Set("name", "Files")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
+ .Set("permissions", std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
.Set("file_browser_handlers",
- extensions::ListBuilder().Append(
+ std::move(extensions::ListBuilder().Append(
extensions::DictionaryBuilder()
.Set("id", "open")
.Set("default_title", "open")
- .Set("file_filters", extensions::ListBuilder().Append(
- "filesystem:*.gdoc")))));
+ .Set("file_filters",
+ std::move(extensions::ListBuilder().Append(
+ "filesystem:*.gdoc")))))));
files_app.SetID(kFileManagerAppId);
extension_service_->AddExtension(files_app.Build().get());
@@ -837,87 +838,99 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTask_Generic) {
// Foo app provides file handler for text/plain and all file types.
extensions::ExtensionBuilder foo_app;
- foo_app.SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Foo")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app", extensions::DictionaryBuilder()
- .Set("background", extensions::DictionaryBuilder()
- .Set("scripts", extensions::ListBuilder()
- .Append("background.js"))))
- .Set("file_handlers",
- extensions::DictionaryBuilder()
- .Set("any",
- extensions::DictionaryBuilder()
- .Set("types", extensions::ListBuilder()
- .Append("*/*")))
- .Set("text",
- extensions::DictionaryBuilder()
- .Set("types", extensions::ListBuilder()
- .Append("text/plain")))));
+ foo_app.SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Foo")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("file_handlers",
+ extensions::DictionaryBuilder()
+ .Set("any",
+ extensions::DictionaryBuilder().Set(
+ "types",
+ std::move(extensions::ListBuilder().Append("*/*"))))
+ .Set("text",
+ extensions::DictionaryBuilder().Set(
+ "types", std::move(extensions::ListBuilder().Append(
+ "text/plain"))))));
foo_app.SetID(kFooId);
extension_service_->AddExtension(foo_app.Build().get());
// Bar app provides file handler for .txt and not provide generic file
// handler.
extensions::ExtensionBuilder bar_app;
- bar_app.SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Bar")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app", extensions::DictionaryBuilder()
- .Set("background", extensions::DictionaryBuilder()
- .Set("scripts", extensions::ListBuilder()
- .Append("background.js"))))
- .Set("file_handlers",
- extensions::DictionaryBuilder()
- .Set("text",
- extensions::DictionaryBuilder()
- .Set("extensions", extensions::ListBuilder()
- .Append("txt")))));
+ bar_app.SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Bar")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("file_handlers",
+ extensions::DictionaryBuilder().Set(
+ "text",
+ extensions::DictionaryBuilder().Set(
+ "extensions",
+ std::move(extensions::ListBuilder().Append("txt"))))));
bar_app.SetID(kBarId);
extension_service_->AddExtension(bar_app.Build().get());
// Baz app provides file handler for all extensions and images.
extensions::ExtensionBuilder baz_app;
- baz_app.SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Baz")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app", extensions::DictionaryBuilder()
- .Set("background", extensions::DictionaryBuilder()
- .Set("scripts", extensions::ListBuilder()
- .Append("background.js"))))
- .Set("file_handlers",
- extensions::DictionaryBuilder()
- .Set("any",
- extensions::DictionaryBuilder()
- .Set("extensions", extensions::ListBuilder()
- .Append("*")
- .Append("bar")))
- .Set("image",
- extensions::DictionaryBuilder()
- .Set("types", extensions::ListBuilder()
- .Append("image/*")))));
+ baz_app.SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Baz")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("file_handlers",
+ extensions::DictionaryBuilder()
+ .Set("any",
+ extensions::DictionaryBuilder().Set(
+ "extensions", std::move(extensions::ListBuilder()
+ .Append("*")
+ .Append("bar"))))
+ .Set("image",
+ extensions::DictionaryBuilder().Set(
+ "types", std::move(extensions::ListBuilder().Append(
+ "image/*"))))));
baz_app.SetID(kBazId);
extension_service_->AddExtension(baz_app.Build().get());
// Qux app provides file handler for all types.
extensions::ExtensionBuilder qux_app;
- qux_app.SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Qux")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app", extensions::DictionaryBuilder()
- .Set("background", extensions::DictionaryBuilder()
- .Set("scripts", extensions::ListBuilder()
- .Append("background.js"))))
- .Set("file_handlers",
- extensions::DictionaryBuilder()
- .Set("any",
- extensions::DictionaryBuilder()
- .Set("types", extensions::ListBuilder()
- .Append("*")))));
+ qux_app.SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Qux")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("file_handlers",
+ extensions::DictionaryBuilder().Set(
+ "any",
+ extensions::DictionaryBuilder().Set(
+ "types",
+ std::move(extensions::ListBuilder().Append("*"))))));
qux_app.SetID(kQuxId);
extension_service_->AddExtension(qux_app.Build().get());
diff --git a/chrome/browser/chromeos/power/extension_event_observer_unittest.cc b/chrome/browser/chromeos/power/extension_event_observer_unittest.cc
index 06fff49..5858c5d 100644
--- a/chrome/browser/chromeos/power/extension_event_observer_unittest.cc
+++ b/chrome/browser/chromeos/power/extension_event_observer_unittest.cc
@@ -89,18 +89,20 @@ class ExtensionEventObserverTest : public ::testing::Test {
scoped_refptr<extensions::Extension> app =
extensions::ExtensionBuilder()
.SetManifest(
- extensions::DictionaryBuilder()
- .Set("name", name)
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app",
- extensions::DictionaryBuilder().Set(
- "background",
- extensions::DictionaryBuilder().Set(
- "scripts", extensions::ListBuilder().Append(
- "background.js"))))
- .Set("permissions", extensions::ListBuilder().Append(
- uses_gcm ? "gcm" : "")))
+ extensions::DictionaryBuilder()
+ .Set("name", name)
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts",
+ std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("permissions",
+ std::move(extensions::ListBuilder().Append(
+ uses_gcm ? "gcm" : ""))))
.Build();
created_apps_.push_back(app);
diff --git a/chrome/browser/chromeos/power/renderer_freezer_unittest.cc b/chrome/browser/chromeos/power/renderer_freezer_unittest.cc
index 953f8af..0d937c1 100644
--- a/chrome/browser/chromeos/power/renderer_freezer_unittest.cc
+++ b/chrome/browser/chromeos/power/renderer_freezer_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/power/renderer_freezer.h"
#include <string>
+#include <utility>
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
@@ -310,20 +311,20 @@ TEST_F(RendererFreezerTestWithExtensions, DoesNotFreezeGcmExtensionRenderers) {
// First build the GCM extension.
scoped_refptr<extensions::Extension> gcm_app =
extensions::ExtensionBuilder()
- .SetManifest(extensions::DictionaryBuilder()
- .Set("name", "GCM App")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app",
- extensions::DictionaryBuilder()
- .Set("background",
- extensions::DictionaryBuilder()
- .Set("scripts",
- extensions::ListBuilder()
- .Append("background.js"))))
- .Set("permissions",
- extensions::ListBuilder()
- .Append("gcm")))
+ .SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "GCM App")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts",
+ std::move(extensions::ListBuilder().Append(
+ "background.js")))))
+ .Set("permissions",
+ std::move(extensions::ListBuilder().Append("gcm"))))
.Build();
// Now install it and give it a renderer.
@@ -343,17 +344,18 @@ TEST_F(RendererFreezerTestWithExtensions, FreezesNonGcmExtensionRenderers) {
// First build the extension.
scoped_refptr<extensions::Extension> background_app =
extensions::ExtensionBuilder()
- .SetManifest(extensions::DictionaryBuilder()
- .Set("name", "Background App")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("app",
- extensions::DictionaryBuilder()
- .Set("background",
- extensions::DictionaryBuilder()
- .Set("scripts",
- extensions::ListBuilder()
- .Append("background.js")))))
+ .SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "Background App")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts",
+ std::move(extensions::ListBuilder().Append(
+ "background.js"))))))
.Build();
// Now install it and give it a renderer.
diff --git a/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc b/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc
index 2aa8e42..792ad86 100644
--- a/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc
+++ b/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/printer_detector/printer_detector.h"
+#include <utility>
+
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "base/strings/stringprintf.h"
@@ -127,22 +129,23 @@ class PrinterDetectorAppSearchEnabledTest : public testing::Test {
// Creates a test extension with the provided permissions.
scoped_refptr<extensions::Extension> CreateTestExtension(
- ListBuilder& permissions_builder,
+ ListBuilder permissions_builder,
DictionaryBuilder& usb_printers_builder) {
return extensions::ExtensionBuilder()
.SetID("fake_extension_id")
.SetManifest(
- DictionaryBuilder()
- .Set("name", "Printer provider extension")
- .Set("manifest_version", 2)
- .Set("version", "1.0")
- // Needed to enable usb API.
- .Set("app", DictionaryBuilder().Set(
- "background",
- DictionaryBuilder().Set(
- "scripts", ListBuilder().Append("bg.js"))))
- .Set("permissions", permissions_builder)
- .Set("usb_printers", usb_printers_builder))
+ DictionaryBuilder()
+ .Set("name", "Printer provider extension")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0")
+ // Needed to enable usb API.
+ .Set("app", DictionaryBuilder().Set(
+ "background",
+ DictionaryBuilder().Set(
+ "scripts",
+ std::move(ListBuilder().Append("bg.js")))))
+ .Set("permissions", std::move(permissions_builder))
+ .Set("usb_printers", usb_printers_builder))
.Build();
}
@@ -171,15 +174,15 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, ShowFindAppNotification) {
TEST_F(PrinterDetectorAppSearchEnabledTest, ShowAppFoundNotification) {
scoped_refptr<extensions::Extension> extension = CreateTestExtension(
- ListBuilder()
- .Append("usb")
- .Append("printerProvider")
- .Append(DictionaryBuilder().Set(
- "usbDevices", ListBuilder().Append(DictionaryBuilder()
- .Set("vendorId", 123)
- .Set("productId", 456))))
- .Pass(),
- DictionaryBuilder().Set("filters", ListBuilder().Pass()).Pass());
+ std::move(ListBuilder()
+ .Append("usb")
+ .Append("printerProvider")
+ .Append(DictionaryBuilder().Set(
+ "usbDevices", std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("vendorId", 123)
+ .Set("productId", 456)))))),
+ DictionaryBuilder().Set("filters", ListBuilder()).Pass());
ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
->AddEnabled(extension));
@@ -197,14 +200,12 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, ShowAppFoundNotification) {
TEST_F(PrinterDetectorAppSearchEnabledTest,
UsbHandlerExists_NotPrinterProvider) {
scoped_refptr<extensions::Extension> extension = CreateTestExtension(
- ListBuilder()
- .Append("usb")
- .Append(DictionaryBuilder().Set(
- "usbDevices", ListBuilder().Append(DictionaryBuilder()
- .Set("vendorId", 123)
- .Set("productId", 756))))
- .Pass(),
- DictionaryBuilder().Set("filters", ListBuilder().Pass()).Pass());
+ std::move(ListBuilder().Append("usb").Append(DictionaryBuilder().Set(
+ "usbDevices",
+ std::move(ListBuilder().Append(DictionaryBuilder()
+ .Set("vendorId", 123)
+ .Set("productId", 756)))))),
+ DictionaryBuilder().Set("filters", ListBuilder()).Pass());
ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
->AddEnabled(extension));
@@ -222,15 +223,15 @@ TEST_F(PrinterDetectorAppSearchEnabledTest,
TEST_F(PrinterDetectorAppSearchEnabledTest,
PrinterProvider_DifferentUsbProductId) {
scoped_refptr<extensions::Extension> extension = CreateTestExtension(
- ListBuilder()
- .Append("usb")
- .Append("printerProvider")
- .Append(DictionaryBuilder().Set(
- "usbDevices", ListBuilder().Append(DictionaryBuilder()
- .Set("vendorId", 123)
- .Set("productId", 001))))
- .Pass(),
- DictionaryBuilder().Set("filters", ListBuilder().Pass()).Pass());
+ std::move(ListBuilder()
+ .Append("usb")
+ .Append("printerProvider")
+ .Append(DictionaryBuilder().Set(
+ "usbDevices", std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("vendorId", 123)
+ .Set("productId", 001)))))),
+ DictionaryBuilder().Set("filters", ListBuilder()).Pass());
ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
->AddEnabled(extension));
@@ -248,11 +249,11 @@ TEST_F(PrinterDetectorAppSearchEnabledTest,
TEST_F(PrinterDetectorAppSearchEnabledTest,
PrinterProvider_UsbPrinters_NotFound) {
scoped_refptr<extensions::Extension> extension = CreateTestExtension(
- ListBuilder().Append("usb").Append("printerProvider").Pass(),
- DictionaryBuilder().Set(
- "filters",
- ListBuilder().Append(
- DictionaryBuilder().Set("vendorId", 123).Set("productId", 001))));
+ std::move(ListBuilder().Append("usb").Append("printerProvider")),
+ DictionaryBuilder().Set("filters", std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("vendorId", 123)
+ .Set("productId", 001)))));
ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
->AddEnabled(extension));
@@ -270,11 +271,11 @@ TEST_F(PrinterDetectorAppSearchEnabledTest,
TEST_F(PrinterDetectorAppSearchEnabledTest,
PrinterProvider_UsbPrinters_WithProductId) {
scoped_refptr<extensions::Extension> extension = CreateTestExtension(
- ListBuilder().Append("usb").Append("printerProvider").Pass(),
- DictionaryBuilder().Set(
- "filters",
- ListBuilder().Append(
- DictionaryBuilder().Set("vendorId", 123).Set("productId", 456))));
+ std::move(ListBuilder().Append("usb").Append("printerProvider")),
+ DictionaryBuilder().Set("filters", std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("vendorId", 123)
+ .Set("productId", 456)))));
ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
->AddEnabled(extension));
@@ -292,12 +293,12 @@ TEST_F(PrinterDetectorAppSearchEnabledTest,
TEST_F(PrinterDetectorAppSearchEnabledTest,
PrinterProvider_UsbPrinters_WithInterfaceClass) {
scoped_refptr<extensions::Extension> extension = CreateTestExtension(
- ListBuilder().Append("usb").Append("printerProvider").Pass(),
+ std::move(ListBuilder().Append("usb").Append("printerProvider")),
DictionaryBuilder().Set(
- "filters", ListBuilder().Append(
+ "filters", std::move(ListBuilder().Append(
DictionaryBuilder()
.Set("vendorId", 123)
- .Set("interfaceClass", kPrinterInterfaceClass))));
+ .Set("interfaceClass", kPrinterInterfaceClass)))));
ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
->AddEnabled(extension));
@@ -314,12 +315,12 @@ TEST_F(PrinterDetectorAppSearchEnabledTest,
TEST_F(PrinterDetectorAppSearchEnabledTest, IgnoreNonPrinters) {
scoped_refptr<extensions::Extension> extension = CreateTestExtension(
- ListBuilder().Append("usb").Append("printerProvider").Pass(),
+ std::move(ListBuilder().Append("usb").Append("printerProvider")),
DictionaryBuilder().Set(
- "filters", ListBuilder().Append(
+ "filters", std::move(ListBuilder().Append(
DictionaryBuilder()
.Set("vendorId", 123)
- .Set("interfaceClass", kPrinterInterfaceClass))));
+ .Set("interfaceClass", kPrinterInterfaceClass)))));
ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get())
->AddEnabled(extension));
diff --git a/chrome/browser/extensions/active_script_controller_unittest.cc b/chrome/browser/extensions/active_script_controller_unittest.cc
index 3d21d5c..4c16930 100644
--- a/chrome/browser/extensions/active_script_controller_unittest.cc
+++ b/chrome/browser/extensions/active_script_controller_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <map>
+#include <utility>
#include "base/values.h"
#include "chrome/browser/extensions/active_script_controller.h"
@@ -99,18 +100,18 @@ ActiveScriptControllerUnitTest::~ActiveScriptControllerUnitTest() {
const Extension* ActiveScriptControllerUnitTest::AddExtension() {
const std::string kId = crx_file::id_util::GenerateId("all_hosts_extension");
- extension_ = ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
+ extension_ =
+ ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
.Set("name", "all_hosts_extension")
.Set("description", "an extension")
.Set("manifest_version", 2)
.Set("version", "1.0.0")
- .Set("permissions",
- ListBuilder().Append(kAllHostsPermission)))
- .SetLocation(Manifest::INTERNAL)
- .SetID(kId)
- .Build();
+ .Set("permissions", std::move(ListBuilder().Append(
+ kAllHostsPermission))))
+ .SetLocation(Manifest::INTERNAL)
+ .SetID(kId)
+ .Build();
ExtensionRegistry::Get(profile())->AddEnabled(extension_);
PermissionsUpdater(profile()).InitializePermissions(extension_.get());
diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc
index be5668c..45ae57c 100644
--- a/chrome/browser/extensions/active_tab_unittest.cc
+++ b/chrome/browser/extensions/active_tab_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <string>
+#include <utility>
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
@@ -50,10 +51,10 @@ scoped_refptr<const Extension> CreateTestExtension(
permissions.Append("tabCapture");
return ExtensionBuilder()
.SetManifest(DictionaryBuilder()
- .Set("name", "Extension with ID " + id)
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Set("permissions", permissions))
+ .Set("name", "Extension with ID " + id)
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("permissions", std::move(permissions)))
.SetID(id)
.Build();
}
diff --git a/chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc
index acc27e8..6501a46 100644
--- a/chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/values.h"
#include "chrome/browser/extensions/activity_log/activity_action_constants.h"
#include "chrome/browser/extensions/activity_log/activity_actions.h"
@@ -47,8 +49,9 @@ TEST_F(ActivityLogPolicyUtilTest, StripPrivacySensitiveWebRequest) {
.Set(activity_log_web_request_constants::kNewUrlKey,
"http://www.youtube.com/")
.Set(activity_log_web_request_constants::kAddedRequestHeadersKey,
- ListBuilder().Append("arg"))
- .Build().release());
+ std::move(ListBuilder().Append("arg")))
+ .Build()
+ .release());
ActivityLogPolicy::Util::StripPrivacySensitiveFields(action);
diff --git a/chrome/browser/extensions/api/debugger/debugger_apitest.cc b/chrome/browser/extensions/api/debugger/debugger_apitest.cc
index 1ca4e71..ff1a67d 100644
--- a/chrome/browser/extensions/api/debugger/debugger_apitest.cc
+++ b/chrome/browser/extensions/api/debugger/debugger_apitest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <string>
+#include <utility>
#include "base/command_line.h"
#include "base/memory/ref_counted.h"
@@ -65,12 +66,14 @@ void DebuggerApiTest::SetUpCommandLine(base::CommandLine* command_line) {
void DebuggerApiTest::SetUpOnMainThread() {
ExtensionApiTest::SetUpOnMainThread();
extension_ =
- ExtensionBuilder().SetManifest(
- DictionaryBuilder().Set("name", "debugger")
- .Set("version", "0.1")
- .Set("manifest_version", 2)
- .Set("permissions",
- ListBuilder().Append("debugger"))).Build();
+ ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "debugger")
+ .Set("version", "0.1")
+ .Set("manifest_version", 2)
+ .Set("permissions",
+ std::move(ListBuilder().Append("debugger"))))
+ .Build();
}
testing::AssertionResult DebuggerApiTest::RunAttachFunction(
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
index b114258..1c36c62 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_is_bookmarked_condition_tracker_unittest.cc
@@ -39,10 +39,10 @@ scoped_refptr<Extension> CreateExtensionWithBookmarksPermission(
permissions.Append("bookmarks");
return ExtensionBuilder()
.SetManifest(DictionaryBuilder()
- .Set("name", "Test extension")
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Set("permissions", permissions))
+ .Set("name", "Test extension")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("permissions", std::move(permissions)))
.Build();
}
diff --git a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
index c64fc63..60b3468 100644
--- a/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
+++ b/chrome/browser/extensions/api/developer_private/developer_private_api_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/files/file_util.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
@@ -529,7 +531,8 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) {
args = ListBuilder()
.Append(DictionaryBuilder()
.Set("extensionId", extension->id())
- .Set("errorIds", ListBuilder().Append(error_id)))
+ .Set("errorIds",
+ std::move(ListBuilder().Append(error_id))))
.Build();
function = new api::DeveloperPrivateDeleteExtensionErrorsFunction();
EXPECT_TRUE(RunFunction(function, *args)) << function->GetError();
diff --git a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
index 94f1b0e..6d38e51 100644
--- a/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
+++ b/chrome/browser/extensions/api/developer_private/extension_info_generator_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/json/json_file_value_serializer.h"
#include "base/json/json_writer.h"
#include "base/strings/string_util.h"
@@ -80,19 +82,19 @@ class ExtensionInfoGeneratorUnitTest : public ExtensionServiceTestBase {
const scoped_refptr<const Extension> CreateExtension(
const std::string& name,
- ListBuilder& permissions) {
+ ListBuilder permissions) {
const std::string kId = crx_file::id_util::GenerateId(name);
scoped_refptr<const Extension> extension =
- ExtensionBuilder().SetManifest(
- DictionaryBuilder()
- .Set("name", name)
- .Set("description", "an extension")
- .Set("manifest_version", 2)
- .Set("version", "1.0.0")
- .Set("permissions", permissions))
- .SetLocation(Manifest::INTERNAL)
- .SetID(kId)
- .Build();
+ ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
+ .Set("name", name)
+ .Set("description", "an extension")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0.0")
+ .Set("permissions", std::move(permissions)))
+ .SetLocation(Manifest::INTERNAL)
+ .SetID(kId)
+ .Build();
ExtensionRegistry::Get(profile())->AddEnabled(extension);
PermissionsUpdater(profile()).InitializePermissions(extension.get());
@@ -177,12 +179,13 @@ TEST_F(ExtensionInfoGeneratorUnitTest, BasicInfoTest) {
const char kVersion[] = "1.0.0.1";
std::string id = crx_file::id_util::GenerateId("alpha");
scoped_ptr<base::DictionaryValue> manifest =
- DictionaryBuilder().Set("name", kName)
- .Set("version", kVersion)
- .Set("manifest_version", 2)
- .Set("description", "an extension")
- .Set("permissions",
- ListBuilder().Append("file://*/*")).Build();
+ DictionaryBuilder()
+ .Set("name", kName)
+ .Set("version", kVersion)
+ .Set("manifest_version", 2)
+ .Set("description", "an extension")
+ .Set("permissions", std::move(ListBuilder().Append("file://*/*")))
+ .Build();
scoped_ptr<base::DictionaryValue> manifest_copy(manifest->DeepCopy());
scoped_refptr<const Extension> extension =
ExtensionBuilder().SetManifest(manifest.Pass())
@@ -345,9 +348,9 @@ TEST_F(ExtensionInfoGeneratorUnitTest, ExtensionInfoRunOnAllUrls) {
FeatureSwitch::scripts_require_action(), true));
// Two extensions - one with all urls, one without.
scoped_refptr<const Extension> all_urls_extension = CreateExtension(
- "all_urls", ListBuilder().Append(kAllHostsPermission).Pass());
+ "all_urls", std::move(ListBuilder().Append(kAllHostsPermission)));
scoped_refptr<const Extension> no_urls_extension =
- CreateExtension("no urls", ListBuilder().Pass());
+ CreateExtension("no urls", ListBuilder());
scoped_ptr<developer::ExtensionInfo> info =
GenerateExtensionInfo(all_urls_extension->id());
@@ -392,7 +395,7 @@ TEST_F(ExtensionInfoGeneratorUnitTest, ExtensionInfoRunOnAllUrls) {
// Load another extension with all urls (so permissions get re-init'd).
all_urls_extension = CreateExtension(
- "all_urls_II", ListBuilder().Append(kAllHostsPermission).Pass());
+ "all_urls_II", std::move(ListBuilder().Append(kAllHostsPermission)));
// Even though the extension has all_urls permission, the checkbox shouldn't
// show up without the switch.
diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc
index fceefe9..1475a57 100644
--- a/chrome/browser/extensions/api/identity/identity_apitest.cc
+++ b/chrome/browser/extensions/api/identity/identity_apitest.cc
@@ -1657,17 +1657,14 @@ class GetAuthTokenFunctionPublicSessionTest : public GetAuthTokenFunctionTest {
scoped_refptr<Extension> CreateTestExtension(const std::string& id) {
return ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "Test")
- .Set("version", "1.0")
- .Set(
- "oauth2",
- DictionaryBuilder()
- .Set("client_id", "clientId")
- .Set(
- "scopes",
- ListBuilder().Append("scope1"))))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "Test")
+ .Set("version", "1.0")
+ .Set("oauth2",
+ DictionaryBuilder()
+ .Set("client_id", "clientId")
+ .Set("scopes", std::move(ListBuilder().Append(
+ "scope1")))))
.SetLocation(Manifest::UNPACKED)
.SetID(id)
.Build();
diff --git a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
index db22403..51006e0 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/values.h"
#include "chrome/browser/extensions/api/omnibox/omnibox_api.h"
#include "chrome/common/extensions/api/omnibox.h"
@@ -41,21 +43,24 @@ void CompareClassification(const ACMatchClassifications& expected,
// + ddd
// = nmmmmndddn
TEST(ExtensionOmniboxTest, DescriptionStylesSimple) {
- scoped_ptr<base::ListValue> list = ListBuilder()
- .Append(42)
- .Append(ListBuilder()
- .Append(DictionaryBuilder()
- .Set("content", "content")
- .Set("description", "description")
- .Set("descriptionStyles", ListBuilder()
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 1)
- .Set("length", 4))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 6)
- .Set("length", 3))))).Build();
+ scoped_ptr<base::ListValue> list =
+ ListBuilder()
+ .Append(42)
+ .Append(std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("content", "content")
+ .Set("description", "description")
+ .Set("descriptionStyles",
+ std::move(ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 1)
+ .Set("length", 4))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 6)
+ .Set("length", 3)))))))
+ .Build();
ACMatchClassifications styles_expected;
styles_expected.push_back(ACMatchClassification(0, kNone));
@@ -72,21 +77,24 @@ TEST(ExtensionOmniboxTest, DescriptionStylesSimple) {
*params->suggest_results[0]));
// Same input, but swap the order. Ensure it still works.
- scoped_ptr<base::ListValue> swap_list = ListBuilder()
- .Append(42)
- .Append(ListBuilder()
- .Append(DictionaryBuilder()
- .Set("content", "content")
- .Set("description", "description")
- .Set("descriptionStyles", ListBuilder()
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 6)
- .Set("length", 3))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 1)
- .Set("length", 4))))).Build();
+ scoped_ptr<base::ListValue> swap_list =
+ ListBuilder()
+ .Append(42)
+ .Append(std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("content", "content")
+ .Set("description", "description")
+ .Set("descriptionStyles",
+ std::move(ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 6)
+ .Set("length", 3))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 1)
+ .Set("length", 4)))))))
+ .Build();
scoped_ptr<SendSuggestions::Params> swapped_params(
SendSuggestions::Params::Create(*swap_list));
@@ -104,33 +112,36 @@ TEST(ExtensionOmniboxTest, DescriptionStylesSimple) {
// + dd
// = 3773unnnn66
TEST(ExtensionOmniboxTest, DescriptionStylesCombine) {
- scoped_ptr<base::ListValue> list = ListBuilder()
- .Append(42)
- .Append(ListBuilder()
- .Append(DictionaryBuilder()
- .Set("content", "content")
- .Set("description", "description")
- .Set("descriptionStyles", ListBuilder()
- .Append(DictionaryBuilder()
- .Set("type", "url")
- .Set("offset", 0)
- .Set("length", 5))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 9)
- .Set("length", 2))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 9)
- .Set("length", 2))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 0)
- .Set("length", 4))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 1)
- .Set("length", 2))))).Build();
+ scoped_ptr<base::ListValue> list =
+ ListBuilder()
+ .Append(42)
+ .Append(std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("content", "content")
+ .Set("description", "description")
+ .Set("descriptionStyles",
+ std::move(ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("type", "url")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 9)
+ .Set("length", 2))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 9)
+ .Set("length", 2))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 4))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 1)
+ .Set("length", 2)))))))
+ .Build();
ACMatchClassifications styles_expected;
styles_expected.push_back(ACMatchClassification(0, kUrl | kMatch));
@@ -149,33 +160,36 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine) {
// Try moving the "dim/match" style pair at offset 9. Output should be the
// same.
- scoped_ptr<base::ListValue> moved_list = ListBuilder()
- .Append(42)
- .Append(ListBuilder()
- .Append(DictionaryBuilder()
- .Set("content", "content")
- .Set("description", "description")
- .Set("descriptionStyles", ListBuilder()
- .Append(DictionaryBuilder()
- .Set("type", "url")
- .Set("offset", 0)
- .Set("length", 5))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 0)
- .Set("length", 4))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 9)
- .Set("length", 2))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 9)
- .Set("length", 2))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 1)
- .Set("length", 2))))).Build();
+ scoped_ptr<base::ListValue> moved_list =
+ ListBuilder()
+ .Append(42)
+ .Append(std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("content", "content")
+ .Set("description", "description")
+ .Set("descriptionStyles",
+ std::move(ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("type", "url")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 4))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 9)
+ .Set("length", 2))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 9)
+ .Set("length", 2))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 1)
+ .Set("length", 2)))))))
+ .Build();
scoped_ptr<SendSuggestions::Params> moved_params(
SendSuggestions::Params::Create(*moved_list));
@@ -193,33 +207,36 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine) {
// + ddd
// = 77777nnnnn
TEST(ExtensionOmniboxTest, DescriptionStylesCombine2) {
- scoped_ptr<base::ListValue> list = ListBuilder()
- .Append(42)
- .Append(ListBuilder()
- .Append(DictionaryBuilder()
- .Set("content", "content")
- .Set("description", "description")
- .Set("descriptionStyles", ListBuilder()
- .Append(DictionaryBuilder()
- .Set("type", "url")
- .Set("offset", 0)
- .Set("length", 5))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 0)
- .Set("length", 5))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 0)
- .Set("length", 3))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 2)
- .Set("length", 3))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 0)
- .Set("length", 3))))).Build();
+ scoped_ptr<base::ListValue> list =
+ ListBuilder()
+ .Append(42)
+ .Append(std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("content", "content")
+ .Set("description", "description")
+ .Set("descriptionStyles",
+ std::move(ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("type", "url")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 3))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 2)
+ .Set("length", 3))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 0)
+ .Set("length", 3)))))))
+ .Build();
ACMatchClassifications styles_expected;
styles_expected.push_back(ACMatchClassification(0, kUrl | kMatch | kDim));
@@ -242,30 +259,33 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine2) {
// = 77777nnnnn
TEST(ExtensionOmniboxTest, DefaultSuggestResult) {
// Default suggestions should not have a content parameter.
- scoped_ptr<base::ListValue> list = ListBuilder()
- .Append(DictionaryBuilder()
- .Set("description", "description")
- .Set("descriptionStyles", ListBuilder()
- .Append(DictionaryBuilder()
- .Set("type", "url")
- .Set("offset", 0)
- .Set("length", 5))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 0)
- .Set("length", 5))
- .Append(DictionaryBuilder()
- .Set("type", "match")
- .Set("offset", 0)
- .Set("length", 3))
- .Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 2)
- .Set("length", 3))
+ scoped_ptr<base::ListValue> list =
+ ListBuilder()
.Append(DictionaryBuilder()
- .Set("type", "dim")
- .Set("offset", 0)
- .Set("length", 3)))).Build();
+ .Set("description", "description")
+ .Set("descriptionStyles",
+ std::move(ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("type", "url")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 5))
+ .Append(DictionaryBuilder()
+ .Set("type", "match")
+ .Set("offset", 0)
+ .Set("length", 3))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 2)
+ .Set("length", 3))
+ .Append(DictionaryBuilder()
+ .Set("type", "dim")
+ .Set("offset", 0)
+ .Set("length", 3)))))
+ .Build();
scoped_ptr<SetDefaultSuggestion::Params> params(
SetDefaultSuggestion::Params::Create(*list));
diff --git a/chrome/browser/extensions/api/storage/settings_apitest.cc b/chrome/browser/extensions/api/storage/settings_apitest.cc
index 9ac951e..1fd4550 100644
--- a/chrome/browser/extensions/api/storage/settings_apitest.cc
+++ b/chrome/browser/extensions/api/storage/settings_apitest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/bind.h"
#include "base/json/json_writer.h"
#include "base/memory/ref_counted.h"
@@ -491,23 +493,26 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ExtensionsSchemas) {
IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorage) {
// Set policies for the test extension.
- scoped_ptr<base::DictionaryValue> policy = extensions::DictionaryBuilder()
- .Set("string-policy", "value")
- .Set("int-policy", -123)
- .Set("double-policy", 456e7)
- .SetBoolean("boolean-policy", true)
- .Set("list-policy", extensions::ListBuilder()
- .Append("one")
- .Append("two")
- .Append("three"))
- .Set("dict-policy", extensions::DictionaryBuilder()
- .Set("list", extensions::ListBuilder()
- .Append(extensions::DictionaryBuilder()
- .Set("one", 1)
- .Set("two", 2))
- .Append(extensions::DictionaryBuilder()
- .Set("three", 3))))
- .Build();
+ scoped_ptr<base::DictionaryValue> policy =
+ extensions::DictionaryBuilder()
+ .Set("string-policy", "value")
+ .Set("int-policy", -123)
+ .Set("double-policy", 456e7)
+ .SetBoolean("boolean-policy", true)
+ .Set("list-policy",
+ std::move(
+ extensions::ListBuilder().Append("one").Append("two").Append(
+ "three")))
+ .Set("dict-policy",
+ extensions::DictionaryBuilder().Set(
+ "list",
+ std::move(extensions::ListBuilder()
+ .Append(extensions::DictionaryBuilder()
+ .Set("one", 1)
+ .Set("two", 2))
+ .Append(extensions::DictionaryBuilder().Set(
+ "three", 3)))))
+ .Build();
SetPolicies(*policy);
// Now run the extension.
ASSERT_TRUE(RunExtensionTest("settings/managed_storage")) << message_;
diff --git a/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc b/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc
index c30947c..77c9667 100644
--- a/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc
+++ b/chrome/browser/extensions/api/streams_private/streams_private_manifest_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/strings/string_number_conversions.h"
#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
#include "extensions/common/constants.h"
@@ -29,12 +31,12 @@ TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) {
scoped_refptr<const Extension> extension =
ExtensionBuilder()
.SetID(extension_misc::kQuickOfficeExtensionId)
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "MIME type handler test")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("mime_types", ListBuilder().Append("text/plain")))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "MIME type handler test")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("mime_types",
+ std::move(ListBuilder().Append("text/plain"))))
.Build();
ASSERT_TRUE(extension.get());
@@ -49,12 +51,12 @@ TEST_F(StreamsPrivateManifestTest,
MimeTypesHandlerMIMETypesNotWhitelisted) {
scoped_refptr<const Extension> extension =
ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "MIME types test")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("mime_types", ListBuilder().Append("text/plain")))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "MIME types test")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("mime_types",
+ std::move(ListBuilder().Append("text/plain"))))
.Build();
ASSERT_TRUE(extension.get());
diff --git a/chrome/browser/extensions/app_data_migrator_unittest.cc b/chrome/browser/extensions/app_data_migrator_unittest.cc
index a9d1e32..ba7d4a9 100644
--- a/chrome/browser/extensions/app_data_migrator_unittest.cc
+++ b/chrome/browser/extensions/app_data_migrator_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <string>
+#include <utility>
#include "base/callback_forward.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -74,29 +75,31 @@ scoped_refptr<const Extension> GetTestExtension(bool platform_app) {
if (platform_app) {
app = ExtensionBuilder()
.SetManifest(
- DictionaryBuilder()
- .Set("name", "test app")
- .Set("version", "1")
- .Set("app", DictionaryBuilder().Set(
- "background",
- DictionaryBuilder().Set(
- "scripts", ListBuilder().Append(
- "background.js"))))
- .Set("permissions",
- ListBuilder().Append("unlimitedStorage")))
+ DictionaryBuilder()
+ .Set("name", "test app")
+ .Set("version", "1")
+ .Set("app",
+ DictionaryBuilder().Set(
+ "background",
+ DictionaryBuilder().Set(
+ "scripts", std::move(ListBuilder().Append(
+ "background.js")))))
+ .Set("permissions",
+ std::move(ListBuilder().Append("unlimitedStorage"))))
.Build();
} else {
- app = ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "test app")
- .Set("version", "1")
- .Set("app", DictionaryBuilder().Set(
- "launch",
- DictionaryBuilder().Set(
- "local_path", "index.html")))
- .Set("permissions",
- ListBuilder().Append("unlimitedStorage")))
- .Build();
+ app =
+ ExtensionBuilder()
+ .SetManifest(
+ DictionaryBuilder()
+ .Set("name", "test app")
+ .Set("version", "1")
+ .Set("app", DictionaryBuilder().Set(
+ "launch", DictionaryBuilder().Set(
+ "local_path", "index.html")))
+ .Set("permissions",
+ std::move(ListBuilder().Append("unlimitedStorage"))))
+ .Build();
}
return app;
}
diff --git a/chrome/browser/extensions/extension_context_menu_model_unittest.cc b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
index c1469db..8f25568 100644
--- a/chrome/browser/extensions/extension_context_menu_model_unittest.cc
+++ b/chrome/browser/extensions/extension_context_menu_model_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/extensions/extension_context_menu_model.h"
+#include <utility>
+
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/extensions/active_script_controller.h"
@@ -159,7 +161,8 @@ const Extension* ExtensionContextMenuModelTest::AddExtensionWithHostPermission(
.Set("manifest_version", 2)
.Set(action_key, DictionaryBuilder().Pass());
if (!host_permission.empty())
- manifest.Set("permissions", ListBuilder().Append(host_permission));
+ manifest.Set("permissions",
+ std::move(ListBuilder().Append(host_permission)));
scoped_refptr<const Extension> extension =
ExtensionBuilder()
.SetManifest(manifest.Pass())
diff --git a/chrome/browser/extensions/extension_install_prompt_unittest.cc b/chrome/browser/extensions/extension_install_prompt_unittest.cc
index 82c723f..8eb35c1 100644
--- a/chrome/browser/extensions/extension_install_prompt_unittest.cc
+++ b/chrome/browser/extensions/extension_install_prompt_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
@@ -98,15 +100,18 @@ TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) {
FeatureSwitch::scripts_require_action(), true);
scoped_refptr<const Extension> extension =
- ExtensionBuilder().SetManifest(
- DictionaryBuilder().Set("name", "foo")
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Set("description", "Random Ext")
- .Set("permissions",
- ListBuilder().Append("http://*/*")
- .Append("http://www.google.com/")
- .Append("tabs"))).Build();
+ ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "foo")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("description", "Random Ext")
+ .Set("permissions",
+ std::move(ListBuilder()
+ .Append("http://*/*")
+ .Append("http://www.google.com/")
+ .Append("tabs"))))
+ .Build();
content::TestWebContentsFactory factory;
ExtensionInstallPrompt prompt(factory.CreateWebContents(profile()));
@@ -127,15 +132,17 @@ TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) {
TEST_F(ExtensionInstallPromptUnitTest,
DelegatedPromptShowsOptionalPermissions) {
scoped_refptr<const Extension> extension =
- ExtensionBuilder().SetManifest(
- DictionaryBuilder().Set("name", "foo")
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Set("description", "Random Ext")
- .Set("permissions",
- ListBuilder().Append("clipboardRead"))
- .Set("optional_permissions",
- ListBuilder().Append("tabs"))).Build();
+ ExtensionBuilder()
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "foo")
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("description", "Random Ext")
+ .Set("permissions", std::move(ListBuilder().Append(
+ "clipboardRead")))
+ .Set("optional_permissions",
+ std::move(ListBuilder().Append("tabs"))))
+ .Build();
content::TestWebContentsFactory factory;
ExtensionInstallPrompt prompt(factory.CreateWebContents(profile()));
diff --git a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
index 4af1301..54b732e 100644
--- a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
+++ b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
@@ -197,15 +199,15 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest {
const std::string& id,
Manifest::Location location) {
ExtensionBuilder builder;
- builder.SetManifest(DictionaryBuilder()
- .Set("name", std::string("Extension " + index))
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Set("chrome_settings_overrides",
- DictionaryBuilder().Set(
- "startup_pages",
- ListBuilder().Append(
- "http://www.google.com"))));
+ builder.SetManifest(
+ DictionaryBuilder()
+ .Set("name", std::string("Extension " + index))
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("chrome_settings_overrides",
+ DictionaryBuilder().Set("startup_pages",
+ std::move(ListBuilder().Append(
+ "http://www.google.com")))));
builder.SetLocation(location);
builder.SetID(id);
service_->AddExtension(builder.Build().get());
@@ -242,12 +244,12 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest {
const std::string& id,
Manifest::Location location) {
ExtensionBuilder builder;
- builder.SetManifest(DictionaryBuilder()
- .Set("name", std::string("Extension " + index))
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Set("permissions",
- ListBuilder().Append("proxy")));
+ builder.SetManifest(
+ DictionaryBuilder()
+ .Set("name", std::string("Extension " + index))
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("permissions", std::move(ListBuilder().Append("proxy"))));
builder.SetLocation(location);
builder.SetID(id);
diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc
index b41fe0c..1a50b17 100644
--- a/chrome/browser/extensions/extension_service_sync_unittest.cc
+++ b/chrome/browser/extensions/extension_service_sync_unittest.cc
@@ -4,6 +4,7 @@
#include <map>
#include <string>
+#include <utility>
#include "base/bind.h"
#include "base/command_line.h"
@@ -1800,16 +1801,17 @@ TEST_F(ExtensionServiceSyncTest, SyncExtensionHasAllhostsWithheld) {
const std::string kName("extension");
scoped_refptr<const Extension> extension =
extensions::ExtensionBuilder()
- .SetLocation(Manifest::INTERNAL)
- .SetManifest(
- extensions::DictionaryBuilder()
- .Set("name", kName)
- .Set("description", "foo")
- .Set("manifest_version", 2)
- .Set("version", "1.0")
- .Set("permissions", extensions::ListBuilder().Append("*://*/*")))
- .SetID(crx_file::id_util::GenerateId(kName))
- .Build();
+ .SetLocation(Manifest::INTERNAL)
+ .SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", kName)
+ .Set("description", "foo")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0")
+ .Set("permissions",
+ std::move(extensions::ListBuilder().Append("*://*/*"))))
+ .SetID(crx_file::id_util::GenerateId(kName))
+ .Build();
// Install and enable it.
service()->AddExtension(extension.get());
diff --git a/chrome/browser/extensions/location_bar_controller_unittest.cc b/chrome/browser/extensions/location_bar_controller_unittest.cc
index dfc4c43..e89db7b 100644
--- a/chrome/browser/extensions/location_bar_controller_unittest.cc
+++ b/chrome/browser/extensions/location_bar_controller_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <string>
+#include <utility>
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
@@ -69,9 +70,9 @@ class LocationBarControllerUnitTest : public ChromeRenderViewHostTestHarness {
const std::string& name) {
DictionaryBuilder manifest;
manifest.Set("name", name)
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("permissions", ListBuilder().Append("tabs"));
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("permissions", std::move(ListBuilder().Append("tabs")));
if (has_page_actions) {
manifest.Set("page_action", DictionaryBuilder()
.Set("default_title", "Hello"));
diff --git a/chrome/browser/extensions/permission_messages_unittest.cc b/chrome/browser/extensions/permission_messages_unittest.cc
index 895bc2d..c2a9530 100644
--- a/chrome/browser/extensions/permission_messages_unittest.cc
+++ b/chrome/browser/extensions/permission_messages_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/memory/scoped_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -48,13 +50,14 @@ class PermissionMessagesUnittest : public testing::Test {
~PermissionMessagesUnittest() override {}
protected:
- void CreateAndInstallAppWithPermissions(ListBuilder& required_permissions,
- ListBuilder& optional_permissions) {
+ void CreateAndInstallAppWithPermissions(ListBuilder required_permissions,
+ ListBuilder optional_permissions) {
app_ = test_util::BuildApp(ExtensionBuilder().Pass())
.MergeManifest(
- DictionaryBuilder()
- .Set("permissions", required_permissions)
- .Set("optional_permissions", optional_permissions))
+ DictionaryBuilder()
+ .Set("permissions", std::move(required_permissions))
+ .Set("optional_permissions",
+ std::move(optional_permissions)))
.SetID(crx_file::id_util::GenerateId("app"))
.SetLocation(Manifest::INTERNAL)
.Build();
@@ -62,13 +65,14 @@ class PermissionMessagesUnittest : public testing::Test {
}
void CreateAndInstallExtensionWithPermissions(
- ListBuilder& required_permissions,
- ListBuilder& optional_permissions) {
+ ListBuilder required_permissions,
+ ListBuilder optional_permissions) {
app_ = test_util::BuildExtension(ExtensionBuilder().Pass())
.MergeManifest(
- DictionaryBuilder()
- .Set("permissions", required_permissions)
- .Set("optional_permissions", optional_permissions))
+ DictionaryBuilder()
+ .Set("permissions", std::move(required_permissions))
+ .Set("optional_permissions",
+ std::move(optional_permissions)))
.SetID(crx_file::id_util::GenerateId("extension"))
.SetLocation(Manifest::INTERNAL)
.Build();
@@ -129,8 +133,7 @@ class PermissionMessagesUnittest : public testing::Test {
// other (the 'history' permission has superset permissions).
TEST_F(PermissionMessagesUnittest, HistoryHidesTabsMessage) {
CreateAndInstallExtensionWithPermissions(
- ListBuilder().Append("tabs").Append("history").Pass(),
- ListBuilder().Pass());
+ std::move(ListBuilder().Append("tabs").Append("history")), ListBuilder());
ASSERT_EQ(1U, required_permissions().size());
EXPECT_EQ(
@@ -144,8 +147,8 @@ TEST_F(PermissionMessagesUnittest, HistoryHidesTabsMessage) {
// permission, only the new coalesced message is displayed.
TEST_F(PermissionMessagesUnittest, MixedPermissionMessagesCoalesceOnceGranted) {
CreateAndInstallExtensionWithPermissions(
- ListBuilder().Append("tabs").Pass(),
- ListBuilder().Append("history").Pass());
+ std::move(ListBuilder().Append("tabs")),
+ std::move(ListBuilder().Append("history")));
ASSERT_EQ(1U, required_permissions().size());
EXPECT_EQ(
@@ -183,8 +186,8 @@ TEST_F(PermissionMessagesUnittest, MixedPermissionMessagesCoalesceOnceGranted) {
TEST_F(PermissionMessagesUnittest,
AntiTest_PromptCanRequestSubsetOfAlreadyGrantedPermissions) {
CreateAndInstallExtensionWithPermissions(
- ListBuilder().Append("history").Pass(),
- ListBuilder().Append("tabs").Pass());
+ std::move(ListBuilder().Append("history")),
+ std::move(ListBuilder().Append("tabs")));
ASSERT_EQ(1U, required_permissions().size());
EXPECT_EQ(
@@ -224,8 +227,8 @@ TEST_F(PermissionMessagesUnittest,
TEST_F(PermissionMessagesUnittest,
AntiTest_PromptCanBeEmptyButCausesChangeInPermissions) {
CreateAndInstallExtensionWithPermissions(
- ListBuilder().Append("tabs").Pass(),
- ListBuilder().Append("sessions").Pass());
+ std::move(ListBuilder().Append("tabs")),
+ std::move(ListBuilder().Append("sessions")));
ASSERT_EQ(1U, required_permissions().size());
EXPECT_EQ(
diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc
index d1e3013..ea8626c 100644
--- a/chrome/browser/extensions/process_manager_browsertest.cc
+++ b/chrome/browser/extensions/process_manager_browsertest.cc
@@ -102,9 +102,10 @@ class ProcessManagerBrowserTest : public ExtensionBrowserTest {
// To allow ExecuteScript* to work.
.Set("content_security_policy",
"script-src 'self' 'unsafe-eval'; object-src 'self'")
- .Set("sandbox", DictionaryBuilder().Set(
- "pages", ListBuilder().Append("sandboxed.html")))
- .Set("web_accessible_resources", ListBuilder().Append("*"));
+ .Set("sandbox",
+ DictionaryBuilder().Set(
+ "pages", std::move(ListBuilder().Append("sandboxed.html"))))
+ .Set("web_accessible_resources", std::move(ListBuilder().Append("*")));
if (has_background_process) {
manifest.Set("background", DictionaryBuilder().Set("page", "bg.html"));
diff --git a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc
index 1b1a71d..6b37a5d 100644
--- a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc
+++ b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/strings/stringprintf.h"
#include "chrome/browser/extensions/extension_service_test_base.h"
#include "chrome/browser/extensions/extension_util.h"
@@ -40,19 +42,19 @@ scoped_refptr<const Extension> CreateExtensionWithPermissions(
}
DictionaryBuilder script;
- script.Set("matches", scriptable_host_list.Pass())
- .Set("js", ListBuilder().Append("foo.js"));
+ script.Set("matches", std::move(scriptable_host_list))
+ .Set("js", std::move(ListBuilder().Append("foo.js")));
return ExtensionBuilder()
.SetLocation(location)
- .SetManifest(
- DictionaryBuilder()
- .Set("name", name)
- .Set("description", "foo")
- .Set("manifest_version", 2)
- .Set("version", "0.1.2.3")
- .Set("content_scripts", ListBuilder().Append(script.Pass()))
- .Set("permissions", explicit_host_list.Pass()))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", name)
+ .Set("description", "foo")
+ .Set("manifest_version", 2)
+ .Set("version", "0.1.2.3")
+ .Set("content_scripts",
+ std::move(ListBuilder().Append(script.Pass())))
+ .Set("permissions", std::move(explicit_host_list)))
.SetID(crx_file::id_util::GenerateId(name))
.Build();
}
diff --git a/chrome/browser/extensions/shared_module_service_unittest.cc b/chrome/browser/extensions/shared_module_service_unittest.cc
index 79baa35..0f1d1e3 100644
--- a/chrome/browser/extensions/shared_module_service_unittest.cc
+++ b/chrome/browser/extensions/shared_module_service_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/extensions/shared_module_service.h"
+#include <utility>
+
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
@@ -36,8 +38,8 @@ scoped_refptr<Extension> CreateExtensionImportingModule(
.Set("version", version)
.Set("manifest_version", 2);
if (!import_id.empty()) {
- builder.Set("import",
- ListBuilder().Append(DictionaryBuilder().Set("id", import_id)));
+ builder.Set("import", std::move(ListBuilder().Append(
+ DictionaryBuilder().Set("id", import_id))));
}
scoped_ptr<base::DictionaryValue> manifest = builder.Build();
@@ -128,8 +130,9 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUninstall) {
.Set("version", "1.0")
.Set("manifest_version", 2)
.Set("export",
- DictionaryBuilder().Set("resources",
- ListBuilder().Append("foo.js"))).Build();
+ DictionaryBuilder().Set(
+ "resources", std::move(ListBuilder().Append("foo.js"))))
+ .Build();
scoped_refptr<Extension> shared_module =
ExtensionBuilder()
.SetManifest(manifest.Pass())
@@ -168,8 +171,9 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUpdate) {
.Set("version", "1.0")
.Set("manifest_version", 2)
.Set("export",
- DictionaryBuilder().Set("resources",
- ListBuilder().Append("foo.js"))).Build();
+ DictionaryBuilder().Set(
+ "resources", std::move(ListBuilder().Append("foo.js"))))
+ .Build();
scoped_refptr<Extension> shared_module_1 =
ExtensionBuilder()
.SetManifest(manifest_1.Pass())
@@ -184,8 +188,9 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUpdate) {
.Set("version", "1.0")
.Set("manifest_version", 2)
.Set("export",
- DictionaryBuilder().Set("resources",
- ListBuilder().Append("foo.js"))).Build();
+ DictionaryBuilder().Set(
+ "resources", std::move(ListBuilder().Append("foo.js"))))
+ .Build();
scoped_refptr<Extension> shared_module_2 =
ExtensionBuilder()
.SetManifest(manifest_2.Pass())
@@ -244,11 +249,11 @@ TEST_F(SharedModuleServiceUnitTest, WhitelistedImports) {
.Set("version", "1.0")
.Set("manifest_version", 2)
.Set("export",
- DictionaryBuilder().Set("whitelist",
- ListBuilder()
- .Append(whitelisted_id))
- .Set("resources",
- ListBuilder().Append("*"))).Build();
+ DictionaryBuilder()
+ .Set("whitelist",
+ std::move(ListBuilder().Append(whitelisted_id)))
+ .Set("resources", std::move(ListBuilder().Append("*"))))
+ .Build();
scoped_refptr<Extension> shared_module =
ExtensionBuilder()
.SetManifest(manifest.Pass())
diff --git a/chrome/browser/extensions/test_extension_environment.cc b/chrome/browser/extensions/test_extension_environment.cc
index 7044795..b9c80bc 100644
--- a/chrome/browser/extensions/test_extension_environment.cc
+++ b/chrome/browser/extensions/test_extension_environment.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/extensions/test_extension_environment.h"
+#include <utility>
+
#include "base/command_line.h"
#include "base/json/json_writer.h"
#include "base/run_loop.h"
@@ -59,8 +61,8 @@ scoped_ptr<base::DictionaryValue> MakePackagedAppManifest() {
.Set("app", extensions::DictionaryBuilder().Set(
"background",
extensions::DictionaryBuilder().Set(
- "scripts",
- extensions::ListBuilder().Append("background.js"))))
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
.Build();
}
diff --git a/chrome/browser/extensions/webstore_installer_browsertest.cc b/chrome/browser/extensions/webstore_installer_browsertest.cc
index a4cfca8..3a77e3c 100644
--- a/chrome/browser/extensions/webstore_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_installer_browsertest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/extensions/webstore_installer.h"
+#include <utility>
+
#include "base/bind.h"
#include "base/run_loop.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -112,13 +114,13 @@ void WebstoreInstallerBrowserTest::OnExtensionInstallFailure(
IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, WebstoreInstall) {
scoped_ptr<base::DictionaryValue> manifest(
- DictionaryBuilder().Set("name", kExtensionName)
- .Set("description", "Foo")
- .Set("manifest_version", 2)
- .Set("version", "1.0")
- .Set("permissions",
- ListBuilder().Append("tabs"))
- .Build());
+ DictionaryBuilder()
+ .Set("name", kExtensionName)
+ .Set("description", "Foo")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0")
+ .Set("permissions", std::move(ListBuilder().Append("tabs")))
+ .Build());
content::WebContents* active_web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
@@ -153,13 +155,13 @@ IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, WebstoreInstall) {
IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, SimultaneousInstall) {
scoped_ptr<base::DictionaryValue> manifest(
- DictionaryBuilder().Set("name", kExtensionName)
- .Set("description", "Foo")
- .Set("manifest_version", 2)
- .Set("version", "1.0")
- .Set("permissions",
- ListBuilder().Append("tabs"))
- .Build());
+ DictionaryBuilder()
+ .Set("name", kExtensionName)
+ .Set("description", "Foo")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0")
+ .Set("permissions", std::move(ListBuilder().Append("tabs")))
+ .Build());
content::WebContents* active_web_contents =
browser()->tab_strip_model()->GetActiveWebContents();
diff --git a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
index e87138e..badcddc 100644
--- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
+++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/command_line.h"
#include "base/scoped_observer.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -136,16 +138,20 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallFromHostedApp) {
// We're forced to construct a hosted app dynamically because we need the
// app to run on a declared URL, but we don't know the port ahead of time.
- scoped_refptr<const Extension> hosted_app = ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "hosted app")
- .Set("version", "1")
- .Set("app", DictionaryBuilder()
- .Set("urls", ListBuilder().Append(kInstallUrl.spec()))
- .Set("launch", DictionaryBuilder()
- .Set("web_url", kInstallUrl.spec())))
- .Set("manifest_version", 2))
- .Build();
+ scoped_refptr<const Extension> hosted_app =
+ ExtensionBuilder()
+ .SetManifest(
+ DictionaryBuilder()
+ .Set("name", "hosted app")
+ .Set("version", "1")
+ .Set("app",
+ DictionaryBuilder()
+ .Set("urls", std::move(ListBuilder().Append(
+ kInstallUrl.spec())))
+ .Set("launch", DictionaryBuilder().Set(
+ "web_url", kInstallUrl.spec())))
+ .Set("manifest_version", 2))
+ .Build();
ASSERT_TRUE(hosted_app.get());
ExtensionService* extension_service =
diff --git a/chrome/browser/notifications/message_center_settings_controller_unittest.cc b/chrome/browser/notifications/message_center_settings_controller_unittest.cc
index cb5dc53..225c7d9 100644
--- a/chrome/browser/notifications/message_center_settings_controller_unittest.cc
+++ b/chrome/browser/notifications/message_center_settings_controller_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <string>
+#include <utility>
#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
@@ -205,13 +206,14 @@ TEST_F(MessageCenterSettingsControllerTest, NotifierSortOrder) {
.Set("name", "Foo")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("app", extensions::DictionaryBuilder().Set(
- "background",
- extensions::DictionaryBuilder().Set(
- "scripts", extensions::ListBuilder().Append(
- "background.js"))))
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
.Set("permissions",
- extensions::ListBuilder().Append("notifications")));
+ std::move(extensions::ListBuilder().Append("notifications"))));
foo_app.SetID(kFooId);
extension_service->AddExtension(foo_app.Build().get());
@@ -221,13 +223,14 @@ TEST_F(MessageCenterSettingsControllerTest, NotifierSortOrder) {
.Set("name", "Bar")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("app", extensions::DictionaryBuilder().Set(
- "background",
- extensions::DictionaryBuilder().Set(
- "scripts", extensions::ListBuilder().Append(
- "background.js"))))
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
.Set("permissions",
- extensions::ListBuilder().Append("notifications")));
+ std::move(extensions::ListBuilder().Append("notifications"))));
bar_app.SetID(kBarId);
extension_service->AddExtension(bar_app.Build().get());
@@ -237,11 +240,12 @@ TEST_F(MessageCenterSettingsControllerTest, NotifierSortOrder) {
.Set("name", "baz")
.Set("version", "1.0.0")
.Set("manifest_version", 2)
- .Set("app", extensions::DictionaryBuilder().Set(
- "background",
- extensions::DictionaryBuilder().Set(
- "scripts", extensions::ListBuilder().Append(
- "background.js")))));
+ .Set("app",
+ extensions::DictionaryBuilder().Set(
+ "background",
+ extensions::DictionaryBuilder().Set(
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js"))))));
baz_app.SetID(kBazId);
extension_service->AddExtension(baz_app.Build().get());
@@ -254,13 +258,13 @@ TEST_F(MessageCenterSettingsControllerTest, NotifierSortOrder) {
.Set("app",
extensions::DictionaryBuilder().Set(
"urls",
- extensions::ListBuilder().Append(
- "http://localhost/extensions/hosted_app/main.html")))
+ std::move(extensions::ListBuilder().Append(
+ "http://localhost/extensions/hosted_app/main.html"))))
.Set("launch",
extensions::DictionaryBuilder().Set(
"urls",
- extensions::ListBuilder().Append(
- "http://localhost/extensions/hosted_app/main.html"))));
+ std::move(extensions::ListBuilder().Append(
+ "http://localhost/extensions/hosted_app/main.html")))));
baf_app.SetID(kBafId);
extension_service->AddExtension(baf_app.Build().get());
diff --git a/chrome/browser/notifications/platform_notification_service_unittest.cc b/chrome/browser/notifications/platform_notification_service_unittest.cc
index 1429d6d..06c9066 100644
--- a/chrome/browser/notifications/platform_notification_service_unittest.cc
+++ b/chrome/browser/notifications/platform_notification_service_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
#include "base/time/time.h"
@@ -331,8 +333,9 @@ TEST_F(PlatformNotificationServiceTest, ExtensionPermissionChecks) {
.Set("version", "1.0")
.Set("manifest_version", 2)
.Set("description", "Test Extension")
- .Set("permissions", extensions::ListBuilder().Append(
- "notifications")))
+ .Set("permissions",
+ std::move(extensions::ListBuilder().Append(
+ "notifications"))))
.Build();
// Install the extension on the faked extension service, and verify that it
diff --git a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc
index 5009731..1105262 100644
--- a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc
+++ b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/json/json_reader.h"
#include "chrome/browser/policy/managed_bookmarks_policy_handler.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
@@ -79,31 +81,39 @@ TEST_F(ManagedBookmarksPolicyHandlerTest, ApplyPolicySettings) {
scoped_ptr<base::Value> expected(
extensions::ListBuilder()
.Append(extensions::DictionaryBuilder()
- .Set("name", "Google")
- .Set("url", "http://google.com/"))
- .Append(extensions::DictionaryBuilder()
- .Set("name", "Empty Folder")
- .Set("children", extensions::ListBuilder().Pass()))
+ .Set("name", "Google")
+ .Set("url", "http://google.com/"))
.Append(extensions::DictionaryBuilder()
- .Set("name", "Big Folder")
- .Set("children", extensions::ListBuilder()
- .Append(extensions::DictionaryBuilder()
- .Set("name", "Youtube")
- .Set("url", "http://youtube.com/"))
- .Append(extensions::DictionaryBuilder()
- .Set("name", "Chromium")
- .Set("url", "http://chromium.org/"))
- .Append(extensions::DictionaryBuilder()
- .Set("name", "More Stuff")
- .Set("children", extensions::ListBuilder()
- .Append(extensions::DictionaryBuilder()
- .Set("name", "Bugs")
- .Set("url", "http://crbug.com/")
- .Pass())
- .Pass())
- .Pass())
+ .Set("name", "Empty Folder")
+ .Set("children", extensions::ListBuilder()))
+ .Append(
+ extensions::DictionaryBuilder()
+ .Set("name", "Big Folder")
+ .Set(
+ "children",
+ std::move(
+ extensions::ListBuilder()
+ .Append(extensions::DictionaryBuilder()
+ .Set("name", "Youtube")
+ .Set("url", "http://youtube.com/"))
+ .Append(extensions::DictionaryBuilder()
+ .Set("name", "Chromium")
+ .Set("url", "http://chromium.org/"))
+ .Append(
+ extensions::DictionaryBuilder()
+ .Set("name", "More Stuff")
+ .Set("children",
+ std::move(
+ extensions::ListBuilder().Append(
+ extensions::
+ DictionaryBuilder()
+ .Set("name", "Bugs")
+ .Set("url",
+ "http://"
+ "crbug.com/")
+ .Pass())))
+ .Pass())))
.Pass())
- .Pass())
.Build());
EXPECT_TRUE(pref_value->Equals(expected.get()));
}
diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc
index 7c24045..c871e1e 100644
--- a/chrome/browser/site_details_browsertest.cc
+++ b/chrome/browser/site_details_browsertest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/site_details.h"
+#include <utility>
+
#include "base/bind_helpers.h"
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
@@ -119,15 +121,17 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest {
manifest.Set("name", name)
.Set("version", "1.0")
.Set("manifest_version", 2)
- .Set("web_accessible_resources", ListBuilder()
- .Append("blank_iframe.html")
- .Append("http_iframe.html")
- .Append("two_http_iframes.html"));
+ .Set("web_accessible_resources",
+ std::move(ListBuilder()
+ .Append("blank_iframe.html")
+ .Append("http_iframe.html")
+ .Append("two_http_iframes.html")));
if (has_background_process) {
- manifest.Set("background",
- DictionaryBuilder().Set("scripts",
- ListBuilder().Append("script.js")));
+ manifest.Set(
+ "background",
+ DictionaryBuilder().Set(
+ "scripts", std::move(ListBuilder().Append("script.js"))));
dir->WriteFile(FILE_PATH_LITERAL("script.js"),
"console.log('" + name + " running');");
}
@@ -174,10 +178,11 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest {
manifest.Set("name", name)
.Set("version", "1.0")
.Set("manifest_version", 2)
- .Set("app", DictionaryBuilder()
- .Set("urls", ListBuilder().Append(app_url.spec()))
- .Set("launch", DictionaryBuilder().Set(
- "web_url", app_url.spec())));
+ .Set("app",
+ DictionaryBuilder()
+ .Set("urls", std::move(ListBuilder().Append(app_url.spec())))
+ .Set("launch",
+ DictionaryBuilder().Set("web_url", app_url.spec())));
dir->WriteManifest(manifest.ToJSON());
const Extension* extension = LoadExtension(dir->unpacked_path());
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc
index cbf5b820..439ce7d 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel_unittest.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.h"
+#include <utility>
+
#include "apps/saved_files_service.h"
#include "base/callback.h"
#include "base/memory/scoped_ptr.h"
@@ -46,8 +48,8 @@ class AppInfoPermissionsPanelTest : public testing::Test {
extensions::DictionaryBuilder().Set(
"background",
extensions::DictionaryBuilder().Set(
- "scripts",
- extensions::ListBuilder().Append("background.js"))))
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js")))))
.Build();
}
@@ -77,14 +79,15 @@ TEST_F(AppInfoPermissionsPanelTest, RequiredPermissionsObtainedCorrectly) {
.SetManifest(ValidAppManifest())
.MergeManifest(extensions::DictionaryBuilder().Set(
"permissions",
- extensions::ListBuilder()
- .Append("desktopCapture") // A valid permission with a
- // message
- .Append("bad_perm") // An invalid permission
- .Append("notifications") // An valid permission with
- // no message
- .Append("serial"))) // Another valid permission with
- // a message
+ std::move(
+ extensions::ListBuilder()
+ .Append("desktopCapture") // A valid permission with a
+ // message
+ .Append("bad_perm") // An invalid permission
+ .Append("notifications") // An valid permission with
+ // no message
+ .Append("serial")))) // Another valid permission with
+ // a message
.SetID(kTestExtensionId)
.Build();
AppInfoPermissionsPanel panel(&profile_, app.get());
@@ -104,14 +107,15 @@ TEST_F(AppInfoPermissionsPanelTest, OptionalPermissionsObtainedCorrectly) {
.SetManifest(ValidAppManifest())
.MergeManifest(extensions::DictionaryBuilder().Set(
"optional_permissions",
- extensions::ListBuilder()
- .Append("clipboardRead") // A valid permission with a
- // message
- .Append("bad_perm") // An invalid permission
- .Append("idle") // A valid permission with
- // no message
- .Append("serial"))) // Another valid permission with
- // a message
+ std::move(
+ extensions::ListBuilder()
+ .Append("clipboardRead") // A valid permission with a
+ // message
+ .Append("bad_perm") // An invalid permission
+ .Append("idle") // A valid permission with
+ // no message
+ .Append("serial")))) // Another valid permission with
+ // a message
.SetID(kTestExtensionId)
.Build();
AppInfoPermissionsPanel panel(&profile_, app.get());
@@ -131,10 +135,10 @@ TEST_F(AppInfoPermissionsPanelTest, RetainedFilePermissionsObtainedCorrectly) {
.SetManifest(ValidAppManifest())
.MergeManifest(extensions::DictionaryBuilder().Set(
"permissions",
- extensions::ListBuilder().Append(
+ std::move(extensions::ListBuilder().Append(
extensions::DictionaryBuilder().Set(
- "fileSystem",
- extensions::ListBuilder().Append("retainEntries")))))
+ "fileSystem", std::move(extensions::ListBuilder().Append(
+ "retainEntries")))))))
.SetID(kTestExtensionId)
.Build();
AppInfoPermissionsPanel panel(&profile_, app.get());
diff --git a/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc b/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc
index 12d065c..05c2e1a 100644
--- a/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include <string>
+#include <utility>
#include "base/command_line.h"
#include "base/macros.h"
@@ -63,12 +64,13 @@ IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, HistoryOverride) {
scoped_refptr<const extensions::Extension> extension =
extensions::ExtensionBuilder()
- .SetManifest(extensions::DictionaryBuilder()
- .Set("name", "History Override")
- .Set("version", "1")
- .Set("manifest_version", 2)
- .Set("permission",
- extensions::ListBuilder().Append("history")))
+ .SetManifest(
+ extensions::DictionaryBuilder()
+ .Set("name", "History Override")
+ .Set("version", "1")
+ .Set("manifest_version", 2)
+ .Set("permission",
+ std::move(extensions::ListBuilder().Append("history"))))
.Build();
ExtensionService* service = extensions::ExtensionSystem::Get(
diff --git a/chrome/common/extensions/api/common_extension_api_unittest.cc b/chrome/common/extensions/api/common_extension_api_unittest.cc
index f858062..d306d80 100644
--- a/chrome/common/extensions/api/common_extension_api_unittest.cc
+++ b/chrome/common/extensions/api/common_extension_api_unittest.cc
@@ -5,6 +5,7 @@
#include "extensions/common/extension_api.h"
#include <string>
+#include <utility>
#include <vector>
#include "base/files/file_path.h"
@@ -199,14 +200,19 @@ TEST(ExtensionAPITest, APIFeatures) {
}
TEST(ExtensionAPITest, IsAnyFeatureAvailableToContext) {
- scoped_refptr<const Extension> app = ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "app")
- .Set("app", DictionaryBuilder()
- .Set("background", DictionaryBuilder()
- .Set("scripts", ListBuilder().Append("background.js"))))
- .Set("version", "1")
- .Set("manifest_version", 2)).Build();
+ scoped_refptr<const Extension> app =
+ ExtensionBuilder()
+ .SetManifest(
+ DictionaryBuilder()
+ .Set("name", "app")
+ .Set("app", DictionaryBuilder().Set(
+ "background",
+ DictionaryBuilder().Set(
+ "scripts", std::move(ListBuilder().Append(
+ "background.js")))))
+ .Set("version", "1")
+ .Set("manifest_version", 2))
+ .Build();
scoped_refptr<const Extension> extension = ExtensionBuilder()
.SetManifest(DictionaryBuilder()
.Set("name", "extension")
diff --git a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc
index 9493700..11886ad 100644
--- a/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc
+++ b/chrome/common/extensions/api/file_browser_handlers/file_browser_handler_manifest_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/strings/string_number_conversions.h"
#include "chrome/common/extensions/api/file_browser_handlers/file_browser_handler.h"
#include "chrome/common/extensions/manifest_tests/chrome_manifest_test.h"
@@ -34,13 +36,14 @@ TEST_F(FileBrowserHandlerManifestTest, GetHandlersRequiresPermission) {
.Set("version", "1.0.0")
.Set("manifest_version", 2)
.Set("file_browser_handlers",
- extensions::ListBuilder().Append(
+ std::move(extensions::ListBuilder().Append(
extensions::DictionaryBuilder()
.Set("id", "open")
.Set("default_title", "open")
- .Set("file_filters", extensions::ListBuilder()
- .Append("filesystem:*.txt")
- .Append("filesystem:*.html"))));
+ .Set("file_filters",
+ std::move(extensions::ListBuilder()
+ .Append("filesystem:*.txt")
+ .Append("filesystem:*.html"))))));
scoped_ptr<base::DictionaryValue> bad_manifest_value(
bad_manifest_builder.Build());
@@ -49,7 +52,8 @@ TEST_F(FileBrowserHandlerManifestTest, GetHandlersRequiresPermission) {
extensions::DictionaryBuilder good_manifest_builder(
*make_scoped_ptr(bad_manifest_value->DeepCopy()).get());
good_manifest_builder.Set(
- "permissions", extensions::ListBuilder().Append("fileBrowserHandler"));
+ "permissions",
+ std::move(extensions::ListBuilder().Append("fileBrowserHandler")));
extensions::ExtensionBuilder bad_app_builder;
bad_app_builder.SetManifest(bad_manifest_value.Pass());
@@ -98,21 +102,22 @@ TEST_F(FileBrowserHandlerManifestTest, InvalidFileBrowserHandlers) {
TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandler) {
scoped_refptr<const Extension> extension =
ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "file browser handler test")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
- .Set("file_browser_handlers",
- ListBuilder().Append(
- DictionaryBuilder()
- .Set("id", "ExtremelyCoolAction")
- .Set("default_title", "Be Amazed")
- .Set("default_icon", "icon.png")
- .Set("file_filters", ListBuilder().Append(
- "filesystem:*.txt")))))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "file browser handler test")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("permissions",
+ std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
+ .Set("file_browser_handlers",
+ std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("id", "ExtremelyCoolAction")
+ .Set("default_title", "Be Amazed")
+ .Set("default_icon", "icon.png")
+ .Set("file_filters",
+ std::move(ListBuilder().Append(
+ "filesystem:*.txt")))))))
.Build();
ASSERT_TRUE(extension.get());
@@ -138,21 +143,22 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerMIMETypes) {
scoped_refptr<const Extension> extension =
ExtensionBuilder()
.SetID(extension_misc::kQuickOfficeExtensionId)
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "file browser handler test")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
- .Set("file_browser_handlers",
- ListBuilder().Append(
- DictionaryBuilder()
- .Set("id", "ID")
- .Set("default_title", "Default title")
- .Set("default_icon", "icon.png")
- .Set("file_filters", ListBuilder().Append(
- "filesystem:*.txt")))))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "file browser handler test")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("permissions",
+ std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
+ .Set("file_browser_handlers",
+ std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("id", "ID")
+ .Set("default_title", "Default title")
+ .Set("default_icon", "icon.png")
+ .Set("file_filters",
+ std::move(ListBuilder().Append(
+ "filesystem:*.txt")))))))
.Build();
ASSERT_TRUE(extension.get());
@@ -171,23 +177,25 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerMIMETypes) {
TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerWithCreate) {
scoped_refptr<const Extension> extension =
ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "file browser handler test create")
- .Set("version", "1.0.0")
- .Set("manifest_version", 2)
- .Set("permissions",
- extensions::ListBuilder().Append("fileBrowserHandler"))
- .Set("file_browser_handlers",
- ListBuilder().Append(
- DictionaryBuilder()
- .Set("id", "ID")
- .Set("default_title", "Default title")
- .Set("default_icon", "icon.png")
- .Set("file_filters",
- ListBuilder().Append("filesystem:*.txt"))
- .Set("file_access",
- ListBuilder().Append("create")))))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "file browser handler test create")
+ .Set("version", "1.0.0")
+ .Set("manifest_version", 2)
+ .Set("permissions",
+ std::move(extensions::ListBuilder().Append(
+ "fileBrowserHandler")))
+ .Set("file_browser_handlers",
+ std::move(ListBuilder().Append(
+ DictionaryBuilder()
+ .Set("id", "ID")
+ .Set("default_title", "Default title")
+ .Set("default_icon", "icon.png")
+ .Set("file_filters",
+ std::move(ListBuilder().Append(
+ "filesystem:*.txt")))
+ .Set("file_access",
+ std::move(ListBuilder().Append(
+ "create")))))))
.Build();
ASSERT_TRUE(extension.get());
diff --git a/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc b/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc
index 061bda4..10540a3 100644
--- a/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc
+++ b/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/common/extensions/features/chrome_channel_feature_filter.h"
#include <string>
+#include <utility>
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
@@ -177,12 +178,17 @@ TEST_F(ChromeChannelFeatureFilterTest, SimpleFeatureAvailability) {
scoped_ptr<base::DictionaryValue> rule(
DictionaryBuilder()
.Set("feature1",
- ListBuilder()
- .Append(DictionaryBuilder().Set("channel", "beta").Set(
- "extension_types", ListBuilder().Append("extension")))
- .Append(DictionaryBuilder().Set("channel", "beta").Set(
- "extension_types",
- ListBuilder().Append("legacy_packaged_app"))))
+ std::move(ListBuilder()
+ .Append(DictionaryBuilder()
+ .Set("channel", "beta")
+ .Set("extension_types",
+ std::move(ListBuilder().Append(
+ "extension"))))
+ .Append(DictionaryBuilder()
+ .Set("channel", "beta")
+ .Set("extension_types",
+ std::move(ListBuilder().Append(
+ "legacy_packaged_app"))))))
.Build());
scoped_ptr<BaseFeatureProvider> provider(
@@ -234,18 +240,18 @@ TEST_F(ChromeChannelFeatureFilterTest, ComplexFeatureAvailability) {
scoped_ptr<base::DictionaryValue> rule(
DictionaryBuilder()
.Set("channel", "trunk")
- .Set("extension_types", ListBuilder().Append("extension"))
+ .Set("extension_types", std::move(ListBuilder().Append("extension")))
.Build());
simple_feature->Parse(rule.get());
features->push_back(simple_feature.Pass());
// Rule: "legacy_packaged_app", channel stable.
simple_feature.reset(CreateFeature<SimpleFeature>());
- rule =
- DictionaryBuilder()
- .Set("channel", "stable")
- .Set("extension_types", ListBuilder().Append("legacy_packaged_app"))
- .Build();
+ rule = DictionaryBuilder()
+ .Set("channel", "stable")
+ .Set("extension_types",
+ std::move(ListBuilder().Append("legacy_packaged_app")))
+ .Build();
simple_feature->Parse(rule.get());
features->push_back(simple_feature.Pass());
diff --git a/chrome/common/extensions/permissions/permission_set_unittest.cc b/chrome/common/extensions/permissions/permission_set_unittest.cc
index 7948607..70b5f66 100644
--- a/chrome/common/extensions/permissions/permission_set_unittest.cc
+++ b/chrome/common/extensions/permissions/permission_set_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/command_line.h"
#include "base/json/json_file_value_serializer.h"
#include "base/logging.h"
@@ -1299,11 +1301,12 @@ TEST(PermissionsTest, GetWarningMessages_PlatformAppHosts) {
testing::AssertionResult ShowsAllHostsWarning(const std::string& pattern) {
scoped_refptr<Extension> extension =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "TLDWildCardTest")
- .Set("version", "0.1.0")
- .Set("permissions", ListBuilder().Append(pattern))
- .Build())
+ .SetManifest(
+ DictionaryBuilder()
+ .Set("name", "TLDWildCardTest")
+ .Set("version", "0.1.0")
+ .Set("permissions", std::move(ListBuilder().Append(pattern)))
+ .Build())
.Build();
return VerifyHasPermissionMessage(
diff --git a/chrome/common/extensions/permissions/permissions_data_unittest.cc b/chrome/common/extensions/permissions/permissions_data_unittest.cc
index 620fb8b..c2cc98e 100644
--- a/chrome/common/extensions/permissions/permissions_data_unittest.cc
+++ b/chrome/common/extensions/permissions/permissions_data_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
#include <vector>
#include "base/command_line.h"
@@ -60,14 +61,13 @@ scoped_refptr<const Extension> GetExtensionWithHostPermission(
permissions.Append(host_permissions);
return ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
- .Set("name", id)
- .Set("description", "an extension")
- .Set("manifest_version", 2)
- .Set("version", "1.0.0")
- .Set("permissions", permissions.Pass())
- .Build())
+ .SetManifest(DictionaryBuilder()
+ .Set("name", id)
+ .Set("description", "an extension")
+ .Set("manifest_version", 2)
+ .Set("version", "1.0.0")
+ .Set("permissions", std::move(permissions))
+ .Build())
.SetLocation(location)
.SetID(id)
.Build();
diff --git a/chrome/common/pepper_permission_util_unittest.cc b/chrome/common/pepper_permission_util_unittest.cc
index 12bab48..7575fa2 100644
--- a/chrome/common/pepper_permission_util_unittest.cc
+++ b/chrome/common/pepper_permission_util_unittest.cc
@@ -6,6 +6,7 @@
#include <set>
#include <string>
+#include <utility>
#include "chrome/common/extensions/features/feature_channel.h"
#include "components/crx_file/id_util.h"
@@ -30,8 +31,8 @@ scoped_refptr<Extension> CreateExtensionImportingModule(
.Set("name", "Has Dependent Modules")
.Set("version", "1.0")
.Set("manifest_version", 2)
- .Set("import",
- ListBuilder().Append(DictionaryBuilder().Set("id", import_id)))
+ .Set("import", std::move(ListBuilder().Append(
+ DictionaryBuilder().Set("id", import_id))))
.Build();
return ExtensionBuilder()
@@ -92,10 +93,11 @@ TEST(PepperPermissionUtilTest, SharedModuleWhitelisting) {
.Set("manifest_version", 2)
.Set("export",
DictionaryBuilder()
- .Set("resources", ListBuilder().Append("*"))
+ .Set("resources", std::move(ListBuilder().Append("*")))
// Add the extension to the whitelist. This
// restricts import to |whitelisted_id| only.
- .Set("whitelist", ListBuilder().Append(whitelisted_id)))
+ .Set("whitelist",
+ std::move(ListBuilder().Append(whitelisted_id))))
.Build();
scoped_refptr<Extension> shared_module =
ExtensionBuilder().SetManifest(shared_module_manifest.Pass()).Build();
diff --git a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc
index a2cee09..1dd8737 100644
--- a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc
+++ b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "base/command_line.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/renderer/extensions/chrome_extensions_dispatcher_delegate.h"
@@ -49,10 +51,11 @@ class RendererPermissionsPolicyDelegateTest : public testing::Test {
scoped_refptr<const Extension> CreateTestExtension(const std::string& id) {
return ExtensionBuilder()
.SetManifest(DictionaryBuilder()
- .Set("name", "Extension with ID " + id)
- .Set("version", "1.0")
- .Set("manifest_version", 2)
- .Set("permissions", ListBuilder().Append("<all_urls>")))
+ .Set("name", "Extension with ID " + id)
+ .Set("version", "1.0")
+ .Set("manifest_version", 2)
+ .Set("permissions",
+ std::move(ListBuilder().Append("<all_urls>"))))
.SetID(id)
.Build();
}
diff --git a/extensions/browser/mojo/keep_alive_impl_unittest.cc b/extensions/browser/mojo/keep_alive_impl_unittest.cc
index 0268358..72e61b36 100644
--- a/extensions/browser/mojo/keep_alive_impl_unittest.cc
+++ b/extensions/browser/mojo/keep_alive_impl_unittest.cc
@@ -4,6 +4,8 @@
#include "extensions/browser/mojo/keep_alive_impl.h"
+#include <utility>
+
#include "base/message_loop/message_loop.h"
#include "base/run_loop.h"
#include "content/public/browser/notification_service.h"
@@ -25,17 +27,16 @@ class KeepAliveTest : public ExtensionsTest {
message_loop_.reset(new base::MessageLoop);
extension_ =
ExtensionBuilder()
- .SetManifest(
- DictionaryBuilder()
- .Set("name", "app")
- .Set("version", "1")
- .Set("manifest_version", 2)
- .Set("app",
- DictionaryBuilder().Set(
- "background",
- DictionaryBuilder().Set(
- "scripts",
- ListBuilder().Append("background.js")))))
+ .SetManifest(DictionaryBuilder()
+ .Set("name", "app")
+ .Set("version", "1")
+ .Set("manifest_version", 2)
+ .Set("app", DictionaryBuilder().Set(
+ "background",
+ DictionaryBuilder().Set(
+ "scripts",
+ std::move(ListBuilder().Append(
+ "background.js"))))))
.SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
.Build();
}
@@ -107,15 +108,15 @@ TEST_F(KeepAliveTest, UnloadExtension) {
scoped_refptr<const Extension> other_extension =
ExtensionBuilder()
.SetManifest(
- DictionaryBuilder()
- .Set("name", "app")
- .Set("version", "1")
- .Set("manifest_version", 2)
- .Set("app", DictionaryBuilder().Set(
- "background",
- DictionaryBuilder().Set(
- "scripts",
- ListBuilder().Append("background.js")))))
+ DictionaryBuilder()
+ .Set("name", "app")
+ .Set("version", "1")
+ .Set("manifest_version", 2)
+ .Set("app", DictionaryBuilder().Set(
+ "background",
+ DictionaryBuilder().Set(
+ "scripts", std::move(ListBuilder().Append(
+ "background.js"))))))
.SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
.Build();
diff --git a/extensions/common/features/base_feature_provider_unittest.cc b/extensions/common/features/base_feature_provider_unittest.cc
index dc41366..30850a3 100644
--- a/extensions/common/features/base_feature_provider_unittest.cc
+++ b/extensions/common/features/base_feature_provider_unittest.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <set>
#include <string>
+#include <utility>
#include "base/stl_util.h"
#include "extensions/common/extension_builder.h"
@@ -99,16 +100,16 @@ TEST(BaseFeatureProviderTest, PermissionFeatureAvailability) {
scoped_refptr<const Extension> app =
ExtensionBuilder()
- .SetManifest(DictionaryBuilder()
- .Set("name", "test app")
- .Set("version", "1")
- .Set("app",
- DictionaryBuilder().Set(
- "background",
- DictionaryBuilder().Set(
- "scripts",
- ListBuilder().Append("background.js"))))
- .Set("permissions", ListBuilder().Append("power")))
+ .SetManifest(
+ DictionaryBuilder()
+ .Set("name", "test app")
+ .Set("version", "1")
+ .Set("app", DictionaryBuilder().Set(
+ "background",
+ DictionaryBuilder().Set(
+ "scripts", std::move(ListBuilder().Append(
+ "background.js")))))
+ .Set("permissions", std::move(ListBuilder().Append("power"))))
.Build();
ASSERT_TRUE(app.get());
ASSERT_TRUE(app->is_platform_app());
diff --git a/extensions/common/features/complex_feature_unittest.cc b/extensions/common/features/complex_feature_unittest.cc
index 54355aa..d06a15a 100644
--- a/extensions/common/features/complex_feature_unittest.cc
+++ b/extensions/common/features/complex_feature_unittest.cc
@@ -5,6 +5,7 @@
#include "extensions/common/features/complex_feature.h"
#include <string>
+#include <utility>
#include "extensions/common/features/simple_feature.h"
#include "extensions/common/manifest.h"
@@ -23,18 +24,19 @@ TEST(ComplexFeatureTest, MultipleRulesWhitelist) {
scoped_ptr<SimpleFeature> simple_feature(new SimpleFeature);
scoped_ptr<base::DictionaryValue> rule(
DictionaryBuilder()
- .Set("whitelist", ListBuilder().Append(kIdFoo))
- .Set("extension_types", ListBuilder()
- .Append("extension")).Build());
+ .Set("whitelist", std::move(ListBuilder().Append(kIdFoo)))
+ .Set("extension_types", std::move(ListBuilder().Append("extension")))
+ .Build());
simple_feature->Parse(rule.get());
features->push_back(simple_feature.Pass());
// Rule: "legacy_packaged_app", whitelist "bar".
simple_feature.reset(new SimpleFeature);
rule = DictionaryBuilder()
- .Set("whitelist", ListBuilder().Append(kIdBar))
- .Set("extension_types", ListBuilder()
- .Append("legacy_packaged_app")).Build();
+ .Set("whitelist", std::move(ListBuilder().Append(kIdBar)))
+ .Set("extension_types",
+ std::move(ListBuilder().Append("legacy_packaged_app")))
+ .Build();
simple_feature->Parse(rule.get());
features->push_back(simple_feature.Pass());
@@ -84,8 +86,8 @@ TEST(ComplexFeatureTest, Dependencies) {
scoped_ptr<SimpleFeature> simple_feature(new SimpleFeature);
scoped_ptr<base::DictionaryValue> rule =
DictionaryBuilder()
- .Set("dependencies",
- ListBuilder().Append("manifest:content_security_policy"))
+ .Set("dependencies", std::move(ListBuilder().Append(
+ "manifest:content_security_policy")))
.Build();
simple_feature->Parse(rule.get());
features->push_back(simple_feature.Pass());
@@ -93,7 +95,8 @@ TEST(ComplexFeatureTest, Dependencies) {
// Rule which depends on an platform-app-only feature (serial).
simple_feature.reset(new SimpleFeature);
rule = DictionaryBuilder()
- .Set("dependencies", ListBuilder().Append("permission:serial"))
+ .Set("dependencies",
+ std::move(ListBuilder().Append("permission:serial")))
.Build();
simple_feature->Parse(rule.get());
features->push_back(simple_feature.Pass());
diff --git a/extensions/common/test_util.cc b/extensions/common/test_util.cc
index dafbca2..9a9312a 100644
--- a/extensions/common/test_util.cc
+++ b/extensions/common/test_util.cc
@@ -4,6 +4,8 @@
#include "extensions/common/test_util.h"
+#include <utility>
+
#include "extensions/common/extension.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/value_builder.h"
@@ -29,8 +31,8 @@ ExtensionBuilder& BuildApp(ExtensionBuilder& builder) {
extensions::DictionaryBuilder().Set(
"background",
extensions::DictionaryBuilder().Set(
- "scripts",
- extensions::ListBuilder().Append("background.js")))));
+ "scripts", std::move(extensions::ListBuilder().Append(
+ "background.js"))))));
}
scoped_refptr<Extension> CreateEmptyExtension() {
diff --git a/extensions/common/value_builder.cc b/extensions/common/value_builder.cc
index a69d533..6e73f36 100644
--- a/extensions/common/value_builder.cc
+++ b/extensions/common/value_builder.cc
@@ -5,6 +5,7 @@
#include "extensions/common/value_builder.h"
#include "base/json/json_writer.h"
+#include "base/values.h"
namespace extensions {
@@ -55,7 +56,7 @@ DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
}
DictionaryBuilder& DictionaryBuilder::Set(const std::string& path,
- ListBuilder& in_value) {
+ ListBuilder in_value) {
dict_->SetWithoutPathExpansion(path, in_value.Build().Pass());
return *this;
}
@@ -79,6 +80,14 @@ ListBuilder::ListBuilder(const base::ListValue& init) : list_(init.DeepCopy()) {
}
ListBuilder::~ListBuilder() {}
+ListBuilder::ListBuilder(ListBuilder&& other)
+ : list_(other.Build().release()) {}
+
+ListBuilder& ListBuilder::operator=(ListBuilder&& other) {
+ list_.reset(other.Build().release());
+ return *this;
+}
+
ListBuilder& ListBuilder::Append(int in_value) {
list_->Append(new base::FundamentalValue(in_value));
return *this;
@@ -100,12 +109,12 @@ ListBuilder& ListBuilder::Append(const base::string16& in_value) {
}
ListBuilder& ListBuilder::Append(DictionaryBuilder& in_value) {
- list_->Append(in_value.Build().Pass());
+ list_->Append(in_value.Build());
return *this;
}
-ListBuilder& ListBuilder::Append(ListBuilder& in_value) {
- list_->Append(in_value.Build().Pass());
+ListBuilder& ListBuilder::Append(ListBuilder in_value) {
+ list_->Append(in_value.Build());
return *this;
}
diff --git a/extensions/common/value_builder.h b/extensions/common/value_builder.h
index 4de94b6..cc706fa 100644
--- a/extensions/common/value_builder.h
+++ b/extensions/common/value_builder.h
@@ -16,12 +16,8 @@
// For methods that take other built types, you can pass the builder directly
// to the setter without calling Build():
//
-// DictionaryBuilder().Set("key", ListBuilder()
-// .Append("foo").Append("bar") /* No .Build() */);
-//
-// Because of limitations in C++03, and to avoid extra copies, you can't pass a
-// just-constructed Builder into another Builder's method directly. Use the
-// Pass() method.
+// DictionaryBuilder().Set("key", std::move(ListBuilder()
+// .Append("foo").Append("bar")) /* No .Build() */);
//
// The Build() method invalidates its builder, and returns ownership of the
// built value.
@@ -35,9 +31,15 @@
#include <string>
+#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/strings/string16.h"
-#include "base/values.h"
+
+namespace base {
+class DictionaryValue;
+class ListValue;
+class Value;
+}
namespace extensions {
@@ -51,6 +53,7 @@ class DictionaryBuilder {
// Workaround to allow you to pass rvalue ExtensionBuilders by reference to
// other functions.
+ // TODO(limasdf): Remove. Write move constructor instead.
DictionaryBuilder& Pass() { return *this; }
// Can only be called once, after which it's invalid to use the builder.
@@ -66,7 +69,7 @@ class DictionaryBuilder {
DictionaryBuilder& Set(const std::string& path,
const base::string16& in_value);
DictionaryBuilder& Set(const std::string& path, DictionaryBuilder& in_value);
- DictionaryBuilder& Set(const std::string& path, ListBuilder& in_value);
+ DictionaryBuilder& Set(const std::string& path, ListBuilder in_value);
DictionaryBuilder& Set(const std::string& path,
scoped_ptr<base::Value> in_value);
@@ -84,19 +87,19 @@ class ListBuilder {
explicit ListBuilder(const base::ListValue& init);
~ListBuilder();
- // Workaround to allow you to pass rvalue ExtensionBuilders by reference to
- // other functions.
- ListBuilder& Pass() { return *this; }
+ // Move constructor and operator=.
+ ListBuilder(ListBuilder&& other);
+ ListBuilder& operator=(ListBuilder&& other);
// Can only be called once, after which it's invalid to use the builder.
- scoped_ptr<base::ListValue> Build() { return list_.Pass(); }
+ scoped_ptr<base::ListValue> Build() { return std::move(list_); }
ListBuilder& Append(int in_value);
ListBuilder& Append(double in_value);
ListBuilder& Append(const std::string& in_value);
ListBuilder& Append(const base::string16& in_value);
ListBuilder& Append(DictionaryBuilder& in_value);
- ListBuilder& Append(ListBuilder& in_value);
+ ListBuilder& Append(ListBuilder in_value);
// Named differently because overload resolution is too eager to
// convert implicitly to bool.
@@ -104,6 +107,8 @@ class ListBuilder {
private:
scoped_ptr<base::ListValue> list_;
+
+ DISALLOW_COPY_AND_ASSIGN(ListBuilder);
};
} // namespace extensions
diff --git a/extensions/common/value_builder_unittest.cc b/extensions/common/value_builder_unittest.cc
new file mode 100644
index 0000000..7c47451
--- /dev/null
+++ b/extensions/common/value_builder_unittest.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <utility>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/values.h"
+#include "extensions/common/value_builder.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using ValueBuilderTest = testing::Test;
+
+namespace extensions {
+
+TEST(ValueBuilderTest, Basic) {
+ ListBuilder permission_list;
+ permission_list.Append("tabs").Append("history");
+
+ scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue);
+
+ ASSERT_FALSE(settings->GetList("permissions", nullptr));
+ settings = DictionaryBuilder()
+ .Set("permissions", std::move(permission_list))
+ .Build();
+ base::ListValue* list_value;
+ ASSERT_TRUE(settings->GetList("permissions", &list_value));
+
+ ASSERT_EQ(2U, list_value->GetSize());
+ std::string permission;
+ ASSERT_TRUE(list_value->GetString(0, &permission));
+ ASSERT_EQ(permission, "tabs");
+ ASSERT_TRUE(list_value->GetString(1, &permission));
+ ASSERT_EQ(permission, "history");
+}
+
+} // namespace extensions
diff --git a/extensions/extensions_tests.gypi b/extensions/extensions_tests.gypi
index 6875860..e164a8c 100644
--- a/extensions/extensions_tests.gypi
+++ b/extensions/extensions_tests.gypi
@@ -138,8 +138,9 @@
'common/stack_frame_unittest.cc',
'common/url_pattern_set_unittest.cc',
'common/url_pattern_unittest.cc',
- 'common/user_script_unittest.cc',
'common/update_manifest_unittest.cc',
+ 'common/user_script_unittest.cc',
+ 'common/value_builder_unittest.cc',
'renderer/activity_log_converter_strategy_unittest.cc',
'renderer/api/mojo_private/mojo_private_unittest.cc',
'renderer/api/serial/data_receiver_unittest.cc',
diff --git a/extensions/shell/browser/api/identity/identity_api_unittest.cc b/extensions/shell/browser/api/identity/identity_api_unittest.cc
index 03e6f71..1802fdb 100644
--- a/extensions/shell/browser/api/identity/identity_api_unittest.cc
+++ b/extensions/shell/browser/api/identity/identity_api_unittest.cc
@@ -5,6 +5,7 @@
#include "extensions/shell/browser/api/identity/identity_api.h"
#include <string>
+#include <utility>
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
@@ -65,18 +66,18 @@ class IdentityApiTest : public ApiUnitTest {
set_extension(
ExtensionBuilder()
.SetManifest(
- DictionaryBuilder()
- .Set("name", "Test")
- .Set("version", "1.0")
- .Set(
- "oauth2",
- DictionaryBuilder()
- .Set("client_id",
- "123456.apps.googleusercontent.com")
- .Set(
- "scopes",
- ListBuilder().Append(
- "https://www.googleapis.com/auth/drive"))))
+ DictionaryBuilder()
+ .Set("name", "Test")
+ .Set("version", "1.0")
+ .Set(
+ "oauth2",
+ DictionaryBuilder()
+ .Set("client_id",
+ "123456.apps.googleusercontent.com")
+ .Set(
+ "scopes",
+ std::move(ListBuilder().Append(
+ "https://www.googleapis.com/auth/drive")))))
.SetLocation(Manifest::UNPACKED)
.Build());
}