diff options
93 files changed, 1517 insertions, 1286 deletions
diff --git a/chrome/browser/autocomplete/shortcuts_provider_extension_unittest.cc b/chrome/browser/autocomplete/shortcuts_provider_extension_unittest.cc index 204b43d..e743619 100644 --- a/chrome/browser/autocomplete/shortcuts_provider_extension_unittest.cc +++ b/chrome/browser/autocomplete/shortcuts_provider_extension_unittest.cc @@ -105,9 +105,10 @@ TEST_F(ShortcutsProviderExtensionTest, Extension) { // Claim the extension has been unloaded. scoped_refptr<const extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "Echo") - .Set("version", "1.0"))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "Echo") + .Set("version", "1.0") + .Build()) .SetID("cedabbhfglmiikkmdgcpjdkocfcmbkee") .Build(); extensions::UnloadedExtensionInfo details( diff --git a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc index caa2b6c..0bfc333 100644 --- a/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc +++ b/chrome/browser/chromeos/file_manager/file_tasks_unittest.cc @@ -452,52 +452,58 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTasks) { // Foo.app can handle "text/plain" and "text/html". extensions::ExtensionBuilder foo_app; - foo_app.SetManifest(std::move( + foo_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) - .Set( - "file_handlers", - std::move(extensions::DictionaryBuilder().Set( - "text", - std::move(extensions::DictionaryBuilder() - .Set("title", "Text") - .Set("types", - std::move(extensions::ListBuilder() - .Append("text/plain") - .Append("text/html"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set("file_handlers", + extensions::DictionaryBuilder() + .Set("text", extensions::DictionaryBuilder() + .Set("title", "Text") + .Set("types", extensions::ListBuilder() + .Append("text/plain") + .Append("text/html") + .Build()) + .Build()) + .Build()) + .Build()); 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(std::move( + bar_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) - .Set( - "file_handlers", - std::move(extensions::DictionaryBuilder().Set( - "text", - std::move(extensions::DictionaryBuilder() - .Set("title", "Text") - .Set("types", - std::move(extensions::ListBuilder().Append( - "text/plain"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set("file_handlers", + extensions::DictionaryBuilder() + .Set("text", extensions::DictionaryBuilder() + .Set("title", "Text") + .Set("types", extensions::ListBuilder() + .Append("text/plain") + .Build()) + .Build()) + .Build()) + .Build()); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -555,42 +561,50 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileBrowserHandlerTasks) { // Foo.app can handle ".txt" and ".html". // This one is an extension, and has "file_browser_handlers" extensions::ExtensionBuilder foo_app; - foo_app.SetManifest(std::move( + foo_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("permissions", std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) + .Set("permissions", + extensions::ListBuilder().Append("fileBrowserHandler").Build()) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append(std::move( - extensions::DictionaryBuilder() - .Set("id", "open") - .Set("default_title", "open") - .Set("file_filters", - std::move(extensions::ListBuilder() - .Append("filesystem:*.txt") - .Append("filesystem:*.html"))))))))); + extensions::ListBuilder() + .Append( + extensions::DictionaryBuilder() + .Set("id", "open") + .Set("default_title", "open") + .Set("file_filters", extensions::ListBuilder() + .Append("filesystem:*.txt") + .Append("filesystem:*.html") + .Build()) + .Build()) + .Build()) + .Build()); foo_app.SetID(kFooId); extension_service_->AddExtension(foo_app.Build().get()); // Bar.app can only handle ".txt". extensions::ExtensionBuilder bar_app; - bar_app.SetManifest(std::move( + bar_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("permissions", std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) + .Set("permissions", + extensions::ListBuilder().Append("fileBrowserHandler").Build()) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append(std::move( - extensions::DictionaryBuilder() - .Set("id", "open") - .Set("default_title", "open") - .Set("file_filters", - std::move(extensions::ListBuilder().Append( - "filesystem:*.txt"))))))))); + extensions::ListBuilder() + .Append( + extensions::DictionaryBuilder() + .Set("id", "open") + .Set("default_title", "open") + .Set("file_filters", extensions::ListBuilder() + .Append("filesystem:*.txt") + .Build()) + .Build()) + .Build()) + .Build()); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -639,47 +653,54 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks) { // Foo.app can handle "text/plain". // This is a packaged app (file handler). extensions::ExtensionBuilder foo_app; - foo_app.SetManifest(std::move( + foo_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) - .Set( - "file_handlers", - std::move(extensions::DictionaryBuilder().Set( - "text", - std::move(extensions::DictionaryBuilder() - .Set("title", "Text") - .Set("types", - std::move(extensions::ListBuilder().Append( - "text/plain"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set("file_handlers", + extensions::DictionaryBuilder() + .Set("text", extensions::DictionaryBuilder() + .Set("title", "Text") + .Set("types", extensions::ListBuilder() + .Append("text/plain") + .Build()) + .Build()) + .Build()) + .Build()); foo_app.SetID(kFooId); extension_service_->AddExtension(foo_app.Build().get()); // Bar.app can only handle ".txt". // This is an extension (file browser handler). extensions::ExtensionBuilder bar_app; - bar_app.SetManifest(std::move( + bar_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("permissions", std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) + .Set("permissions", + extensions::ListBuilder().Append("fileBrowserHandler").Build()) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append(std::move( - extensions::DictionaryBuilder() - .Set("id", "open") - .Set("default_title", "open") - .Set("file_filters", - std::move(extensions::ListBuilder().Append( - "filesystem:*.txt"))))))))); + extensions::ListBuilder() + .Append( + extensions::DictionaryBuilder() + .Set("id", "open") + .Set("default_title", "open") + .Set("file_filters", extensions::ListBuilder() + .Append("filesystem:*.txt") + .Build()) + .Build()) + .Build()) + .Build()); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -753,21 +774,25 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) { // Bar.app can handle ".gdoc" files. // This is an extension (file browser handler). extensions::ExtensionBuilder bar_app; - bar_app.SetManifest(std::move( + bar_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("permissions", std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) + .Set("permissions", + extensions::ListBuilder().Append("fileBrowserHandler").Build()) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append(std::move( - extensions::DictionaryBuilder() - .Set("id", "open") - .Set("default_title", "open") - .Set("file_filters", - std::move(extensions::ListBuilder().Append( - "filesystem:*.gdoc"))))))))); + extensions::ListBuilder() + .Append( + extensions::DictionaryBuilder() + .Set("id", "open") + .Set("default_title", "open") + .Set("file_filters", extensions::ListBuilder() + .Append("filesystem:*.gdoc") + .Build()) + .Build()) + .Build()) + .Build()); bar_app.SetID(kBarId); extension_service_->AddExtension(bar_app.Build().get()); @@ -775,21 +800,25 @@ TEST_F(FileManagerFileTasksComplexTest, FindAllTypesOfTasks_GoogleDocument) { // The ID "kFileManagerAppId" used here is precisely the one that identifies // the Chrome OS Files.app application. extensions::ExtensionBuilder files_app; - files_app.SetManifest(std::move( + files_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Files") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("permissions", std::move(extensions::ListBuilder().Append( - "fileBrowserHandler"))) + .Set("permissions", + extensions::ListBuilder().Append("fileBrowserHandler").Build()) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append(std::move( - extensions::DictionaryBuilder() - .Set("id", "open") - .Set("default_title", "open") - .Set("file_filters", - std::move(extensions::ListBuilder().Append( - "filesystem:*.gdoc"))))))))); + extensions::ListBuilder() + .Append( + extensions::DictionaryBuilder() + .Set("id", "open") + .Set("default_title", "open") + .Set("file_filters", extensions::ListBuilder() + .Append("filesystem:*.gdoc") + .Build()) + .Build()) + .Build()) + .Build()); files_app.SetID(kFileManagerAppId); extension_service_->AddExtension(files_app.Build().get()); @@ -820,107 +849,124 @@ TEST_F(FileManagerFileTasksComplexTest, FindFileHandlerTask_Generic) { // Foo app provides file handler for text/plain and all file types. extensions::ExtensionBuilder foo_app; - foo_app.SetManifest(std::move( + foo_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) - .Set("file_handlers", - std::move( - extensions::DictionaryBuilder() - .Set("any", - std::move(extensions::DictionaryBuilder().Set( - "types", std::move(extensions::ListBuilder() - .Append("*/*"))))) - .Set("text", - std::move(extensions::DictionaryBuilder().Set( - "types", - std::move(extensions::ListBuilder().Append( - "text/plain"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set( + "file_handlers", + extensions::DictionaryBuilder() + .Set("any", + extensions::DictionaryBuilder() + .Set("types", + extensions::ListBuilder().Append("*/*").Build()) + .Build()) + .Set("text", extensions::DictionaryBuilder() + .Set("types", extensions::ListBuilder() + .Append("text/plain") + .Build()) + .Build()) + .Build()) + .Build()); foo_app.SetID(kFooId); extension_service_->AddExtension(foo_app.Build().get()); // Bar app provides file handler for .txt and not provide generic file // handler, but handles directories. extensions::ExtensionBuilder bar_app; - bar_app.SetManifest(std::move( + bar_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Set( "file_handlers", - std::move(extensions::DictionaryBuilder().Set( - "text", - std::move(extensions::DictionaryBuilder() - .SetBoolean("include_directories", true) - .Set("extensions", - std::move(extensions::ListBuilder().Append( - "txt"))))))))); + extensions::DictionaryBuilder() + .Set("text", + extensions::DictionaryBuilder() + .SetBoolean("include_directories", true) + .Set("extensions", + extensions::ListBuilder().Append("txt").Build()) + .Build()) + .Build()) + .Build()); 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(std::move( + baz_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Baz") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) - .Set( - "file_handlers", - std::move( - extensions::DictionaryBuilder() - .Set("any", - std::move(extensions::DictionaryBuilder().Set( - "extensions", std::move(extensions::ListBuilder() - .Append("*") - .Append("bar"))))) - .Set("image", - std::move(extensions::DictionaryBuilder().Set( - "types", - std::move(extensions::ListBuilder().Append( - "image/*"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set("file_handlers", + extensions::DictionaryBuilder() + .Set("any", extensions::DictionaryBuilder() + .Set("extensions", extensions::ListBuilder() + .Append("*") + .Append("bar") + .Build()) + .Build()) + .Set("image", extensions::DictionaryBuilder() + .Set("types", extensions::ListBuilder() + .Append("image/*") + .Build()) + .Build()) + .Build()) + .Build()); 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(std::move( + qux_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Qux") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Set("file_handlers", - std::move(extensions::DictionaryBuilder().Set( - "any", - std::move(extensions::DictionaryBuilder().Set( - "types", - std::move(extensions::ListBuilder().Append("*"))))))))); + extensions::DictionaryBuilder() + .Set("any", + extensions::DictionaryBuilder() + .Set("types", + extensions::ListBuilder().Append("*").Build()) + .Build()) + .Build()) + .Build()); 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 dfd58c1..35f1e2d 100644 --- a/chrome/browser/chromeos/power/extension_event_observer_unittest.cc +++ b/chrome/browser/chromeos/power/extension_event_observer_unittest.cc @@ -90,21 +90,24 @@ class ExtensionEventObserverTest : public ::testing::Test { bool uses_gcm) { scoped_refptr<extensions::Extension> app = extensions::ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( extensions::DictionaryBuilder() .Set("name", name) .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", - std::move(extensions::ListBuilder().Append( - "background.js"))))))) - .Set("permissions", - std::move(extensions::ListBuilder().Append( - uses_gcm ? "gcm" : ""))))) + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", + extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set("permissions", extensions::ListBuilder() + .Append(uses_gcm ? "gcm" : "") + .Build()) + .Build()) .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 2831657..c1c48ef 100644 --- a/chrome/browser/chromeos/power/renderer_freezer_unittest.cc +++ b/chrome/browser/chromeos/power/renderer_freezer_unittest.cc @@ -312,20 +312,23 @@ TEST_F(RendererFreezerTestWithExtensions, DoesNotFreezeGcmExtensionRenderers) { // First build the GCM extension. scoped_refptr<extensions::Extension> gcm_app = extensions::ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( extensions::DictionaryBuilder() .Set("name", "GCM App") .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", - std::move(extensions::ListBuilder().Append( - "background.js"))))))) + extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Set("permissions", - std::move(extensions::ListBuilder().Append("gcm"))))) + extensions::ListBuilder().Append("gcm").Build()) + .Build()) .Build(); // Now install it and give it a renderer. @@ -345,18 +348,21 @@ TEST_F(RendererFreezerTestWithExtensions, FreezesNonGcmExtensionRenderers) { // First build the extension. scoped_refptr<extensions::Extension> background_app = extensions::ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( extensions::DictionaryBuilder() .Set("name", "Background App") .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", - std::move(extensions::ListBuilder().Append( - "background.js"))))))))) + extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Build()) .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 b7d5ad6..0f36776 100644 --- a/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc +++ b/chrome/browser/chromeos/printer_detector/printer_detector_unittest.cc @@ -129,23 +129,27 @@ class PrinterDetectorAppSearchEnabledTest : public testing::Test { // Creates a test extension with the provided permissions. scoped_refptr<extensions::Extension> CreateTestExtension( - ListBuilder permissions_builder, - DictionaryBuilder usb_printers_builder) { + scoped_ptr<base::ListValue> permissions_builder, + scoped_ptr<base::DictionaryValue> usb_printers_builder) { return extensions::ExtensionBuilder() .SetID("fake_extension_id") - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "Printer provider extension") .Set("manifest_version", 2) .Set("version", "1.0") // Needed to enable usb API. - .Set("app", std::move(DictionaryBuilder().Set( - "background", - std::move(DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append( - "bg.js"))))))) + .Set("app", + DictionaryBuilder() + .Set("background", + DictionaryBuilder() + .Set("scripts", + ListBuilder().Append("bg.js").Build()) + .Build()) + .Build()) .Set("permissions", std::move(permissions_builder)) - .Set("usb_printers", std::move(usb_printers_builder)))) + .Set("usb_printers", std::move(usb_printers_builder)) + .Build()) .Build(); } @@ -174,15 +178,19 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, ShowFindAppNotification) { TEST_F(PrinterDetectorAppSearchEnabledTest, ShowAppFoundNotification) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move(ListBuilder() - .Append("usb") - .Append("printerProvider") - .Append(std::move(DictionaryBuilder().Set( - "usbDevices", std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 456)))))))), - std::move(DictionaryBuilder().Set("filters", ListBuilder()))); + ListBuilder() + .Append("usb") + .Append("printerProvider") + .Append(DictionaryBuilder() + .Set("usbDevices", ListBuilder() + .Append(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 456) + .Build()) + .Build()) + .Build()) + .Build(), + DictionaryBuilder().Set("filters", ListBuilder().Build()).Build()); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -200,13 +208,18 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, ShowAppFoundNotification) { TEST_F(PrinterDetectorAppSearchEnabledTest, UsbHandlerExists_NotPrinterProvider) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move( - ListBuilder().Append("usb").Append(std::move(DictionaryBuilder().Set( - "usbDevices", std::move(ListBuilder().Append( - std::move(DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 756)))))))), - std::move(DictionaryBuilder().Set("filters", ListBuilder()))); + ListBuilder() + .Append("usb") + .Append(DictionaryBuilder() + .Set("usbDevices", ListBuilder() + .Append(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 756) + .Build()) + .Build()) + .Build()) + .Build(), + DictionaryBuilder().Set("filters", ListBuilder().Build()).Build()); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -224,15 +237,19 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, TEST_F(PrinterDetectorAppSearchEnabledTest, PrinterProvider_DifferentUsbProductId) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move(ListBuilder() - .Append("usb") - .Append("printerProvider") - .Append(std::move(DictionaryBuilder().Set( - "usbDevices", std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 001)))))))), - std::move(DictionaryBuilder().Set("filters", ListBuilder()))); + ListBuilder() + .Append("usb") + .Append("printerProvider") + .Append(DictionaryBuilder() + .Set("usbDevices", ListBuilder() + .Append(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 001) + .Build()) + .Build()) + .Build()) + .Build(), + DictionaryBuilder().Set("filters", ListBuilder().Build()).Build()); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -250,12 +267,15 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, TEST_F(PrinterDetectorAppSearchEnabledTest, PrinterProvider_UsbPrinters_NotFound) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move(ListBuilder().Append("usb").Append("printerProvider")), - std::move(DictionaryBuilder().Set( - "filters", std::move(ListBuilder().Append( - std::move(DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 001))))))); + ListBuilder().Append("usb").Append("printerProvider").Build(), + DictionaryBuilder() + .Set("filters", ListBuilder() + .Append(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 001) + .Build()) + .Build()) + .Build()); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -273,12 +293,15 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, TEST_F(PrinterDetectorAppSearchEnabledTest, PrinterProvider_UsbPrinters_WithProductId) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move(ListBuilder().Append("usb").Append("printerProvider")), - std::move(DictionaryBuilder().Set( - "filters", std::move(ListBuilder().Append( - std::move(DictionaryBuilder() - .Set("vendorId", 123) - .Set("productId", 456))))))); + ListBuilder().Append("usb").Append("printerProvider").Build(), + DictionaryBuilder() + .Set("filters", ListBuilder() + .Append(DictionaryBuilder() + .Set("vendorId", 123) + .Set("productId", 456) + .Build()) + .Build()) + .Build()); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -296,13 +319,16 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, TEST_F(PrinterDetectorAppSearchEnabledTest, PrinterProvider_UsbPrinters_WithInterfaceClass) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move(ListBuilder().Append("usb").Append("printerProvider")), - std::move(DictionaryBuilder().Set( - "filters", - std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("interfaceClass", kPrinterInterfaceClass))))))); + ListBuilder().Append("usb").Append("printerProvider").Build(), + DictionaryBuilder() + .Set("filters", + ListBuilder() + .Append(DictionaryBuilder() + .Set("vendorId", 123) + .Set("interfaceClass", kPrinterInterfaceClass) + .Build()) + .Build()) + .Build()); ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) ->AddEnabled(extension)); @@ -319,13 +345,16 @@ TEST_F(PrinterDetectorAppSearchEnabledTest, TEST_F(PrinterDetectorAppSearchEnabledTest, IgnoreNonPrinters) { scoped_refptr<extensions::Extension> extension = CreateTestExtension( - std::move(ListBuilder().Append("usb").Append("printerProvider")), - std::move(DictionaryBuilder().Set( - "filters", - std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("vendorId", 123) - .Set("interfaceClass", kPrinterInterfaceClass))))))); + ListBuilder().Append("usb").Append("printerProvider").Build(), + DictionaryBuilder() + .Set("filters", + ListBuilder() + .Append(DictionaryBuilder() + .Set("vendorId", 123) + .Set("interfaceClass", kPrinterInterfaceClass) + .Build()) + .Build()) + .Build()); 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 a05f521..b436ce4 100644 --- a/chrome/browser/extensions/active_script_controller_unittest.cc +++ b/chrome/browser/extensions/active_script_controller_unittest.cc @@ -107,14 +107,15 @@ const Extension* ActiveScriptControllerUnitTest::AddExtension() { const std::string kId = crx_file::id_util::GenerateId("all_hosts_extension"); extension_ = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "all_hosts_extension") .Set("description", "an extension") .Set("manifest_version", 2) .Set("version", "1.0.0") .Set("permissions", - std::move(ListBuilder().Append(kAllHostsPermission))))) + ListBuilder().Append(kAllHostsPermission).Build()) + .Build()) .SetLocation(Manifest::INTERNAL) .SetID(kId) .Build(); diff --git a/chrome/browser/extensions/active_tab_unittest.cc b/chrome/browser/extensions/active_tab_unittest.cc index 70bfa17..1950d8c 100644 --- a/chrome/browser/extensions/active_tab_unittest.cc +++ b/chrome/browser/extensions/active_tab_unittest.cc @@ -50,11 +50,12 @@ scoped_refptr<const Extension> CreateTestExtension( if (has_tab_capture_permission) permissions.Append("tabCapture"); return ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Extension with ID " + id) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("permissions", std::move(permissions)))) + .SetManifest(DictionaryBuilder() + .Set("name", "Extension with ID " + id) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("permissions", permissions.Build()) + .Build()) .SetID(id) .Build(); } diff --git a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc index bf44827..e3f9ead 100644 --- a/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_enabled_unittest.cc @@ -149,10 +149,11 @@ TEST_F(ActivityLogEnabledTest, WatchdogSwitch) { scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Watchdog Extension ") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Watchdog Extension ") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .SetID(kExtensionID) .Build(); extension_service1->AddExtension(extension.get()); @@ -206,10 +207,11 @@ TEST_F(ActivityLogEnabledTest, WatchdogSwitch) { scoped_refptr<Extension> extension2 = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Watchdog Extension ") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Watchdog Extension ") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .SetID("fpofdchlamddhnajleknffcbmnjfahpg") .Build(); extension_service1->AddExtension(extension.get()); @@ -255,10 +257,11 @@ TEST_F(ActivityLogEnabledTest, AppAndCommandLine) { // Enable the extension. scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Watchdog Extension ") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Watchdog Extension ") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .SetID(kExtensionID) .Build(); extension_service->AddExtension(extension.get()); 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 6501a46..421f55a 100644 --- a/chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_policy_unittest.cc @@ -49,9 +49,8 @@ TEST_F(ActivityLogPolicyUtilTest, StripPrivacySensitiveWebRequest) { .Set(activity_log_web_request_constants::kNewUrlKey, "http://www.youtube.com/") .Set(activity_log_web_request_constants::kAddedRequestHeadersKey, - std::move(ListBuilder().Append("arg"))) - .Build() - .release()); + ListBuilder().Append("arg").Build()) + .Build()); ActivityLogPolicy::Util::StripPrivacySensitiveFields(action); diff --git a/chrome/browser/extensions/activity_log/activity_log_unittest.cc b/chrome/browser/extensions/activity_log/activity_log_unittest.cc index 7267ff5..49bcafb 100644 --- a/chrome/browser/extensions/activity_log/activity_log_unittest.cc +++ b/chrome/browser/extensions/activity_log/activity_log_unittest.cc @@ -236,10 +236,11 @@ TEST_F(ActivityLogTest, LogAndFetchActions) { TEST_F(ActivityLogTest, LogPrerender) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); ActivityLog* activity_log = ActivityLog::GetInstance(profile()); @@ -330,10 +331,11 @@ TEST_F(ActivityLogTest, ArgUrlExtraction) { now - base::TimeDelta::FromSeconds(3), Action::ACTION_API_CALL, "windows.create"); - action->set_args(ListBuilder() - .Append(std::move(DictionaryBuilder().Set( - "url", "http://www.google.co.uk"))) - .Build()); + action->set_args( + ListBuilder() + .Append( + DictionaryBuilder().Set("url", "http://www.google.co.uk").Build()) + .Build()); activity_log->LogAction(action); activity_log->GetFilteredActions( @@ -349,10 +351,11 @@ TEST_F(ActivityLogTest, ArgUrlExtraction) { TEST_F(ActivityLogTest, UninstalledExtension) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); ActivityLog* activity_log = ActivityLog::GetInstance(profile()); diff --git a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc index 3d61743..4eca1d9 100644 --- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc +++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc @@ -540,10 +540,11 @@ TEST_F(CountingPolicyTest, Construct) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); scoped_ptr<base::ListValue> args(new base::ListValue()); @@ -561,10 +562,11 @@ TEST_F(CountingPolicyTest, LogWithStrippedArguments) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); @@ -707,10 +709,11 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc index ead69e8..1ce3fa8 100644 --- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc +++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc @@ -457,10 +457,11 @@ TEST_F(FullStreamUIPolicyTest, Construct) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); scoped_ptr<base::ListValue> args(new base::ListValue()); @@ -478,10 +479,11 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchActions) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); @@ -516,10 +518,11 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); @@ -614,10 +617,11 @@ TEST_F(FullStreamUIPolicyTest, LogWithArguments) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); @@ -955,10 +959,11 @@ TEST_F(FullStreamUIPolicyTest, DeleteDatabase) { policy->Init(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .Build(); extension_service_->AddExtension(extension.get()); GURL gurl("http://www.google.com"); diff --git a/chrome/browser/extensions/api/debugger/debugger_apitest.cc b/chrome/browser/extensions/api/debugger/debugger_apitest.cc index 36339db..91885ec 100644 --- a/chrome/browser/extensions/api/debugger/debugger_apitest.cc +++ b/chrome/browser/extensions/api/debugger/debugger_apitest.cc @@ -67,15 +67,16 @@ void DebuggerApiTest::SetUpCommandLine(base::CommandLine* command_line) { void DebuggerApiTest::SetUpOnMainThread() { ExtensionApiTest::SetUpOnMainThread(); - extension_ = ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder() - .Set("name", "debugger") - .Set("version", "0.1") - .Set("manifest_version", 2) - .Set("permissions", - std::move(ListBuilder().Append("debugger"))))) - .Build(); + extension_ = + ExtensionBuilder() + .SetManifest( + DictionaryBuilder() + .Set("name", "debugger") + .Set("version", "0.1") + .Set("manifest_version", 2) + .Set("permissions", ListBuilder().Append("debugger").Build()) + .Build()) + .Build(); } testing::AssertionResult DebuggerApiTest::RunAttachFunction( diff --git a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc index 7206ed4..a61a301 100644 --- a/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc +++ b/chrome/browser/extensions/api/declarative_content/content_action_unittest.cc @@ -169,7 +169,7 @@ TEST(DeclarativeContentActionTest, SetIcon) { scoped_ptr<base::DictionaryValue> dict = DictionaryBuilder() .Set("instanceType", "declarativeContent.SetIcon") - .Set("imageData", std::move(DictionaryBuilder().Set("19", data64))) + .Set("imageData", DictionaryBuilder().Set("19", data64).Build()) .Build(); const Extension* extension = env.MakeExtension( 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 b5a4333..e519242 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,11 +39,12 @@ scoped_refptr<Extension> CreateExtensionWithBookmarksPermission( if (include_bookmarks) permissions.Append("bookmarks"); return ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("permissions", std::move(permissions)))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("permissions", permissions.Build()) + .Build()) .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 fc9f330..ff79cf2 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 @@ -152,7 +152,7 @@ const Extension* DeveloperPrivateApiUnitTest::LoadSimpleExtension() { .Set("description", "an extension"); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetLocation(Manifest::INTERNAL) .SetID(id) .Build(); @@ -516,9 +516,10 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) { api::developer_private::ERROR_TYPE_MANIFEST); scoped_ptr<base::ListValue> args = ListBuilder() - .Append(std::move(DictionaryBuilder() - .Set("extensionId", extension->id()) - .Set("type", type_string))) + .Append(DictionaryBuilder() + .Set("extensionId", extension->id()) + .Set("type", type_string) + .Build()) .Build(); scoped_refptr<UIThreadExtensionFunction> function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); @@ -532,10 +533,10 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) { int error_id = error_list[0]->id(); args = ListBuilder() - .Append(std::move( - DictionaryBuilder() - .Set("extensionId", extension->id()) - .Set("errorIds", std::move(ListBuilder().Append(error_id))))) + .Append(DictionaryBuilder() + .Set("extensionId", extension->id()) + .Set("errorIds", ListBuilder().Append(error_id).Build()) + .Build()) .Build(); function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); EXPECT_TRUE(RunFunction(function, *args)) << function->GetError(); @@ -543,10 +544,11 @@ TEST_F(DeveloperPrivateApiUnitTest, DeveloperPrivateDeleteExtensionErrors) { EXPECT_EQ(1u, error_console->GetErrorsForExtension(extension->id()).size()); // Finally remove all errors for the extension. - args = ListBuilder() - .Append(std::move( - DictionaryBuilder().Set("extensionId", extension->id()))) - .Build(); + args = + ListBuilder() + .Append( + DictionaryBuilder().Set("extensionId", extension->id()).Build()) + .Build(); function = new api::DeveloperPrivateDeleteExtensionErrorsFunction(); EXPECT_TRUE(RunFunction(function, *args)) << function->GetError(); // No more errors! 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 4818528..c008601 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 @@ -84,17 +84,17 @@ class ExtensionInfoGeneratorUnitTest : public ExtensionServiceTestBase { const scoped_refptr<const Extension> CreateExtension( const std::string& name, - ListBuilder permissions) { + scoped_ptr<base::ListValue> permissions) { const std::string kId = crx_file::id_util::GenerateId(name); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest( - std::move(DictionaryBuilder() - .Set("name", name) - .Set("description", "an extension") - .Set("manifest_version", 2) - .Set("version", "1.0.0") - .Set("permissions", std::move(permissions)))) + .SetManifest(DictionaryBuilder() + .Set("name", name) + .Set("description", "an extension") + .Set("manifest_version", 2) + .Set("version", "1.0.0") + .Set("permissions", std::move(permissions)) + .Build()) .SetLocation(Manifest::INTERNAL) .SetID(kId) .Build(); @@ -187,7 +187,7 @@ TEST_F(ExtensionInfoGeneratorUnitTest, BasicInfoTest) { .Set("version", kVersion) .Set("manifest_version", 2) .Set("description", "an extension") - .Set("permissions", std::move(ListBuilder().Append("file://*/*"))) + .Set("permissions", ListBuilder().Append("file://*/*").Build()) .Build(); scoped_ptr<base::DictionaryValue> manifest_copy(manifest->DeepCopy()); scoped_refptr<const Extension> extension = @@ -353,9 +353,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", std::move(ListBuilder().Append(kAllHostsPermission))); + "all_urls", ListBuilder().Append(kAllHostsPermission).Build()); scoped_refptr<const Extension> no_urls_extension = - CreateExtension("no urls", ListBuilder()); + CreateExtension("no urls", ListBuilder().Build()); scoped_ptr<developer::ExtensionInfo> info = GenerateExtensionInfo(all_urls_extension->id()); @@ -400,7 +400,7 @@ TEST_F(ExtensionInfoGeneratorUnitTest, ExtensionInfoRunOnAllUrls) { // Load another extension with all urls (so permissions get re-init'd). all_urls_extension = CreateExtension( - "all_urls_II", std::move(ListBuilder().Append(kAllHostsPermission))); + "all_urls_II", ListBuilder().Append(kAllHostsPermission).Build()); // Even though the extension has all_urls permission, the checkbox shouldn't // show up without the switch. diff --git a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc index c4e24d8..fafd333 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api_unittest.cc @@ -370,7 +370,8 @@ TEST_F(FileSystemApiConsentProviderTest, ForKioskApps) { test_util::BuildApp(ExtensionBuilder()) .MergeManifest(DictionaryBuilder() .SetBoolean("kiosk_enabled", true) - .SetBoolean("kiosk_only", true)) + .SetBoolean("kiosk_only", true) + .Build()) .Build()); user_manager_->AddKioskAppUser( AccountId::FromUserEmail(auto_launch_kiosk_app->id())); @@ -399,7 +400,8 @@ TEST_F(FileSystemApiConsentProviderTest, ForKioskApps) { test_util::BuildApp(ExtensionBuilder()) .MergeManifest(DictionaryBuilder() .SetBoolean("kiosk_enabled", true) - .SetBoolean("kiosk_only", true)) + .SetBoolean("kiosk_only", true) + .Build()) .Build()); user_manager_->KioskAppLoggedIn( AccountId::FromUserEmail(manual_launch_kiosk_app->id())); diff --git a/chrome/browser/extensions/api/identity/identity_apitest.cc b/chrome/browser/extensions/api/identity/identity_apitest.cc index da7aaf1..33a2980 100644 --- a/chrome/browser/extensions/api/identity/identity_apitest.cc +++ b/chrome/browser/extensions/api/identity/identity_apitest.cc @@ -1658,16 +1658,16 @@ class GetAuthTokenFunctionPublicSessionTest : public GetAuthTokenFunctionTest { scoped_refptr<Extension> CreateTestExtension(const std::string& id) { return ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "Test") .Set("version", "1.0") .Set("oauth2", - std::move( - DictionaryBuilder() - .Set("client_id", "clientId") - .Set("scopes", - std::move(ListBuilder().Append("scope1"))))))) + DictionaryBuilder() + .Set("client_id", "clientId") + .Set("scopes", ListBuilder().Append("scope1").Build()) + .Build()) + .Build()) .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 c6e9f9a..20a05b5 100644 --- a/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc +++ b/chrome/browser/extensions/api/omnibox/omnibox_unittest.cc @@ -48,21 +48,25 @@ TEST(ExtensionOmniboxTest, DescriptionStylesSimple) { scoped_ptr<base::ListValue> list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("content", "content") - .Set("description", "description") - .Set("descriptionStyles", - std::move( - ListBuilder() - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 1) - .Set("length", 4))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 6) - .Set("length", 3))))))))) + .Append(ListBuilder() + .Append(DictionaryBuilder() + .Set("content", "content") + .Set("description", "description") + .Set("descriptionStyles", + ListBuilder() + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 1) + .Set("length", 4) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 6) + .Set("length", 3) + .Build()) + .Build()) + .Build()) + .Build()) .Build(); ACMatchClassifications styles_expected; @@ -83,21 +87,25 @@ TEST(ExtensionOmniboxTest, DescriptionStylesSimple) { scoped_ptr<base::ListValue> swap_list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("content", "content") - .Set("description", "description") - .Set("descriptionStyles", - std::move( - ListBuilder() - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 6) - .Set("length", 3))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 1) - .Set("length", 4))))))))) + .Append(ListBuilder() + .Append(DictionaryBuilder() + .Set("content", "content") + .Set("description", "description") + .Set("descriptionStyles", + ListBuilder() + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 6) + .Set("length", 3) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 1) + .Set("length", 4) + .Build()) + .Build()) + .Build()) + .Build()) .Build(); scoped_ptr<SendSuggestions::Params> swapped_params( @@ -119,33 +127,40 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine) { scoped_ptr<base::ListValue> list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("content", "content") - .Set("description", "description") - .Set("descriptionStyles", - std::move( - ListBuilder() - .Append(std::move(DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 9) - .Set("length", 2))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 9) - .Set("length", 2))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 4))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 1) - .Set("length", 2))))))))) + .Append(ListBuilder() + .Append(DictionaryBuilder() + .Set("content", "content") + .Set("description", "description") + .Set("descriptionStyles", + ListBuilder() + .Append(DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 9) + .Set("length", 2) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 9) + .Set("length", 2) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 4) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 1) + .Set("length", 2) + .Build()) + .Build()) + .Build()) + .Build()) .Build(); ACMatchClassifications styles_expected; @@ -168,33 +183,40 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine) { scoped_ptr<base::ListValue> moved_list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("content", "content") - .Set("description", "description") - .Set("descriptionStyles", - std::move( - ListBuilder() - .Append(std::move(DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 4))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 9) - .Set("length", 2))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 9) - .Set("length", 2))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 1) - .Set("length", 2))))))))) + .Append(ListBuilder() + .Append(DictionaryBuilder() + .Set("content", "content") + .Set("description", "description") + .Set("descriptionStyles", + ListBuilder() + .Append(DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 4) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 9) + .Set("length", 2) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 9) + .Set("length", 2) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 1) + .Set("length", 2) + .Build()) + .Build()) + .Build()) + .Build()) .Build(); scoped_ptr<SendSuggestions::Params> moved_params( @@ -216,33 +238,40 @@ TEST(ExtensionOmniboxTest, DescriptionStylesCombine2) { scoped_ptr<base::ListValue> list = ListBuilder() .Append(42) - .Append(std::move(ListBuilder().Append(std::move( - DictionaryBuilder() - .Set("content", "content") - .Set("description", "description") - .Set("descriptionStyles", - std::move( - ListBuilder() - .Append(std::move(DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 5))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 3))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 2) - .Set("length", 3))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 0) - .Set("length", 3))))))))) + .Append(ListBuilder() + .Append(DictionaryBuilder() + .Set("content", "content") + .Set("description", "description") + .Set("descriptionStyles", + ListBuilder() + .Append(DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 5) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 3) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 2) + .Set("length", 3) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 0) + .Set("length", 3) + .Build()) + .Build()) + .Build()) + .Build()) .Build(); ACMatchClassifications styles_expected; @@ -268,34 +297,37 @@ TEST(ExtensionOmniboxTest, DefaultSuggestResult) { // Default suggestions should not have a content parameter. scoped_ptr<base::ListValue> list = ListBuilder() - .Append(std::move( - DictionaryBuilder() - .Set("description", "description") - .Set( - "descriptionStyles", - std::move( - ListBuilder() - .Append(std::move( - DictionaryBuilder() - .Set("type", "url") - .Set("offset", 0) - .Set("length", 5))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 5))) - .Append(std::move(DictionaryBuilder() - .Set("type", "match") - .Set("offset", 0) - .Set("length", 3))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 2) - .Set("length", 3))) - .Append(std::move(DictionaryBuilder() - .Set("type", "dim") - .Set("offset", 0) - .Set("length", 3))))))) + .Append(DictionaryBuilder() + .Set("description", "description") + .Set("descriptionStyles", + ListBuilder() + .Append(DictionaryBuilder() + .Set("type", "url") + .Set("offset", 0) + .Set("length", 5) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 5) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "match") + .Set("offset", 0) + .Set("length", 3) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 2) + .Set("length", 3) + .Build()) + .Append(DictionaryBuilder() + .Set("type", "dim") + .Set("offset", 0) + .Set("length", 3) + .Build()) + .Build()) + .Build()) .Build(); scoped_ptr<SetDefaultSuggestion::Params> params( diff --git a/chrome/browser/extensions/api/storage/settings_apitest.cc b/chrome/browser/extensions/api/storage/settings_apitest.cc index 45921cd..e909ae0 100644 --- a/chrome/browser/extensions/api/storage/settings_apitest.cc +++ b/chrome/browser/extensions/api/storage/settings_apitest.cc @@ -499,21 +499,23 @@ IN_PROC_BROWSER_TEST_F(ExtensionSettingsApiTest, ManagedStorage) { .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", - std::move(extensions::DictionaryBuilder().Set( - "list", - std::move( - extensions::ListBuilder() - .Append(std::move( - extensions::DictionaryBuilder().Set("one", 1).Set( - "two", 2))) - .Append(std::move(extensions::DictionaryBuilder().Set( - "three", 3))))))) + .Set("list-policy", extensions::ListBuilder() + .Append("one") + .Append("two") + .Append("three") + .Build()) + .Set("dict-policy", + extensions::DictionaryBuilder() + .Set("list", extensions::ListBuilder() + .Append(extensions::DictionaryBuilder() + .Set("one", 1) + .Set("two", 2) + .Build()) + .Append(extensions::DictionaryBuilder() + .Set("three", 3) + .Build()) + .Build()) + .Build()) .Build(); SetPolicies(*policy); // Now run the extension. 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 5ca9a66..2da7244 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 @@ -31,13 +31,13 @@ TEST_F(StreamsPrivateManifestTest, ValidMimeTypesHandlerMIMETypes) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetID(extension_misc::kQuickOfficeExtensionId) - .SetManifest(std::move( + .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"))))) + .Set("mime_types", ListBuilder().Append("text/plain").Build()) + .Build()) .Build(); ASSERT_TRUE(extension.get()); @@ -52,13 +52,13 @@ TEST_F(StreamsPrivateManifestTest, MimeTypesHandlerMIMETypesNotWhitelisted) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move( + .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"))))) + .Set("mime_types", ListBuilder().Append("text/plain").Build()) + .Build()) .Build(); ASSERT_TRUE(extension.get()); diff --git a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc index 5396d62..f0585a7 100644 --- a/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc +++ b/chrome/browser/extensions/api/tabs/tabs_api_unittest.cc @@ -107,12 +107,13 @@ TEST_F(TabsApiUnitTest, QueryWithoutTabsPermission) { // An extension with "tabs" permission however will see the third tab. scoped_refptr<const Extension> extension_with_permission = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "Extension with tabs permission") .Set("version", "1.0") .Set("manifest_version", 2) - .Set("permissions", std::move(ListBuilder().Append("tabs"))))) + .Set("permissions", ListBuilder().Append("tabs").Build()) + .Build()) .Build(); scoped_ptr<base::ListValue> tabs_list_with_permission(RunTabsQueryFunction( browser(), extension_with_permission.get(), kTitleAndURLQueryInfo)); @@ -155,12 +156,13 @@ TEST_F(TabsApiUnitTest, QueryWithHostPermission) { scoped_refptr<const Extension> extension_with_permission = ExtensionBuilder() .SetManifest( - std::move(DictionaryBuilder() - .Set("name", "Extension with tabs permission") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("permissions", std::move(ListBuilder().Append( - "*://www.google.com/*"))))) + DictionaryBuilder() + .Set("name", "Extension with tabs permission") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("permissions", + ListBuilder().Append("*://www.google.com/*").Build()) + .Build()) .Build(); { diff --git a/chrome/browser/extensions/api/web_request/web_request_apitest.cc b/chrome/browser/extensions/api/web_request/web_request_apitest.cc index 375fe6f..5f510f9 100644 --- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc +++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc @@ -458,15 +458,18 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, HostedAppRequest) { "/extensions/api_test/webrequest_hosted_app/index.html")); scoped_refptr<Extension> hosted_app = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "Some hosted app") .Set("version", "1") .Set("manifest_version", 2) - .Set("app", - std::move(DictionaryBuilder().Set( - "launch", std::move(DictionaryBuilder().Set( - "web_url", hosted_app_url.spec()))))))) + .Set("app", DictionaryBuilder() + .Set("launch", DictionaryBuilder() + .Set("web_url", + hosted_app_url.spec()) + .Build()) + .Build()) + .Build()) .Build(); ExtensionSystem::Get(browser()->profile()) ->extension_service() diff --git a/chrome/browser/extensions/app_data_migrator_unittest.cc b/chrome/browser/extensions/app_data_migrator_unittest.cc index e814476..eb4b22b 100644 --- a/chrome/browser/extensions/app_data_migrator_unittest.cc +++ b/chrome/browser/extensions/app_data_migrator_unittest.cc @@ -75,35 +75,40 @@ class AppDataMigratorTest : public testing::Test { scoped_refptr<const Extension> GetTestExtension(bool platform_app) { scoped_refptr<const Extension> app; if (platform_app) { - app = - ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder() - .Set("name", "test app") - .Set("version", "1") - .Set("app", - std::move(DictionaryBuilder().Set( - "background", - std::move(DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append( - "background.js"))))))) - .Set("permissions", - std::move(ListBuilder().Append("unlimitedStorage"))))) - .Build(); + app = ExtensionBuilder() + .SetManifest( + DictionaryBuilder() + .Set("name", "test app") + .Set("version", "1") + .Set("app", DictionaryBuilder() + .Set("background", + DictionaryBuilder() + .Set("scripts", + ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set("permissions", + ListBuilder().Append("unlimitedStorage").Build()) + .Build()) + .Build(); } else { - app = - ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder() - .Set("name", "test app") - .Set("version", "1") - .Set("app", - std::move(DictionaryBuilder().Set( - "launch", std::move(DictionaryBuilder().Set( - "local_path", "index.html"))))) - .Set("permissions", - std::move(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") + .Build()) + .Build()) + .Set("permissions", + ListBuilder().Append("unlimitedStorage").Build()) + .Build()) + .Build(); } return app; } diff --git a/chrome/browser/extensions/extension_action_manager_unittest.cc b/chrome/browser/extensions/extension_action_manager_unittest.cc index f809bbc..74c5e67 100644 --- a/chrome/browser/extensions/extension_action_manager_unittest.cc +++ b/chrome/browser/extensions/extension_action_manager_unittest.cc @@ -30,9 +30,10 @@ class ExtensionActionManagerTest : public testing::Test { protected: // Build an extension, populating |action_type| key with |action|, and // "icons" key with |extension_icons|. - scoped_refptr<Extension> BuildExtension(DictionaryBuilder extension_icons, - DictionaryBuilder action, - const char* action_type); + scoped_refptr<Extension> BuildExtension( + scoped_ptr<base::DictionaryValue> extension_icons, + scoped_ptr<base::DictionaryValue> action, + const char* action_type); // Returns true if |action|'s title matches |extension|'s name. bool TitlesMatch(const Extension& extension, const ExtensionAction& action); @@ -71,19 +72,20 @@ ExtensionActionManagerTest::ExtensionActionManagerTest() } scoped_refptr<Extension> ExtensionActionManagerTest::BuildExtension( - DictionaryBuilder extension_icons, - DictionaryBuilder action, + scoped_ptr<base::DictionaryValue> extension_icons, + scoped_ptr<base::DictionaryValue> action, const char* action_type) { std::string id = base::IntToString(curr_id_++); scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("version", "1") .Set("manifest_version", 2) .Set("icons", std::move(extension_icons)) .Set(action_type, std::move(action)) - .Set("name", std::string("Test Extension").append(id)))) + .Set("name", std::string("Test Extension").append(id)) + .Build()) .SetID(id) .Build(); registry_->AddEnabled(extension); @@ -119,10 +121,11 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( // replacement for missing action default_icons keys. "19" should not be // replaced because "38" can always be used in its place. scoped_refptr<Extension> extension = - BuildExtension(std::move(DictionaryBuilder() - .Set("48", "icon48.png") - .Set("128", "icon128.png")), - DictionaryBuilder(), action_type); + BuildExtension(DictionaryBuilder() + .Set("48", "icon48.png") + .Set("128", "icon128.png") + .Build(), + DictionaryBuilder().Build(), action_type); ASSERT_TRUE(extension.get()); const ExtensionAction* action = GetAction(action_type, *extension.get()); @@ -134,8 +137,8 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( // Test that the action's missing default_icons are not replaced with smaller // icons. extension = - BuildExtension(std::move(DictionaryBuilder().Set("24", "icon24.png")), - DictionaryBuilder(), action_type); + BuildExtension(DictionaryBuilder().Set("24", "icon24.png").Build(), + DictionaryBuilder().Build(), action_type); ASSERT_TRUE(extension.get()); action = GetAction(action_type, *extension.get()); @@ -147,10 +150,11 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( // Test that an action's 19px icon is not replaced if a 38px action icon // exists. extension = BuildExtension( - std::move(DictionaryBuilder().Set("128", "icon128.png")), - std::move(DictionaryBuilder().Set( - "default_icon", - std::move(DictionaryBuilder().Set("38", "action38.png")))), + DictionaryBuilder().Set("128", "icon128.png").Build(), + DictionaryBuilder() + .Set("default_icon", + DictionaryBuilder().Set("38", "action38.png").Build()) + .Build(), action_type); ASSERT_TRUE(extension.get()); @@ -160,15 +164,16 @@ void ExtensionActionManagerTest::TestPopulateMissingValues( ASSERT_FALSE(IconsMatch(*extension.get(), 128, *action, 19)); // Test that existing default_icons and default_title are not replaced. - extension = BuildExtension( - std::move(DictionaryBuilder().Set("128", "icon128.png")), - std::move( - DictionaryBuilder() - .Set("default_title", "Action!") - .Set("default_icon", std::move(DictionaryBuilder() - .Set("19", "action19.png") - .Set("38", "action38.png")))), - action_type); + extension = + BuildExtension(DictionaryBuilder().Set("128", "icon128.png").Build(), + DictionaryBuilder() + .Set("default_title", "Action!") + .Set("default_icon", DictionaryBuilder() + .Set("19", "action19.png") + .Set("38", "action38.png") + .Build()) + .Build(), + action_type); ASSERT_TRUE(extension.get()); action = GetAction(action_type, *extension.get()); @@ -192,11 +197,12 @@ TEST_F(ExtensionActionManagerTest, PopulatePageAction) { TEST_F(ExtensionActionManagerTest, GetBestFitActionTest) { // Create an extension with page action defaults. scoped_refptr<Extension> extension = BuildExtension( - std::move(DictionaryBuilder().Set("48", "icon48.png")), - std::move(DictionaryBuilder() - .Set("default_title", "Action!") - .Set("default_icon", std::move(DictionaryBuilder().Set( - "38", "action38.png")))), + DictionaryBuilder().Set("48", "icon48.png").Build(), + DictionaryBuilder() + .Set("default_title", "Action!") + .Set("default_icon", + DictionaryBuilder().Set("38", "action38.png").Build()) + .Build(), kPageAction); ASSERT_TRUE(extension.get()); @@ -213,8 +219,8 @@ TEST_F(ExtensionActionManagerTest, GetBestFitActionTest) { // Create a new extension without page action defaults. extension = - BuildExtension(std::move(DictionaryBuilder().Set("48", "icon48.png")), - DictionaryBuilder(), kPageAction); + BuildExtension(DictionaryBuilder().Set("48", "icon48.png").Build(), + DictionaryBuilder().Build(), kPageAction); ASSERT_TRUE(extension.get()); action = diff --git a/chrome/browser/extensions/extension_action_test_util.cc b/chrome/browser/extensions/extension_action_test_util.cc index b860331..e622d8e 100644 --- a/chrome/browser/extensions/extension_action_test_util.cc +++ b/chrome/browser/extensions/extension_action_test_util.cc @@ -150,10 +150,10 @@ scoped_refptr<const Extension> CreateActionExtension( } if (action_key) - manifest.Set(action_key, DictionaryBuilder()); + manifest.Set(action_key, DictionaryBuilder().Build()); return ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetID(crx_file::id_util::GenerateId(name)) .SetLocation(location) .Build(); diff --git a/chrome/browser/extensions/extension_context_menu_model_unittest.cc b/chrome/browser/extensions/extension_context_menu_model_unittest.cc index 4c14525..19951e0 100644 --- a/chrome/browser/extensions/extension_context_menu_model_unittest.cc +++ b/chrome/browser/extensions/extension_context_menu_model_unittest.cc @@ -160,13 +160,12 @@ const Extension* ExtensionContextMenuModelTest::AddExtensionWithHostPermission( manifest.Set("name", name) .Set("version", "1") .Set("manifest_version", 2) - .Set(action_key, DictionaryBuilder()); + .Set(action_key, DictionaryBuilder().Build()); if (!host_permission.empty()) - manifest.Set("permissions", - std::move(ListBuilder().Append(host_permission))); + manifest.Set("permissions", ListBuilder().Append(host_permission).Build()); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetID(crx_file::id_util::GenerateId(name)) .SetLocation(location) .Build(); @@ -234,7 +233,7 @@ TEST_F(ExtensionContextMenuModelTest, ComponentExtensionContextMenu) { .Set("name", name) .Set("version", "1") .Set("manifest_version", 2) - .Set("browser_action", DictionaryBuilder()) + .Set("browser_action", DictionaryBuilder().Build()) .Build(); { diff --git a/chrome/browser/extensions/extension_install_prompt_browsertest.cc b/chrome/browser/extensions/extension_install_prompt_browsertest.cc index 9bdb94e..78c6fc5 100644 --- a/chrome/browser/extensions/extension_install_prompt_browsertest.cc +++ b/chrome/browser/extensions/extension_install_prompt_browsertest.cc @@ -24,9 +24,10 @@ namespace { scoped_refptr<extensions::Extension> BuildTestExtension() { return extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0"))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Build()) .Build(); } diff --git a/chrome/browser/extensions/extension_install_prompt_unittest.cc b/chrome/browser/extensions/extension_install_prompt_unittest.cc index 0b53071..64b095a 100644 --- a/chrome/browser/extensions/extension_install_prompt_unittest.cc +++ b/chrome/browser/extensions/extension_install_prompt_unittest.cc @@ -103,11 +103,12 @@ TEST_F(ExtensionInstallPromptUnitTest, PromptShowsPermissionWarnings) { URLPatternSet(), URLPatternSet())); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Random Ext"))) + .SetManifest(DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Random Ext") + .Build()) .Build(); content::TestWebContentsFactory factory; @@ -132,16 +133,17 @@ TEST_F(ExtensionInstallPromptUnitTest, PromptShowsWithheldPermissions) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetManifest( - std::move(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"))))) + 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()) + .Build()) .Build(); content::TestWebContentsFactory factory; @@ -162,16 +164,16 @@ TEST_F(ExtensionInstallPromptUnitTest, DelegatedPromptShowsOptionalPermissions) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move( - 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"))))) + .SetManifest(DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Random Ext") + .Set("permissions", + ListBuilder().Append("clipboardRead").Build()) + .Set("optional_permissions", + ListBuilder().Append("tabs").Build()) + .Build()) .Build(); content::TestWebContentsFactory factory; diff --git a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc index ce14e6f..9cae7a2 100644 --- a/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc +++ b/chrome/browser/extensions/extension_message_bubble_controller_unittest.cc @@ -150,11 +150,11 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest( - std::move(DictionaryBuilder() - .Set("name", std::string("Extension " + index)) - .Set("version", "1.0") - .Set("manifest_version", 2))); + builder.SetManifest(DictionaryBuilder() + .Set("name", std::string("Extension " + index)) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Build()); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -169,13 +169,15 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(std::move( + builder.SetManifest( DictionaryBuilder() .Set("name", std::string("Extension " + index)) .Set("version", "1.0") .Set("manifest_version", 2) - .Set("browser_action", std::move(DictionaryBuilder().Set( - "default_title", "Default title"))))); + .Set("browser_action", DictionaryBuilder() + .Set("default_title", "Default title") + .Build()) + .Build()); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -190,14 +192,15 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest( - std::move(DictionaryBuilder() - .Set("name", std::string("Extension " + index)) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("chrome_settings_overrides", - std::move(DictionaryBuilder().Set( - "homepage", "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("homepage", "http://www.google.com") + .Build()) + .Build()); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -212,15 +215,17 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(std::move( + builder.SetManifest( DictionaryBuilder() .Set("name", std::string("Extension " + index)) .Set("version", "1.0") .Set("manifest_version", 2) .Set("chrome_settings_overrides", - std::move(DictionaryBuilder().Set( - "startup_pages", std::move(ListBuilder().Append( - "http://www.google.com"))))))); + DictionaryBuilder() + .Set("startup_pages", + ListBuilder().Append("http://www.google.com").Build()) + .Build()) + .Build()); builder.SetLocation(location); builder.SetID(id); service_->AddExtension(builder.Build().get()); @@ -235,13 +240,14 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(std::move( + builder.SetManifest( DictionaryBuilder() .Set("name", std::string("Extension " + index)) .Set("version", "1.0") .Set("manifest_version", 2) - .Set("chrome_url_overrides", std::move(DictionaryBuilder().Set( - "newtab", "Default.html"))))); + .Set("chrome_url_overrides", + DictionaryBuilder().Set("newtab", "Default.html").Build()) + .Build()); builder.SetLocation(location); builder.SetID(id); @@ -257,12 +263,13 @@ class ExtensionMessageBubbleTest : public BrowserWithTestWindowTest { const std::string& id, Manifest::Location location) { ExtensionBuilder builder; - builder.SetManifest(std::move( + builder.SetManifest( DictionaryBuilder() .Set("name", std::string("Extension " + index)) .Set("version", "1.0") .Set("manifest_version", 2) - .Set("permissions", std::move(ListBuilder().Append("proxy"))))); + .Set("permissions", ListBuilder().Append("proxy").Build()) + .Build()); builder.SetLocation(location); builder.SetID(id); diff --git a/chrome/browser/extensions/extension_messages_apitest.cc b/chrome/browser/extensions/extension_messages_apitest.cc index 682a3fa..ab7b6d0 100644 --- a/chrome/browser/extensions/extension_messages_apitest.cc +++ b/chrome/browser/extensions/extension_messages_apitest.cc @@ -522,10 +522,11 @@ IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, NotInstalled) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Fake extension") - .Set("version", "1") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Fake extension") + .Set("version", "1") + .Set("manifest_version", 2) + .Build()) .Build(); ui_test_utils::NavigateToURL(browser(), chromium_org_url()); @@ -1238,10 +1239,11 @@ IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, ExtensionBuilder() // A bit scary that this works... .SetID("invalid") - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Fake extension") - .Set("version", "1") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "Fake extension") + .Set("version", "1") + .Set("manifest_version", 2) + .Build()) .Build(); ui_test_utils::NavigateToURL(browser(), chromium_org_url()); diff --git a/chrome/browser/extensions/extension_migrator_unittest.cc b/chrome/browser/extensions/extension_migrator_unittest.cc index cad4349..3997092 100644 --- a/chrome/browser/extensions/extension_migrator_unittest.cc +++ b/chrome/browser/extensions/extension_migrator_unittest.cc @@ -24,8 +24,8 @@ const char kNewId[] = "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn"; scoped_refptr<Extension> CreateExtension(const std::string& id) { return ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "test").Set("version", "0.1"))) + .SetManifest( + DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build()) .SetID(id) .Build(); } diff --git a/chrome/browser/extensions/extension_prefs_unittest.cc b/chrome/browser/extensions/extension_prefs_unittest.cc index 1f2239d..e24698d 100644 --- a/chrome/browser/extensions/extension_prefs_unittest.cc +++ b/chrome/browser/extensions/extension_prefs_unittest.cc @@ -922,9 +922,10 @@ class ExtensionPrefsComponentExtension : public ExtensionPrefsTest { // Adding a component extension. component_extension_ = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set(manifest_keys::kName, "a") - .Set(manifest_keys::kVersion, "0.1"))) + .SetManifest(DictionaryBuilder() + .Set(manifest_keys::kName, "a") + .Set(manifest_keys::kVersion, "0.1") + .Build()) .SetLocation(Manifest::COMPONENT) .SetPath(prefs_.extensions_dir().AppendASCII("a")) .Build(); @@ -933,9 +934,10 @@ class ExtensionPrefsComponentExtension : public ExtensionPrefsTest { // Adding a non component extension. no_component_extension_ = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set(manifest_keys::kName, "b") - .Set(manifest_keys::kVersion, "0.1"))) + .SetManifest(DictionaryBuilder() + .Set(manifest_keys::kName, "b") + .Set(manifest_keys::kVersion, "0.1") + .Build()) .SetLocation(Manifest::INTERNAL) .SetPath(prefs_.extensions_dir().AppendASCII("b")) .Build(); diff --git a/chrome/browser/extensions/extension_reenabler_unittest.cc b/chrome/browser/extensions/extension_reenabler_unittest.cc index f0a0f12..292bb4e 100644 --- a/chrome/browser/extensions/extension_reenabler_unittest.cc +++ b/chrome/browser/extensions/extension_reenabler_unittest.cc @@ -136,11 +136,12 @@ TEST_F(ExtensionReenablerUnitTest, TestReenablingDisabledExtension) { // Create a simple extension and add it to the service. scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "test ext") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "a test ext"))) + .SetManifest(DictionaryBuilder() + .Set("name", "test ext") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "a test ext") + .Build()) .SetID(crx_file::id_util::GenerateId("test ext")) .Build(); service()->AddExtension(extension.get()); diff --git a/chrome/browser/extensions/extension_service_sync_unittest.cc b/chrome/browser/extensions/extension_service_sync_unittest.cc index 9c55350..2eb884b 100644 --- a/chrome/browser/extensions/extension_service_sync_unittest.cc +++ b/chrome/browser/extensions/extension_service_sync_unittest.cc @@ -1839,14 +1839,15 @@ TEST_F(ExtensionServiceSyncTest, SyncExtensionHasAllhostsWithheld) { scoped_refptr<const Extension> extension = extensions::ExtensionBuilder() .SetLocation(Manifest::INTERNAL) - .SetManifest(std::move( + .SetManifest( extensions::DictionaryBuilder() .Set("name", kName) .Set("description", "foo") .Set("manifest_version", 2) .Set("version", "1.0") .Set("permissions", - std::move(extensions::ListBuilder().Append("*://*/*"))))) + extensions::ListBuilder().Append("*://*/*").Build()) + .Build()) .SetID(crx_file::id_util::GenerateId(kName)) .Build(); diff --git a/chrome/browser/extensions/extension_web_ui_unittest.cc b/chrome/browser/extensions/extension_web_ui_unittest.cc index 12cb23a..f75a531 100644 --- a/chrome/browser/extensions/extension_web_ui_unittest.cc +++ b/chrome/browser/extensions/extension_web_ui_unittest.cc @@ -77,10 +77,10 @@ TEST_F(ExtensionWebUITest, ExtensionURLOverride) { manifest.Set(manifest_keys::kName, "ext1") .Set(manifest_keys::kVersion, "0.1") .Set(std::string(manifest_keys::kChromeURLOverrides), - std::move(DictionaryBuilder().Set("bookmarks", kOverrideResource))); + DictionaryBuilder().Set("bookmarks", kOverrideResource).Build()); scoped_refptr<Extension> ext_unpacked( ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetLocation(Manifest::UNPACKED) .SetID("abcdefghijabcdefghijabcdefghijaa") .Build()); @@ -112,10 +112,10 @@ TEST_F(ExtensionWebUITest, ExtensionURLOverride) { manifest2.Set(manifest_keys::kName, "ext2") .Set(manifest_keys::kVersion, "0.1") .Set(std::string(manifest_keys::kChromeURLOverrides), - std::move(DictionaryBuilder().Set("bookmarks", kOverrideResource2))); + DictionaryBuilder().Set("bookmarks", kOverrideResource2).Build()); scoped_refptr<Extension> ext_component( ExtensionBuilder() - .SetManifest(std::move(manifest2)) + .SetManifest(manifest2.Build()) .SetLocation(Manifest::COMPONENT) .SetID("bbabcdefghijabcdefghijabcdefghij") .Build()); diff --git a/chrome/browser/extensions/location_bar_controller_unittest.cc b/chrome/browser/extensions/location_bar_controller_unittest.cc index d6ee0e7..d34f821 100644 --- a/chrome/browser/extensions/location_bar_controller_unittest.cc +++ b/chrome/browser/extensions/location_bar_controller_unittest.cc @@ -73,14 +73,14 @@ class LocationBarControllerUnitTest : public ChromeRenderViewHostTestHarness { manifest.Set("name", name) .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("permissions", std::move(ListBuilder().Append("tabs"))); + .Set("permissions", ListBuilder().Append("tabs").Build()); if (has_page_actions) { - manifest.Set("page_action", std::move(DictionaryBuilder().Set( - "default_title", "Hello"))); + manifest.Set("page_action", + DictionaryBuilder().Set("default_title", "Hello").Build()); } scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetID(crx_file::id_util::GenerateId(name)) .Build(); extension_service_->AddExtension(extension.get()); diff --git a/chrome/browser/extensions/options_page_apitest.cc b/chrome/browser/extensions/options_page_apitest.cc index 62f4708..4026aae 100644 --- a/chrome/browser/extensions/options_page_apitest.cc +++ b/chrome/browser/extensions/options_page_apitest.cc @@ -78,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, .Set("manifest_version", 2) .Set("name", "Extension for options param test") .Set("options_ui", - std::move(DictionaryBuilder().Set("page", "options.html"))) + DictionaryBuilder().Set("page", "options.html").Build()) .Set("version", "1") .ToJSON()); diff --git a/chrome/browser/extensions/permission_messages_unittest.cc b/chrome/browser/extensions/permission_messages_unittest.cc index 81f3fa7..47d7034 100644 --- a/chrome/browser/extensions/permission_messages_unittest.cc +++ b/chrome/browser/extensions/permission_messages_unittest.cc @@ -53,29 +53,16 @@ class PermissionMessagesUnittest : public testing::Test { ~PermissionMessagesUnittest() override {} protected: - void CreateAndInstallAppWithPermissions(ListBuilder required_permissions, - ListBuilder optional_permissions) { - app_ = test_util::BuildApp(ExtensionBuilder()) - .MergeManifest( - 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(); - env_.GetExtensionService()->AddExtension(app_.get()); - } - void CreateAndInstallExtensionWithPermissions( - ListBuilder required_permissions, - ListBuilder optional_permissions) { + scoped_ptr<base::ListValue> required_permissions, + scoped_ptr<base::ListValue> optional_permissions) { app_ = test_util::BuildExtension(ExtensionBuilder()) .MergeManifest( DictionaryBuilder() .Set("permissions", std::move(required_permissions)) .Set("optional_permissions", - std::move(optional_permissions))) + std::move(optional_permissions)) + .Build()) .SetID(crx_file::id_util::GenerateId("extension")) .SetLocation(Manifest::INTERNAL) .Build(); @@ -136,7 +123,8 @@ class PermissionMessagesUnittest : public testing::Test { // other (the 'history' permission has superset permissions). TEST_F(PermissionMessagesUnittest, HistoryHidesTabsMessage) { CreateAndInstallExtensionWithPermissions( - std::move(ListBuilder().Append("tabs").Append("history")), ListBuilder()); + ListBuilder().Append("tabs").Append("history").Build(), + ListBuilder().Build()); ASSERT_EQ(1U, required_permissions().size()); EXPECT_EQ( @@ -150,8 +138,8 @@ TEST_F(PermissionMessagesUnittest, HistoryHidesTabsMessage) { // permission, only the new coalesced message is displayed. TEST_F(PermissionMessagesUnittest, MixedPermissionMessagesCoalesceOnceGranted) { CreateAndInstallExtensionWithPermissions( - std::move(ListBuilder().Append("tabs")), - std::move(ListBuilder().Append("history"))); + ListBuilder().Append("tabs").Build(), + ListBuilder().Append("history").Build()); ASSERT_EQ(1U, required_permissions().size()); EXPECT_EQ( @@ -189,8 +177,8 @@ TEST_F(PermissionMessagesUnittest, MixedPermissionMessagesCoalesceOnceGranted) { TEST_F(PermissionMessagesUnittest, AntiTest_PromptCanRequestSubsetOfAlreadyGrantedPermissions) { CreateAndInstallExtensionWithPermissions( - std::move(ListBuilder().Append("history")), - std::move(ListBuilder().Append("tabs"))); + ListBuilder().Append("history").Build(), + ListBuilder().Append("tabs").Build()); ASSERT_EQ(1U, required_permissions().size()); EXPECT_EQ( @@ -230,8 +218,8 @@ TEST_F(PermissionMessagesUnittest, TEST_F(PermissionMessagesUnittest, AntiTest_PromptCanBeEmptyButCausesChangeInPermissions) { CreateAndInstallExtensionWithPermissions( - std::move(ListBuilder().Append("tabs")), - std::move(ListBuilder().Append("sessions"))); + ListBuilder().Append("tabs").Build(), + ListBuilder().Append("sessions").Build()); ASSERT_EQ(1U, required_permissions().size()); EXPECT_EQ( diff --git a/chrome/browser/extensions/permissions_updater_unittest.cc b/chrome/browser/extensions/permissions_updater_unittest.cc index 0f39143..5c6b46e 100644 --- a/chrome/browser/extensions/permissions_updater_unittest.cc +++ b/chrome/browser/extensions/permissions_updater_unittest.cc @@ -44,14 +44,15 @@ scoped_refptr<const Extension> CreateExtensionWithOptionalPermissions( const std::string& name) { return ExtensionBuilder() .SetLocation(Manifest::INTERNAL) - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", name) .Set("description", "foo") .Set("manifest_version", 2) .Set("version", "0.1.2.3") .Set("permissions", std::move(permissions)) - .Set("optional_permissions", std::move(optional_permissions)))) + .Set("optional_permissions", std::move(optional_permissions)) + .Build()) .SetID(crx_file::id_util::GenerateId(name)) .Build(); } diff --git a/chrome/browser/extensions/process_manager_browsertest.cc b/chrome/browser/extensions/process_manager_browsertest.cc index 5608012..6a01909 100644 --- a/chrome/browser/extensions/process_manager_browsertest.cc +++ b/chrome/browser/extensions/process_manager_browsertest.cc @@ -105,13 +105,14 @@ class ProcessManagerBrowserTest : public ExtensionBrowserTest { .Set("content_security_policy", "script-src 'self' 'unsafe-eval'; object-src 'self'") .Set("sandbox", - std::move(DictionaryBuilder().Set( - "pages", std::move(ListBuilder().Append("sandboxed.html"))))) - .Set("web_accessible_resources", std::move(ListBuilder().Append("*"))); + DictionaryBuilder() + .Set("pages", ListBuilder().Append("sandboxed.html").Build()) + .Build()) + .Set("web_accessible_resources", ListBuilder().Append("*").Build()); if (has_background_process) { manifest.Set("background", - std::move(DictionaryBuilder().Set("page", "bg.html"))); + DictionaryBuilder().Set("page", "bg.html").Build()); dir->WriteFile(FILE_PATH_LITERAL("bg.html"), "<iframe id='bgframe' src='empty.html'></iframe>"); } diff --git a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc index 55add1c..7ef41e8 100644 --- a/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc +++ b/chrome/browser/extensions/scripting_permissions_modifier_unittest.cc @@ -42,20 +42,20 @@ scoped_refptr<const Extension> CreateExtensionWithPermissions( } DictionaryBuilder script; - script.Set("matches", std::move(scriptable_host_list)) - .Set("js", std::move(ListBuilder().Append("foo.js"))); + script.Set("matches", scriptable_host_list.Build()) + .Set("js", ListBuilder().Append("foo.js").Build()); return ExtensionBuilder() .SetLocation(location) - .SetManifest( - std::move(DictionaryBuilder() - .Set("name", name) - .Set("description", "foo") - .Set("manifest_version", 2) - .Set("version", "0.1.2.3") - .Set("content_scripts", - std::move(ListBuilder().Append(std::move(script)))) - .Set("permissions", std::move(explicit_host_list)))) + .SetManifest(DictionaryBuilder() + .Set("name", name) + .Set("description", "foo") + .Set("manifest_version", 2) + .Set("version", "0.1.2.3") + .Set("content_scripts", + ListBuilder().Append(script.Build()).Build()) + .Set("permissions", explicit_host_list.Build()) + .Build()) .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 11cd3be..4b7d123 100644 --- a/chrome/browser/extensions/shared_module_service_unittest.cc +++ b/chrome/browser/extensions/shared_module_service_unittest.cc @@ -38,8 +38,10 @@ scoped_refptr<Extension> CreateExtensionImportingModule( .Set("version", version) .Set("manifest_version", 2); if (!import_id.empty()) { - builder.Set("import", std::move(ListBuilder().Append(std::move( - DictionaryBuilder().Set("id", import_id))))); + builder.Set("import", + ListBuilder() + .Append(DictionaryBuilder().Set("id", import_id).Build()) + .Build()); } scoped_ptr<base::DictionaryValue> manifest = builder.Build(); @@ -131,8 +133,9 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUninstall) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - std::move(DictionaryBuilder().Set( - "resources", std::move(ListBuilder().Append("foo.js"))))) + DictionaryBuilder() + .Set("resources", ListBuilder().Append("foo.js").Build()) + .Build()) .Build(); scoped_refptr<Extension> shared_module = ExtensionBuilder() @@ -172,8 +175,9 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUpdate) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - std::move(DictionaryBuilder().Set( - "resources", std::move(ListBuilder().Append("foo.js"))))) + DictionaryBuilder() + .Set("resources", ListBuilder().Append("foo.js").Build()) + .Build()) .Build(); scoped_refptr<Extension> shared_module_1 = ExtensionBuilder() @@ -189,8 +193,9 @@ TEST_F(SharedModuleServiceUnitTest, PruneSharedModulesOnUpdate) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - std::move(DictionaryBuilder().Set( - "resources", std::move(ListBuilder().Append("foo.js"))))) + DictionaryBuilder() + .Set("resources", ListBuilder().Append("foo.js").Build()) + .Build()) .Build(); scoped_refptr<Extension> shared_module_2 = ExtensionBuilder() @@ -250,11 +255,11 @@ TEST_F(SharedModuleServiceUnitTest, WhitelistedImports) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - std::move( - DictionaryBuilder() - .Set("whitelist", - std::move(ListBuilder().Append(whitelisted_id))) - .Set("resources", std::move(ListBuilder().Append("*"))))) + DictionaryBuilder() + .Set("whitelist", + ListBuilder().Append(whitelisted_id).Build()) + .Set("resources", ListBuilder().Append("*").Build()) + .Build()) .Build(); scoped_refptr<Extension> shared_module = ExtensionBuilder() diff --git a/chrome/browser/extensions/test_extension_environment.cc b/chrome/browser/extensions/test_extension_environment.cc index a85b5d4..37f5628 100644 --- a/chrome/browser/extensions/test_extension_environment.cc +++ b/chrome/browser/extensions/test_extension_environment.cc @@ -60,11 +60,14 @@ scoped_ptr<base::DictionaryValue> MakePackagedAppManifest() { .Set("name", "Test App Name") .Set("version", "2.0") .Set("manifest_version", 2) - .Set("app", std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Build(); } diff --git a/chrome/browser/extensions/webstore_installer_browsertest.cc b/chrome/browser/extensions/webstore_installer_browsertest.cc index 0e301d2..92a080f 100644 --- a/chrome/browser/extensions/webstore_installer_browsertest.cc +++ b/chrome/browser/extensions/webstore_installer_browsertest.cc @@ -123,7 +123,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, WebstoreInstall) { .Set("description", "Foo") .Set("manifest_version", 2) .Set("version", "1.0") - .Set("permissions", std::move(ListBuilder().Append("tabs"))) + .Set("permissions", ListBuilder().Append("tabs").Build()) .Build()); content::WebContents* active_web_contents = @@ -156,7 +156,7 @@ IN_PROC_BROWSER_TEST_F(WebstoreInstallerBrowserTest, SimultaneousInstall) { .Set("description", "Foo") .Set("manifest_version", 2) .Set("version", "1.0") - .Set("permissions", std::move(ListBuilder().Append("tabs"))) + .Set("permissions", ListBuilder().Append("tabs").Build()) .Build()); content::WebContents* active_web_contents = diff --git a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc index 0f8accd..c5a6bb0 100644 --- a/chrome/browser/extensions/webstore_startup_installer_browsertest.cc +++ b/chrome/browser/extensions/webstore_startup_installer_browsertest.cc @@ -141,19 +141,21 @@ IN_PROC_BROWSER_TEST_F(WebstoreStartupInstallerTest, InstallFromHostedApp) { // 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(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "hosted app") .Set("version", "1") - .Set("app", - std::move( - DictionaryBuilder() - .Set("urls", std::move(ListBuilder().Append( - kInstallUrl.spec()))) - .Set("launch", - std::move(DictionaryBuilder().Set( - "web_url", kInstallUrl.spec()))))) - .Set("manifest_version", 2))) + .Set( + "app", + DictionaryBuilder() + .Set("urls", + ListBuilder().Append(kInstallUrl.spec()).Build()) + .Set("launch", DictionaryBuilder() + .Set("web_url", kInstallUrl.spec()) + .Build()) + .Build()) + .Set("manifest_version", 2) + .Build()) .Build(); ASSERT_TRUE(hosted_app.get()); diff --git a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc index 34bab35..bd6b447 100644 --- a/chrome/browser/metrics/extensions_metrics_provider_unittest.cc +++ b/chrome/browser/metrics/extensions_metrics_provider_unittest.cc @@ -50,29 +50,31 @@ class TestExtensionsMetricsProvider : public ExtensionsMetricsProvider { new extensions::ExtensionSet()); scoped_refptr<const extensions::Extension> extension; extension = extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .SetID("ahfgeienlihckogmohjhadlkjgocpleb") .Build(); extensions->Insert(extension); extension = extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "Test extension 2") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "Test extension 2") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) .SetID("pknkgggnfecklokoggaggchhaebkajji") .Build(); extensions->Insert(extension); - extension = - extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "Colliding Extension") - .Set("version", "1.0.0") - .Set("manifest_version", 2))) - .SetID("mdhofdjgenpkhlmddfaegdjddcecipmo") - .Build(); + extension = extensions::ExtensionBuilder() + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "Colliding Extension") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Build()) + .SetID("mdhofdjgenpkhlmddfaegdjddcecipmo") + .Build(); extensions->Insert(extension); return extensions; } diff --git a/chrome/browser/notifications/message_center_settings_controller_unittest.cc b/chrome/browser/notifications/message_center_settings_controller_unittest.cc index 538c845..a89a2a7 100644 --- a/chrome/browser/notifications/message_center_settings_controller_unittest.cc +++ b/chrome/browser/notifications/message_center_settings_controller_unittest.cc @@ -195,71 +195,84 @@ TEST_F(MessageCenterSettingsControllerTest, NotifierSortOrder) { // Baf is a hosted app which should not appear in the notifier list. const std::string kBafId = "dddddddddddddddddddddddddddddddd"; - foo_app.SetManifest(std::move( + foo_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Foo") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Set("permissions", - std::move(extensions::ListBuilder().Append("notifications"))))); + extensions::ListBuilder().Append("notifications").Build()) + .Build()); foo_app.SetID(kFooId); extension_service->AddExtension(foo_app.Build().get()); extensions::ExtensionBuilder bar_app; - bar_app.SetManifest(std::move( + bar_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "Bar") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Set("permissions", - std::move(extensions::ListBuilder().Append("notifications"))))); + extensions::ListBuilder().Append("notifications").Build()) + .Build()); bar_app.SetID(kBarId); extension_service->AddExtension(bar_app.Build().get()); extensions::ExtensionBuilder baz_app; - baz_app.SetManifest(std::move( + baz_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "baz") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Build()); baz_app.SetID(kBazId); extension_service->AddExtension(baz_app.Build().get()); extensions::ExtensionBuilder baf_app; - baf_app.SetManifest(std::move( + baf_app.SetManifest( extensions::DictionaryBuilder() .Set("name", "baf") .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "urls", - std::move(extensions::ListBuilder().Append( - "http://localhost/extensions/hosted_app/main.html"))))) - .Set( - "launch", - std::move(extensions::DictionaryBuilder().Set( - "urls", - std::move(extensions::ListBuilder().Append( - "http://localhost/extensions/hosted_app/main.html"))))))); + extensions::DictionaryBuilder() + .Set("urls", extensions::ListBuilder() + .Append("http://localhost/extensions/" + "hosted_app/main.html") + .Build()) + .Build()) + .Set("launch", + extensions::DictionaryBuilder() + .Set("urls", extensions::ListBuilder() + .Append("http://localhost/extensions/" + "hosted_app/main.html") + .Build()) + .Build()) + .Build()); 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 ed51422..282ed67 100644 --- a/chrome/browser/notifications/platform_notification_service_unittest.cc +++ b/chrome/browser/notifications/platform_notification_service_unittest.cc @@ -294,11 +294,12 @@ TEST_F(PlatformNotificationServiceTest, DisplayNameForContextMessage) { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() .SetID("honijodknafkokifofgiaalefdiedpko") - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "NotificationTest") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Test Extension"))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "NotificationTest") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Test Extension") + .Build()) .Build(); extensions::ExtensionRegistry* registry = @@ -333,14 +334,15 @@ TEST_F(PlatformNotificationServiceTest, ExtensionPermissionChecks) { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() .SetManifest( - std::move(extensions::DictionaryBuilder() - .Set("name", "NotificationTest") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Test Extension") - .Set("permissions", - std::move(extensions::ListBuilder().Append( - "notifications"))))) + extensions::DictionaryBuilder() + .Set("name", "NotificationTest") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Test Extension") + .Set( + "permissions", + extensions::ListBuilder().Append("notifications").Build()) + .Build()) .Build(); // Install the extension on the faked extension service, and verify that it @@ -382,11 +384,12 @@ TEST_F(PlatformNotificationServiceTest, CreateNotificationFromData) { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() .SetID("honijodknafkokifofgiaalefdiedpko") - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "NotificationTest") - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("description", "Test Extension"))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "NotificationTest") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("description", "Test Extension") + .Build()) .Build(); extensions::ExtensionRegistry* registry = diff --git a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc index f3d238c..45b3ab4 100644 --- a/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc +++ b/chrome/browser/policy/managed_bookmarks_policy_handler_unittest.cc @@ -80,45 +80,45 @@ TEST_F(ManagedBookmarksPolicyHandlerTest, ApplyPolicySettings) { scoped_ptr<base::Value> expected( extensions::ListBuilder() - .Append(std::move(extensions::DictionaryBuilder() - .Set("name", "Google") - .Set("url", "http://google.com/"))) - .Append(std::move(extensions::DictionaryBuilder() - .Set("name", "Empty Folder") - .Set("children", extensions::ListBuilder()))) - .Append(std::move( + .Append(extensions::DictionaryBuilder() + .Set("name", "Google") + .Set("url", "http://google.com/") + .Build()) + .Append(extensions::DictionaryBuilder() + .Set("name", "Empty Folder") + .Set("children", extensions::ListBuilder().Build()) + .Build()) + .Append( extensions::DictionaryBuilder() .Set("name", "Big Folder") - .Set( - "children", - std::move( - extensions::ListBuilder() - .Append(std::move( - extensions::DictionaryBuilder() - .Set("name", "Youtube") - .Set("url", "http://youtube.com/"))) - .Append(std::move( - extensions::DictionaryBuilder() - .Set("name", "Chromium") - .Set("url", "http://chromium.org/"))) - .Append(std::move( - extensions::DictionaryBuilder() - .Set("name", "More Stuff") - .Set( - "children", - std::move( - extensions::ListBuilder().Append( - std::move( - extensions:: - DictionaryBuilder() - .Set("name", - "Bugs") - .Set( - "url", - "http://" - "crbug." - "com" - "/"))))))))))) + .Set("children", + extensions::ListBuilder() + .Append(extensions::DictionaryBuilder() + .Set("name", "Youtube") + .Set("url", "http://youtube.com/") + .Build()) + .Append(extensions::DictionaryBuilder() + .Set("name", "Chromium") + .Set("url", "http://chromium.org/") + .Build()) + .Append( + extensions::DictionaryBuilder() + .Set("name", "More Stuff") + .Set("children", + extensions::ListBuilder() + .Append( + extensions::DictionaryBuilder() + .Set("name", "Bugs") + .Set("url", + "http://" + "crbug." + "com" + "/") + .Build()) + .Build()) + .Build()) + .Build()) + .Build()) .Build()); EXPECT_TRUE(pref_value->Equals(expected.get())); } @@ -168,9 +168,10 @@ TEST_F(ManagedBookmarksPolicyHandlerTest, UnknownKeys) { scoped_ptr<base::Value> expected( extensions::ListBuilder() - .Append(std::move(extensions::DictionaryBuilder() - .Set("name", "Google") - .Set("url", "http://google.com/"))) + .Append(extensions::DictionaryBuilder() + .Set("name", "Google") + .Set("url", "http://google.com/") + .Build()) .Build()); EXPECT_TRUE(pref_value->Equals(expected.get())); } @@ -211,9 +212,10 @@ TEST_F(ManagedBookmarksPolicyHandlerTest, BadBookmark) { scoped_ptr<base::Value> expected( extensions::ListBuilder() - .Append(std::move(extensions::DictionaryBuilder() - .Set("name", "Google") - .Set("url", "http://google.com/"))) + .Append(extensions::DictionaryBuilder() + .Set("name", "Google") + .Set("url", "http://google.com/") + .Build()) .Build()); EXPECT_TRUE(pref_value->Equals(expected.get())); } diff --git a/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc b/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc index 2320c93..97b7fb9 100644 --- a/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc +++ b/chrome/browser/safe_browsing/incident_reporting/extension_data_collection_unittest.cc @@ -84,12 +84,13 @@ void ExtensionTestingProfile::AddExtension(std::string extension_id, scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() .SetID(extension_id) - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", extension_name) - .Set("version", version) - .Set("manifest_version", 2) - .Set("description", description) - .Set("update_url", update_url))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", extension_name) + .Set("version", version) + .Set("manifest_version", 2) + .Set("description", description) + .Set("update_url", update_url) + .Build()) .Build(); // Install the extension on the faked extension service. diff --git a/chrome/browser/site_details_browsertest.cc b/chrome/browser/site_details_browsertest.cc index d24f0f1..e09c513 100644 --- a/chrome/browser/site_details_browsertest.cc +++ b/chrome/browser/site_details_browsertest.cc @@ -191,17 +191,18 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest { manifest.Set("name", name) .Set("version", "1.0") .Set("manifest_version", 2) - .Set("web_accessible_resources", - std::move(ListBuilder() - .Append("blank_iframe.html") - .Append("http_iframe.html") - .Append("two_http_iframes.html"))); + .Set("web_accessible_resources", ListBuilder() + .Append("blank_iframe.html") + .Append("http_iframe.html") + .Append("two_http_iframes.html") + .Build()); if (has_background_process) { manifest.Set( "background", - std::move(DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append("script.js"))))); + DictionaryBuilder() + .Set("scripts", ListBuilder().Append("script.js").Build()) + .Build()); dir->WriteFile(FILE_PATH_LITERAL("script.js"), "console.log('" + name + " running');"); } @@ -248,12 +249,13 @@ class SiteDetailsBrowserTest : public ExtensionBrowserTest { manifest.Set("name", name) .Set("version", "1.0") .Set("manifest_version", 2) - .Set("app", - std::move(DictionaryBuilder() - .Set("urls", - std::move(ListBuilder().Append(app_url.spec()))) - .Set("launch", std::move(DictionaryBuilder().Set( - "web_url", app_url.spec()))))); + .Set( + "app", + DictionaryBuilder() + .Set("urls", ListBuilder().Append(app_url.spec()).Build()) + .Set("launch", + DictionaryBuilder().Set("web_url", app_url.spec()).Build()) + .Build()); dir->WriteManifest(manifest.ToJSON()); const Extension* extension = LoadExtension(dir->unpacked_path()); diff --git a/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc b/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc index 8555077..e396145 100644 --- a/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc +++ b/chrome/browser/sync_file_system/drive_backend/sync_worker_unittest.cc @@ -205,10 +205,11 @@ TEST_F(SyncWorkerTest, UpdateRegisteredApps) { for (int i = 0; i < 3; i++) { scoped_refptr<const extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0") - .Set("manifest_version", 2))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Build()) .SetID(base::StringPrintf("app_%d", i)) .Build(); extension_service()->AddExtension(extension.get()); diff --git a/chrome/browser/ui/ash/keyboard_controller_browsertest.cc b/chrome/browser/ui/ash/keyboard_controller_browsertest.cc index f5b05ba..8915a39 100644 --- a/chrome/browser/ui/ash/keyboard_controller_browsertest.cc +++ b/chrome/browser/ui/ash/keyboard_controller_browsertest.cc @@ -158,10 +158,11 @@ IN_PROC_BROWSER_TEST_F(VirtualKeyboardAppWindowTest, DisableOverscrollForImeWindow) { scoped_refptr<extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "test extension") - .Set("version", "1") - .Set("manifest_version", 2))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "test extension") + .Set("version", "1") + .Set("manifest_version", 2) + .Build()) .Build(); extensions::AppWindow::CreateParams non_ime_params; diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm index 3bb9fa6..12c0018 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm @@ -79,16 +79,19 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { manifest.Set("manifest_version", 2); switch (type) { case PAGE_ACTION: - manifest.Set("page_action", DictionaryBuilder()); + manifest.Set("page_action", DictionaryBuilder().Build()); break; case BROWSER_ACTION: - manifest.Set("browser_action", DictionaryBuilder()); + manifest.Set("browser_action", DictionaryBuilder().Build()); break; case APP: - manifest.Set("app", - std::move(DictionaryBuilder().Set( - "launch", std::move(DictionaryBuilder().Set( - "web_url", "http://www.example.com"))))); + manifest.Set( + "app", + DictionaryBuilder() + .Set("launch", DictionaryBuilder() + .Set("web_url", "http://www.example.com") + .Build()) + .Build()); break; } @@ -96,16 +99,17 @@ class ExtensionInstalledBubbleControllerTest : public CocoaProfileTest { DictionaryBuilder command; command.Set(type == PAGE_ACTION ? "_execute_page_action" : "_execute_browser_action", - std::move(DictionaryBuilder().Set( - "suggested_key", - std::move(DictionaryBuilder() - .Set("mac", "MacCtrl+Shift+E") - .Set("default", "Ctrl+Shift+E"))))); - manifest.Set("commands", std::move(command)); + DictionaryBuilder() + .Set("suggested_key", DictionaryBuilder() + .Set("mac", "MacCtrl+Shift+E") + .Set("default", "Ctrl+Shift+E") + .Build()) + .Build()); + manifest.Set("commands", command.Build()); } extension_ = extensions::ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetID(crx_file::id_util::GenerateId("foo")) .SetLocation(location) .Build(); diff --git a/chrome/browser/ui/location_bar/location_bar_browsertest.cc b/chrome/browser/ui/location_bar/location_bar_browsertest.cc index 2520d72..9c2ce68 100644 --- a/chrome/browser/ui/location_bar/location_bar_browsertest.cc +++ b/chrome/browser/ui/location_bar/location_bar_browsertest.cc @@ -146,18 +146,19 @@ IN_PROC_BROWSER_TEST_F(LocationBarBrowserTest, // Create and install an extension that overrides the bookmark star. extensions::DictionaryBuilder chrome_ui_overrides; - chrome_ui_overrides.Set("bookmarks_ui", - std::move(extensions::DictionaryBuilder().SetBoolean( - "remove_button", true))); + chrome_ui_overrides.Set("bookmarks_ui", extensions::DictionaryBuilder() + .SetBoolean("remove_button", true) + .Build()); scoped_refptr<const extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( extensions::DictionaryBuilder() .Set("name", "overrides star") .Set("manifest_version", 2) .Set("version", "0.1") .Set("description", "override the star") - .Set("chrome_ui_overrides", std::move(chrome_ui_overrides)))) + .Set("chrome_ui_overrides", chrome_ui_overrides.Build()) + .Build()) .Build(); extension_service()->AddExtension(extension.get()); diff --git a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc index 5b9f6fa..2dd077c73 100644 --- a/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc +++ b/chrome/browser/ui/toolbar/browser_actions_bar_browsertest.cc @@ -45,9 +45,9 @@ scoped_refptr<const extensions::Extension> CreateExtension( Set("manifest_version", 2). Set("version", "1.0"); if (has_browser_action) - manifest.Set("browser_action", extensions::DictionaryBuilder()); + manifest.Set("browser_action", extensions::DictionaryBuilder().Build()); return extensions::ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetID(crx_file::id_util::GenerateId(name)) .Build(); } diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc index 5792bbf..60949f3 100644 --- a/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc +++ b/chrome/browser/ui/toolbar/toolbar_actions_model_unittest.cc @@ -1277,10 +1277,10 @@ TEST_F(ToolbarActionsModelUnitTest, ComponentExtensionsAddedToEnd) { .Set("description", "An extension") .Set("manifest_version", 2) .Set("version", "1.0.0") - .Set("browser_action", extensions::DictionaryBuilder()); + .Set("browser_action", extensions::DictionaryBuilder().Build()); scoped_refptr<const extensions::Extension> component_extension = extensions::ExtensionBuilder() - .SetManifest(std::move(manifest)) + .SetManifest(manifest.Build()) .SetID(crx_file::id_util::GenerateId(kName)) .SetLocation(extensions::Manifest::COMPONENT) .Build(); 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 418ee51..7ebe9d8 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 @@ -44,12 +44,14 @@ class AppInfoPermissionsPanelTest : public testing::Test { .Set("name", "Test App Name") .Set("version", "2.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))) + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Build(); } @@ -77,17 +79,19 @@ TEST_F(AppInfoPermissionsPanelTest, RequiredPermissionsObtainedCorrectly) { scoped_refptr<const extensions::Extension> app = extensions::ExtensionBuilder() .SetManifest(ValidAppManifest()) - .MergeManifest(extensions::DictionaryBuilder().Set( - "permissions", - std::move( - extensions::ListBuilder() - .Append("desktopCapture") // A valid permission with a - // message - .Append("bad_perm") // An invalid permission - .Append("cookies") // An valid permission with - // no message - .Append("serial")))) // A valid permission with a - // message + .MergeManifest( + extensions::DictionaryBuilder() + .Set("permissions", extensions::ListBuilder() + // A valid permission with a message + .Append("desktopCapture") + // An invalid permission + .Append("bad_perm") + // An valid permission with no message + .Append("cookies") + // A valid permission with a message + .Append("serial") + .Build()) + .Build()) .SetID(kTestExtensionId) .Build(); AppInfoPermissionsPanel panel(&profile_, app.get()); @@ -105,17 +109,19 @@ TEST_F(AppInfoPermissionsPanelTest, OptionalPermissionsObtainedCorrectly) { scoped_refptr<const extensions::Extension> app = extensions::ExtensionBuilder() .SetManifest(ValidAppManifest()) - .MergeManifest(extensions::DictionaryBuilder().Set( - "optional_permissions", - 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 + .MergeManifest(extensions::DictionaryBuilder() + .Set("optional_permissions", + extensions::ListBuilder() + // A valid permission with a message + .Append("clipboardRead") + // An invalid permission + .Append("bad_perm") + // A valid permission with no message + .Append("idle") + // Another valid permission with a message + .Append("serial") + .Build()) + .Build()) .SetID(kTestExtensionId) .Build(); AppInfoPermissionsPanel panel(&profile_, app.get()); @@ -133,12 +139,18 @@ TEST_F(AppInfoPermissionsPanelTest, RetainedFilePermissionsObtainedCorrectly) { scoped_refptr<const extensions::Extension> app = extensions::ExtensionBuilder() .SetManifest(ValidAppManifest()) - .MergeManifest(extensions::DictionaryBuilder().Set( - "permissions", - std::move(extensions::ListBuilder().Append( - std::move(extensions::DictionaryBuilder().Set( - "fileSystem", std::move(extensions::ListBuilder().Append( - "retainEntries")))))))) + .MergeManifest( + extensions::DictionaryBuilder() + .Set("permissions", + extensions::ListBuilder() + .Append(extensions::DictionaryBuilder() + .Set("fileSystem", + extensions::ListBuilder() + .Append("retainEntries") + .Build()) + .Build()) + .Build()) + .Build()) .SetID(kTestExtensionId) .Build(); AppInfoPermissionsPanel panel(&profile_, app.get()); diff --git a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc index 1aceb3c..12bb3ed 100644 --- a/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc +++ b/chrome/browser/ui/views/extensions/extension_uninstall_dialog_view_browsertest.cc @@ -17,9 +17,10 @@ namespace { scoped_refptr<extensions::Extension> BuildTestExtension() { return extensions::ExtensionBuilder() - .SetManifest(std::move(extensions::DictionaryBuilder() - .Set("name", "foo") - .Set("version", "1.0"))) + .SetManifest(extensions::DictionaryBuilder() + .Set("name", "foo") + .Set("version", "1.0") + .Build()) .Build(); } diff --git a/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc b/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc index 54efa24..35fff88 100644 --- a/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc +++ b/chrome/browser/ui/webui/media_router/media_router_ui_unittest.cc @@ -241,8 +241,9 @@ TEST_F(MediaRouterUITest, GetExtensionNameExtensionPresent) { make_scoped_ptr(new extensions::ExtensionRegistry(nullptr)); scoped_refptr<extensions::Extension> app = extensions::test_util::BuildApp(extensions::ExtensionBuilder()) - .MergeManifest( - extensions::DictionaryBuilder().Set("name", "test app name")) + .MergeManifest(extensions::DictionaryBuilder() + .Set("name", "test app name") + .Build()) .SetID(id) .Build(); diff --git a/chrome/browser/ui/webui/policy_ui_browsertest.cc b/chrome/browser/ui/webui/policy_ui_browsertest.cc index 2a4af9d..effcdc6 100644 --- a/chrome/browser/ui/webui/policy_ui_browsertest.cc +++ b/chrome/browser/ui/webui/policy_ui_browsertest.cc @@ -312,11 +312,11 @@ IN_PROC_BROWSER_TEST_F(PolicyUITest, ExtensionLoadAndSendPolicy) { manifest.Set("name", "test") .Set("version", "1") .Set("manifest_version", 2) - .Set("storage", std::move(storage)); + .Set("storage", storage.Build()); extensions::ExtensionBuilder builder; builder.SetPath(temp_dir_.path()); - builder.SetManifest(std::move(manifest)); + builder.SetManifest(manifest.Build()); // Install extension. ExtensionService* service = extensions::ExtensionSystem::Get( diff --git a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc index 11b571e..af963e0 100644 --- a/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc +++ b/chrome/browser/ui/webui/print_preview/extension_printer_handler.cc @@ -352,7 +352,7 @@ void ExtensionPrinterHandler::OnUsbDevicesEnumerated( continue; } - printer_list.Append(std::move( + printer_list.Append( DictionaryBuilder() .Set("id", GenerateProvisionalUsbPrinterId(extension.get(), device.get())) @@ -363,7 +363,8 @@ void ExtensionPrinterHandler::OnUsbDevicesEnumerated( device->product_string(), base::string16(), false)) .Set("extensionId", extension->id()) .Set("extensionName", extension->name()) - .Set("provisional", true))); + .Set("provisional", true) + .Build()); } } } diff --git a/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc b/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc index 7a15a01..14bc2c7 100644 --- a/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc +++ b/chrome/browser/ui/webui/uber/uber_ui_browsertest.cc @@ -64,13 +64,14 @@ IN_PROC_BROWSER_TEST_F(UberUIBrowserTest, HistoryOverride) { scoped_refptr<const extensions::Extension> extension = extensions::ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( extensions::DictionaryBuilder() .Set("name", "History Override") .Set("version", "1") .Set("manifest_version", 2) .Set("permission", - std::move(extensions::ListBuilder().Append("history"))))) + extensions::ListBuilder().Append("history").Build()) + .Build()) .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 b3ec6af..1747e22 100644 --- a/chrome/common/extensions/api/common_extension_api_unittest.cc +++ b/chrome/common/extensions/api/common_extension_api_unittest.cc @@ -205,23 +205,29 @@ TEST(ExtensionAPITest, APIFeatures) { TEST(ExtensionAPITest, IsAnyFeatureAvailableToContext) { scoped_refptr<const Extension> app = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "app") - .Set("app", std::move(DictionaryBuilder().Set( - "background", - std::move(DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append( - "background.js"))))))) + .Set("app", + DictionaryBuilder() + .Set("background", + DictionaryBuilder() + .Set("scripts", ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) .Set("version", "1") - .Set("manifest_version", 2))) + .Set("manifest_version", 2) + .Build()) .Build(); scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "extension") - .Set("version", "1") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "extension") + .Set("version", "1") + .Set("manifest_version", 2) + .Build()) .Build(); struct { @@ -832,8 +838,9 @@ TEST(ExtensionAPITest, ManifestKeys) { scoped_refptr<Extension> extension = BuildExtension(ExtensionBuilder()) - .MergeManifest( - DictionaryBuilder().Set("browser_action", DictionaryBuilder())) + .MergeManifest(DictionaryBuilder() + .Set("browser_action", DictionaryBuilder().Build()) + .Build()) .Build(); EXPECT_TRUE(extension_api->IsAvailable("browserAction", diff --git a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc index fdab935..516905b 100644 --- a/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc +++ b/chrome/common/extensions/api/extension_action/browser_action_manifest_unittest.cc @@ -27,13 +27,15 @@ TEST_F(BrowserActionManifestTest, BrowserActionManifestIcons_NoDefaultIcons) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "No default properties") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("browser_action", std::move(DictionaryBuilder().Set( - "default_title", "Title"))))) + .Set( + "browser_action", + DictionaryBuilder().Set("default_title", "Title").Build()) + .Build()) .Build(); ASSERT_TRUE(extension.get()); @@ -47,13 +49,15 @@ TEST_F(BrowserActionManifestTest, BrowserActionManifestIcons_StringDefaultIcon) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "String default icon") .Set("version", "1.0.0") .Set("manifest_version", 2) - .Set("browser_action", std::move(DictionaryBuilder().Set( - "default_icon", "icon.png"))))) + .Set("browser_action", DictionaryBuilder() + .Set("default_icon", "icon.png") + .Build()) + .Build()) .Build(); ASSERT_TRUE(extension.get()); @@ -74,18 +78,20 @@ TEST_F(BrowserActionManifestTest, // Arbitrary sizes should be allowed (useful for various scale factors). scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "Dictionary default icon") .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("browser_action", - std::move(DictionaryBuilder().Set( - "default_icon", - std::move(DictionaryBuilder() - .Set("19", "icon19.png") - .Set("24", "icon24.png") - .Set("38", "icon38.png"))))))) + DictionaryBuilder() + .Set("default_icon", DictionaryBuilder() + .Set("19", "icon19.png") + .Set("24", "icon24.png") + .Set("38", "icon38.png") + .Build()) + .Build()) + .Build()) .Build(); ASSERT_TRUE(extension.get()); @@ -111,12 +117,14 @@ TEST_F(BrowserActionManifestTest, .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("browser_action", - std::move(DictionaryBuilder().Set( - "default_icon", - std::move(DictionaryBuilder() - .Set("19", std::string()) // Invalid value. - .Set("24", "icon24.png") - .Set("38", "icon38.png"))))) + DictionaryBuilder() + .Set("default_icon", + DictionaryBuilder() + .Set("19", std::string()) // Invalid value. + .Set("24", "icon24.png") + .Set("38", "icon38.png") + .Build()) + .Build()) .Build(); base::string16 error = ErrorUtils::FormatErrorMessageUTF16( 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 66f10a2..97e65ea 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 @@ -37,24 +37,25 @@ TEST_F(FileBrowserHandlerManifestTest, GetHandlersRequiresPermission) { .Set("version", "1.0.0") .Set("manifest_version", 2) .Set("file_browser_handlers", - std::move(extensions::ListBuilder().Append(std::move( - extensions::DictionaryBuilder() - .Set("id", "open") - .Set("default_title", "open") - .Set("file_filters", - std::move(extensions::ListBuilder() - .Append("filesystem:*.txt") - .Append("filesystem:*.html"))))))); + extensions::ListBuilder() + .Append(extensions::DictionaryBuilder() + .Set("id", "open") + .Set("default_title", "open") + .Set("file_filters", extensions::ListBuilder() + .Append("filesystem:*.txt") + .Append("filesystem:*.html") + .Build()) + .Build()) + .Build()); scoped_ptr<base::DictionaryValue> bad_manifest_value( bad_manifest_builder.Build()); // Create a good manifest by extending the bad one with the missing // permission. - extensions::DictionaryBuilder good_manifest_builder( - *make_scoped_ptr(bad_manifest_value->DeepCopy()).get()); + extensions::DictionaryBuilder good_manifest_builder(*bad_manifest_value); good_manifest_builder.Set( "permissions", - std::move(extensions::ListBuilder().Append("fileBrowserHandler"))); + extensions::ListBuilder().Append("fileBrowserHandler").Build()); extensions::ExtensionBuilder bad_app_builder; bad_app_builder.SetManifest(std::move(bad_manifest_value)); @@ -62,7 +63,7 @@ TEST_F(FileBrowserHandlerManifestTest, GetHandlersRequiresPermission) { EXPECT_FALSE(FileBrowserHandler::GetHandlers(bad_app.get())); extensions::ExtensionBuilder good_app_builder; - good_app_builder.SetManifest(std::move(good_manifest_builder)); + good_app_builder.SetManifest(good_manifest_builder.Build()); scoped_refptr<extensions::Extension> good_app(good_app_builder.Build()); EXPECT_TRUE(FileBrowserHandler::GetHandlers(good_app.get())); } @@ -104,22 +105,26 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandler) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetManifest( - std::move(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(std::move( - DictionaryBuilder() - .Set("id", "ExtremelyCoolAction") - .Set("default_title", "Be Amazed") - .Set("default_icon", "icon.png") - .Set("file_filters", - std::move(ListBuilder().Append( - "filesystem:*.txt"))))))))) + DictionaryBuilder() + .Set("name", "file browser handler test") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("permissions", extensions::ListBuilder() + .Append("fileBrowserHandler") + .Build()) + .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") + .Build()) + .Build()) + .Build()) + .Build()) .Build(); ASSERT_TRUE(extension.get()); @@ -146,22 +151,26 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerMIMETypes) { ExtensionBuilder() .SetID(extension_misc::kQuickOfficeExtensionId) .SetManifest( - std::move(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(std::move( - DictionaryBuilder() - .Set("id", "ID") - .Set("default_title", "Default title") - .Set("default_icon", "icon.png") - .Set("file_filters", - std::move(ListBuilder().Append( - "filesystem:*.txt"))))))))) + DictionaryBuilder() + .Set("name", "file browser handler test") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("permissions", extensions::ListBuilder() + .Append("fileBrowserHandler") + .Build()) + .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") + .Build()) + .Build()) + .Build()) + .Build()) .Build(); ASSERT_TRUE(extension.get()); @@ -181,25 +190,29 @@ TEST_F(FileBrowserHandlerManifestTest, ValidFileBrowserHandlerWithCreate) { scoped_refptr<const Extension> extension = ExtensionBuilder() .SetManifest( - std::move(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(std::move( - 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"))))))))) + DictionaryBuilder() + .Set("name", "file browser handler test create") + .Set("version", "1.0.0") + .Set("manifest_version", 2) + .Set("permissions", extensions::ListBuilder() + .Append("fileBrowserHandler") + .Build()) + .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") + .Build()) + .Set("file_access", + ListBuilder().Append("create").Build()) + .Build()) + .Build()) + .Build()) .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 ff29ab3..fe583d9 100644 --- a/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc +++ b/chrome/common/extensions/features/chrome_channel_feature_filter_unittest.cc @@ -179,19 +179,20 @@ TEST_F(ChromeChannelFeatureFilterTest, SimpleFeatureAvailability) { scoped_ptr<base::DictionaryValue> rule( DictionaryBuilder() .Set("feature1", - std::move(ListBuilder() - .Append(std::move( - DictionaryBuilder() - .Set("channel", "beta") - .Set("extension_types", - std::move(ListBuilder().Append( - "extension"))))) - .Append(std::move( - DictionaryBuilder() - .Set("channel", "beta") - .Set("extension_types", - std::move(ListBuilder().Append( - "legacy_packaged_app"))))))) + ListBuilder() + .Append(DictionaryBuilder() + .Set("channel", "beta") + .Set("extension_types", + ListBuilder().Append("extension").Build()) + .Build()) + .Append(DictionaryBuilder() + .Set("channel", "beta") + .Set("extension_types", + ListBuilder() + .Append("legacy_packaged_app") + .Build()) + .Build()) + .Build()) .Build()); scoped_ptr<BaseFeatureProvider> provider( @@ -243,7 +244,7 @@ TEST_F(ChromeChannelFeatureFilterTest, ComplexFeatureAvailability) { scoped_ptr<base::DictionaryValue> rule( DictionaryBuilder() .Set("channel", "trunk") - .Set("extension_types", std::move(ListBuilder().Append("extension"))) + .Set("extension_types", ListBuilder().Append("extension").Build()) .Build()); simple_feature->Parse(rule.get()); features->push_back(std::move(simple_feature)); @@ -253,7 +254,7 @@ TEST_F(ChromeChannelFeatureFilterTest, ComplexFeatureAvailability) { rule = DictionaryBuilder() .Set("channel", "stable") .Set("extension_types", - std::move(ListBuilder().Append("legacy_packaged_app"))) + ListBuilder().Append("legacy_packaged_app").Build()) .Build(); simple_feature->Parse(rule.get()); features->push_back(std::move(simple_feature)); diff --git a/chrome/common/extensions/permissions/permission_set_unittest.cc b/chrome/common/extensions/permissions/permission_set_unittest.cc index 8617b5d..68e13b1 100644 --- a/chrome/common/extensions/permissions/permission_set_unittest.cc +++ b/chrome/common/extensions/permissions/permission_set_unittest.cc @@ -1308,7 +1308,7 @@ testing::AssertionResult ShowsAllHostsWarning(const std::string& pattern) { DictionaryBuilder() .Set("name", "TLDWildCardTest") .Set("version", "0.1.0") - .Set("permissions", std::move(ListBuilder().Append(pattern))) + .Set("permissions", ListBuilder().Append(pattern).Build()) .Build()) .Build(); diff --git a/chrome/common/extensions/permissions/permissions_data_unittest.cc b/chrome/common/extensions/permissions/permissions_data_unittest.cc index f2fe4a6..a6624e4 100644 --- a/chrome/common/extensions/permissions/permissions_data_unittest.cc +++ b/chrome/common/extensions/permissions/permissions_data_unittest.cc @@ -68,7 +68,7 @@ scoped_refptr<const Extension> GetExtensionWithHostPermission( .Set("description", "an extension") .Set("manifest_version", 2) .Set("version", "1.0.0") - .Set("permissions", std::move(permissions)) + .Set("permissions", permissions.Build()) .Build()) .SetLocation(location) .SetID(id) diff --git a/chrome/common/pepper_permission_util_unittest.cc b/chrome/common/pepper_permission_util_unittest.cc index 2684d5f..c2155d6 100644 --- a/chrome/common/pepper_permission_util_unittest.cc +++ b/chrome/common/pepper_permission_util_unittest.cc @@ -31,8 +31,10 @@ scoped_refptr<Extension> CreateExtensionImportingModule( .Set("name", "Has Dependent Modules") .Set("version", "1.0") .Set("manifest_version", 2) - .Set("import", std::move(ListBuilder().Append(std::move( - DictionaryBuilder().Set("id", import_id))))) + .Set("import", + ListBuilder() + .Append(DictionaryBuilder().Set("id", import_id).Build()) + .Build()) .Build(); return ExtensionBuilder() @@ -92,13 +94,13 @@ TEST(PepperPermissionUtilTest, SharedModuleWhitelisting) { .Set("version", "1.0") .Set("manifest_version", 2) .Set("export", - std::move( - DictionaryBuilder() - .Set("resources", std::move(ListBuilder().Append("*"))) - // Add the extension to the whitelist. This - // restricts import to |whitelisted_id| only. - .Set("whitelist", - std::move(ListBuilder().Append(whitelisted_id))))) + DictionaryBuilder() + .Set("resources", ListBuilder().Append("*").Build()) + // Add the extension to the whitelist. This + // restricts import to |whitelisted_id| only. + .Set("whitelist", + ListBuilder().Append(whitelisted_id).Build()) + .Build()) .Build(); scoped_refptr<Extension> shared_module = ExtensionBuilder().SetManifest(std::move(shared_module_manifest)).Build(); diff --git a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc index 1aa453c..c22784b 100644 --- a/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc +++ b/chrome/renderer/extensions/renderer_permissions_policy_delegate_unittest.cc @@ -51,12 +51,12 @@ class RendererPermissionsPolicyDelegateTest : public testing::Test { scoped_refptr<const Extension> CreateTestExtension(const std::string& id) { return ExtensionBuilder() .SetManifest( - std::move(DictionaryBuilder() - .Set("name", "Extension with ID " + id) - .Set("version", "1.0") - .Set("manifest_version", 2) - .Set("permissions", - std::move(ListBuilder().Append("<all_urls>"))))) + DictionaryBuilder() + .Set("name", "Extension with ID " + id) + .Set("version", "1.0") + .Set("manifest_version", 2) + .Set("permissions", ListBuilder().Append("<all_urls>").Build()) + .Build()) .SetID(id) .Build(); } diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc index 701a28d..597d738 100644 --- a/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc +++ b/extensions/browser/api/bluetooth/bluetooth_event_router_unittest.cc @@ -83,10 +83,11 @@ TEST_F(BluetoothEventRouterTest, MultipleBluetoothEventListeners) { TEST_F(BluetoothEventRouterTest, UnloadExtension) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "BT event router test") - .Set("version", "1.0") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "BT event router test") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Build()) .SetID(kTestExtensionId) .Build(); diff --git a/extensions/browser/api/device_permissions_prompt_unittest.cc b/extensions/browser/api/device_permissions_prompt_unittest.cc index 9c2d22c..ba6a07e 100644 --- a/extensions/browser/api/device_permissions_prompt_unittest.cc +++ b/extensions/browser/api/device_permissions_prompt_unittest.cc @@ -19,10 +19,11 @@ class DevicePermissionsPromptTest : public testing::Test {}; TEST_F(DevicePermissionsPromptTest, HidPromptMessages) { scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test Application") - .Set("manifest_version", 2) - .Set("version", "1.0"))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test Application") + .Set("manifest_version", 2) + .Set("version", "1.0") + .Build()) .Build(); scoped_refptr<DevicePermissionsPrompt::Prompt> prompt = @@ -47,10 +48,11 @@ TEST_F(DevicePermissionsPromptTest, HidPromptMessages) { TEST_F(DevicePermissionsPromptTest, UsbPromptMessages) { scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test Application") - .Set("manifest_version", 2) - .Set("version", "1.0"))) + .SetManifest(DictionaryBuilder() + .Set("name", "Test Application") + .Set("manifest_version", 2) + .Set("version", "1.0") + .Build()) .Build(); scoped_refptr<DevicePermissionsPrompt::Prompt> prompt = diff --git a/extensions/browser/api_unittest.cc b/extensions/browser/api_unittest.cc index f0c0f61..0496563 100644 --- a/extensions/browser/api_unittest.cc +++ b/extensions/browser/api_unittest.cc @@ -44,12 +44,13 @@ void ApiUnitTest::SetUp() { content::TestBrowserThreadBundle::DEFAULT)); user_prefs::UserPrefs::Set(browser_context(), &testing_pref_service_); - extension_ = - ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "Test").Set("version", "1.0"))) - .SetLocation(Manifest::UNPACKED) - .Build(); + extension_ = ExtensionBuilder() + .SetManifest(DictionaryBuilder() + .Set("name", "Test") + .Set("version", "1.0") + .Build()) + .SetLocation(Manifest::UNPACKED) + .Build(); } void ApiUnitTest::CreateBackgroundPage() { diff --git a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc index 491f614..3c664c6 100644 --- a/extensions/browser/app_window/app_window_geometry_cache_unittest.cc +++ b/extensions/browser/app_window/app_window_geometry_cache_unittest.cc @@ -36,8 +36,8 @@ const char kWindowId2[] = "windowid2"; // Create a very simple extension with id. scoped_refptr<Extension> CreateExtension(const std::string& id) { return ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "test").Set("version", "0.1"))) + .SetManifest( + DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build()) .SetID(id) .Build(); } @@ -163,8 +163,10 @@ std::string AppWindowGeometryCacheTest::AddExtensionWithPrefs( browser_context()->GetPath().AppendASCII("Extensions").AppendASCII(name); scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "test").Set("version", "0.1"))) + .SetManifest(DictionaryBuilder() + .Set("name", "test") + .Set("version", "0.1") + .Build()) .SetPath(path) .Build(); diff --git a/extensions/browser/lazy_background_task_queue_unittest.cc b/extensions/browser/lazy_background_task_queue_unittest.cc index a2b82eb..02ec3bb 100644 --- a/extensions/browser/lazy_background_task_queue_unittest.cc +++ b/extensions/browser/lazy_background_task_queue_unittest.cc @@ -82,10 +82,11 @@ class LazyBackgroundTaskQueueTest : public ExtensionsTest { scoped_refptr<Extension> CreateSimpleExtension() { scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "No background") - .Set("version", "1") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "No background") + .Set("version", "1") + .Set("manifest_version", 2) + .Build()) .SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .Build(); ExtensionRegistry::Get(browser_context())->AddEnabled(extension); @@ -96,15 +97,16 @@ class LazyBackgroundTaskQueueTest : public ExtensionsTest { scoped_refptr<Extension> CreateLazyBackgroundExtension() { scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "Lazy background") .Set("version", "1") .Set("manifest_version", 2) - .Set("background", - std::move(DictionaryBuilder() - .Set("page", "background.html") - .SetBoolean("persistent", false))))) + .Set("background", DictionaryBuilder() + .Set("page", "background.html") + .SetBoolean("persistent", false) + .Build()) + .Build()) .SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb") .Build(); ExtensionRegistry::Get(browser_context())->AddEnabled(extension); diff --git a/extensions/browser/mojo/keep_alive_impl_unittest.cc b/extensions/browser/mojo/keep_alive_impl_unittest.cc index c1f4810..5d640e0 100644 --- a/extensions/browser/mojo/keep_alive_impl_unittest.cc +++ b/extensions/browser/mojo/keep_alive_impl_unittest.cc @@ -28,17 +28,21 @@ class KeepAliveTest : public ExtensionsTest { message_loop_.reset(new base::MessageLoop); extension_ = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "app") .Set("version", "1") .Set("manifest_version", 2) - .Set("app", - std::move(DictionaryBuilder().Set( - "background", - std::move(DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append( - "background.js"))))))))) + .Set("app", DictionaryBuilder() + .Set("background", + DictionaryBuilder() + .Set("scripts", + ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Build()) .SetID("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") .Build(); } @@ -110,16 +114,21 @@ TEST_F(KeepAliveTest, UnloadExtension) { scoped_refptr<const Extension> other_extension = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "app") .Set("version", "1") .Set("manifest_version", 2) - .Set("app", std::move(DictionaryBuilder().Set( - "background", - std::move(DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append( - "background.js"))))))))) + .Set("app", + DictionaryBuilder() + .Set("background", + DictionaryBuilder() + .Set("scripts", ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Build()) .SetID("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb") .Build(); diff --git a/extensions/browser/runtime_data_unittest.cc b/extensions/browser/runtime_data_unittest.cc index 6e522a4..790dd25 100644 --- a/extensions/browser/runtime_data_unittest.cc +++ b/extensions/browser/runtime_data_unittest.cc @@ -21,12 +21,12 @@ namespace { // Creates a very simple extension with a background page. scoped_refptr<Extension> CreateExtensionWithBackgroundPage() { return ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder() - .Set("name", "test") - .Set("version", "0.1") - .Set("background", - std::move(DictionaryBuilder().Set("page", "bg.html"))))) + .SetManifest(DictionaryBuilder() + .Set("name", "test") + .Set("version", "0.1") + .Set("background", + DictionaryBuilder().Set("page", "bg.html").Build()) + .Build()) .SetID("id2") .Build(); } diff --git a/extensions/browser/updater/update_service_unittest.cc b/extensions/browser/updater/update_service_unittest.cc index 94bfad3..67c3087 100644 --- a/extensions/browser/updater/update_service_unittest.cc +++ b/extensions/browser/updater/update_service_unittest.cc @@ -183,10 +183,11 @@ TEST_F(UpdateServiceTest, BasicUpdateOperations) { ASSERT_TRUE(AddFileToDirectory(temp_dir.path(), bar_html, "world")); ExtensionBuilder builder; - builder.SetManifest(std::move(DictionaryBuilder() - .Set("name", "Foo") - .Set("version", "1.0") - .Set("manifest_version", 2))); + builder.SetManifest(DictionaryBuilder() + .Set("name", "Foo") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Build()); builder.SetID(crx_file::id_util::GenerateId("whatever")); builder.SetPath(temp_dir.path()); diff --git a/extensions/browser/value_store/value_store_change_unittest.cc b/extensions/browser/value_store/value_store_change_unittest.cc index 123385b..895f1ac 100644 --- a/extensions/browser/value_store/value_store_change_unittest.cc +++ b/extensions/browser/value_store/value_store_change_unittest.cc @@ -61,7 +61,7 @@ TEST(ValueStoreChangeTest, ToJson) { DictionaryBuilder() .Set("key", "value") .Set("key.with.dots", "value.with.dots") - .Set("tricked", std::move(DictionaryBuilder().Set("you", "nodots"))) + .Set("tricked", DictionaryBuilder().Set("you", "nodots").Build()) .Set("tricked.you", "with.dots") .Build(); @@ -81,12 +81,14 @@ TEST(ValueStoreChangeTest, ToJson) { DictionaryBuilder v4(*value); scoped_ptr<base::DictionaryValue> expected_from_json = DictionaryBuilder() - .Set("key", std::move(DictionaryBuilder() - .Set("oldValue", std::move(v1)) - .Set("newValue", std::move(v2)))) - .Set("key.with.dots", std::move(DictionaryBuilder() - .Set("oldValue", std::move(v3)) - .Set("newValue", std::move(v4)))) + .Set("key", DictionaryBuilder() + .Set("oldValue", v1.Build()) + .Set("newValue", v2.Build()) + .Build()) + .Set("key.with.dots", DictionaryBuilder() + .Set("oldValue", v3.Build()) + .Set("newValue", v4.Build()) + .Build()) .Build(); EXPECT_TRUE(from_json->Equals(expected_from_json.get())); diff --git a/extensions/common/extension_builder.cc b/extensions/common/extension_builder.cc index 9e41166..905ba6b 100644 --- a/extensions/common/extension_builder.cc +++ b/extensions/common/extension_builder.cc @@ -61,8 +61,9 @@ ExtensionBuilder& ExtensionBuilder::SetManifest( return *this; } -ExtensionBuilder& ExtensionBuilder::MergeManifest(DictionaryBuilder& builder) { - manifest_->MergeDictionary(builder.Build().get()); +ExtensionBuilder& ExtensionBuilder::MergeManifest( + scoped_ptr<base::DictionaryValue> manifest) { + manifest_->MergeDictionary(manifest.get()); return *this; } diff --git a/extensions/common/extension_builder.h b/extensions/common/extension_builder.h index 4734baa..5fe9801 100644 --- a/extensions/common/extension_builder.h +++ b/extensions/common/extension_builder.h @@ -40,13 +40,10 @@ class ExtensionBuilder { ExtensionBuilder& SetLocation(Manifest::Location location); ExtensionBuilder& SetManifest(scoped_ptr<base::DictionaryValue> manifest); - ExtensionBuilder& SetManifest(DictionaryBuilder manifest_builder) { - return SetManifest(manifest_builder.Build()); - } - // Adds the keys from the DictionaryBuilder to the manifest, with new keys - // taking precedence. - ExtensionBuilder& MergeManifest(DictionaryBuilder& builder); + // Merge another manifest into the current manifest, with new keys taking + // precedence. + ExtensionBuilder& MergeManifest(scoped_ptr<base::DictionaryValue> manifest); ExtensionBuilder& AddFlags(int init_from_value_flags); diff --git a/extensions/common/features/base_feature_provider_unittest.cc b/extensions/common/features/base_feature_provider_unittest.cc index 43e0ce2..e601cfa5 100644 --- a/extensions/common/features/base_feature_provider_unittest.cc +++ b/extensions/common/features/base_feature_provider_unittest.cc @@ -46,10 +46,11 @@ TEST(BaseFeatureProviderTest, ManifestFeatureAvailability) { scoped_refptr<const Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "test extension") - .Set("version", "1") - .Set("description", "hello there"))) + .SetManifest(DictionaryBuilder() + .Set("name", "test extension") + .Set("version", "1") + .Set("description", "hello there") + .Build()) .Build(); ASSERT_TRUE(extension.get()); @@ -100,17 +101,21 @@ TEST(BaseFeatureProviderTest, PermissionFeatureAvailability) { scoped_refptr<const Extension> app = ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "test app") .Set("version", "1") - .Set("app", std::move(DictionaryBuilder().Set( - "background", - std::move(DictionaryBuilder().Set( - "scripts", std::move(ListBuilder().Append( - "background.js"))))))) - .Set("permissions", - std::move(ListBuilder().Append("power"))))) + .Set("app", + DictionaryBuilder() + .Set("background", + DictionaryBuilder() + .Set("scripts", ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Set("permissions", ListBuilder().Append("power").Build()) + .Build()) .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 0dd7c8f..f60c900 100644 --- a/extensions/common/features/complex_feature_unittest.cc +++ b/extensions/common/features/complex_feature_unittest.cc @@ -24,8 +24,8 @@ TEST(ComplexFeatureTest, MultipleRulesWhitelist) { scoped_ptr<SimpleFeature> simple_feature(new SimpleFeature); scoped_ptr<base::DictionaryValue> rule( DictionaryBuilder() - .Set("whitelist", std::move(ListBuilder().Append(kIdFoo))) - .Set("extension_types", std::move(ListBuilder().Append("extension"))) + .Set("whitelist", ListBuilder().Append(kIdFoo).Build()) + .Set("extension_types", ListBuilder().Append("extension").Build()) .Build()); simple_feature->Parse(rule.get()); features->push_back(std::move(simple_feature)); @@ -33,9 +33,9 @@ TEST(ComplexFeatureTest, MultipleRulesWhitelist) { // Rule: "legacy_packaged_app", whitelist "bar". simple_feature.reset(new SimpleFeature); rule = DictionaryBuilder() - .Set("whitelist", std::move(ListBuilder().Append(kIdBar))) + .Set("whitelist", ListBuilder().Append(kIdBar).Build()) .Set("extension_types", - std::move(ListBuilder().Append("legacy_packaged_app"))) + ListBuilder().Append("legacy_packaged_app").Build()) .Build(); simple_feature->Parse(rule.get()); features->push_back(std::move(simple_feature)); @@ -86,8 +86,8 @@ TEST(ComplexFeatureTest, Dependencies) { scoped_ptr<SimpleFeature> simple_feature(new SimpleFeature); scoped_ptr<base::DictionaryValue> rule = DictionaryBuilder() - .Set("dependencies", std::move(ListBuilder().Append( - "manifest:content_security_policy"))) + .Set("dependencies", + ListBuilder().Append("manifest:content_security_policy").Build()) .Build(); simple_feature->Parse(rule.get()); features->push_back(std::move(simple_feature)); @@ -96,7 +96,7 @@ TEST(ComplexFeatureTest, Dependencies) { simple_feature.reset(new SimpleFeature); rule = DictionaryBuilder() .Set("dependencies", - std::move(ListBuilder().Append("permission:serial"))) + ListBuilder().Append("permission:serial").Build()) .Build(); simple_feature->Parse(rule.get()); features->push_back(std::move(simple_feature)); diff --git a/extensions/common/manifest_handler_unittest.cc b/extensions/common/manifest_handler_unittest.cc index 3e01d49..cbccf12 100644 --- a/extensions/common/manifest_handler_unittest.cc +++ b/extensions/common/manifest_handler_unittest.cc @@ -186,17 +186,19 @@ TEST_F(ManifestHandlerTest, DependentHandlers) { scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder() - .Set("name", "no name") - .Set("version", "0") - .Set("manifest_version", 2) - .Set("a", 1) - .Set("b", 2) - .Set("c", std::move( - DictionaryBuilder().Set("d", 3).Set("e", 4).Set( - "f", 5))) - .Set("g", 6))) + .SetManifest(DictionaryBuilder() + .Set("name", "no name") + .Set("version", "0") + .Set("manifest_version", 2) + .Set("a", 1) + .Set("b", 2) + .Set("c", DictionaryBuilder() + .Set("d", 3) + .Set("e", 4) + .Set("f", 5) + .Build()) + .Set("g", 6) + .Build()) .Build(); // A, B, C.EZ, C.D, K @@ -248,12 +250,13 @@ TEST_F(ManifestHandlerTest, Validate) { ScopedTestingManifestHandlerRegistry registry; scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "no name") - .Set("version", "0") - .Set("manifest_version", 2) - .Set("a", 1) - .Set("b", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "no name") + .Set("version", "0") + .Set("manifest_version", 2) + .Set("a", 1) + .Set("b", 2) + .Build()) .Build(); EXPECT_TRUE(extension.get()); diff --git a/extensions/common/test_util.cc b/extensions/common/test_util.cc index e3775e5..c065c29 100644 --- a/extensions/common/test_util.cc +++ b/extensions/common/test_util.cc @@ -14,39 +14,43 @@ namespace extensions { namespace test_util { ExtensionBuilder BuildExtension(ExtensionBuilder builder) { - builder.SetManifest(std::move(DictionaryBuilder() - .Set("name", "Test extension") - .Set("version", "1.0") - .Set("manifest_version", 2))); + builder.SetManifest(DictionaryBuilder() + .Set("name", "Test extension") + .Set("version", "1.0") + .Set("manifest_version", 2) + .Build()); return builder; } ExtensionBuilder BuildApp(ExtensionBuilder builder) { - builder.SetManifest(std::move( + builder.SetManifest( DictionaryBuilder() .Set("name", "Test extension") .Set("version", "1.0") .Set("manifest_version", 2) - .Set("app", - std::move(extensions::DictionaryBuilder().Set( - "background", - std::move(extensions::DictionaryBuilder().Set( - "scripts", std::move(extensions::ListBuilder().Append( - "background.js"))))))))); + .Set("app", extensions::DictionaryBuilder() + .Set("background", + extensions::DictionaryBuilder() + .Set("scripts", extensions::ListBuilder() + .Append("background.js") + .Build()) + .Build()) + .Build()) + .Build()); return builder; } scoped_refptr<Extension> CreateEmptyExtension() { return ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "Test").Set("version", "1.0"))) + .SetManifest( + DictionaryBuilder().Set("name", "Test").Set("version", "1.0").Build()) .Build(); } scoped_refptr<Extension> CreateEmptyExtension(const std::string& id) { return ExtensionBuilder() - .SetManifest(std::move( - DictionaryBuilder().Set("name", "test").Set("version", "0.1"))) + .SetManifest( + DictionaryBuilder().Set("name", "test").Set("version", "0.1").Build()) .SetID(id) .Build(); } diff --git a/extensions/common/value_builder.cc b/extensions/common/value_builder.cc index 987bbb4..efc2e44 100644 --- a/extensions/common/value_builder.cc +++ b/extensions/common/value_builder.cc @@ -20,14 +20,6 @@ DictionaryBuilder::DictionaryBuilder(const base::DictionaryValue& init) DictionaryBuilder::~DictionaryBuilder() {} -DictionaryBuilder::DictionaryBuilder(DictionaryBuilder&& other) - : dict_(other.Build()) {} - -DictionaryBuilder& DictionaryBuilder::operator=(DictionaryBuilder&& other) { - dict_ = other.Build(); - return *this; -} - std::string DictionaryBuilder::ToJSON() const { std::string json; base::JSONWriter::WriteWithOptions( @@ -60,18 +52,6 @@ DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, } DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, - DictionaryBuilder in_value) { - dict_->SetWithoutPathExpansion(path, in_value.Build()); - return *this; -} - -DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, - ListBuilder in_value) { - dict_->SetWithoutPathExpansion(path, in_value.Build()); - return *this; -} - -DictionaryBuilder& DictionaryBuilder::Set(const std::string& path, scoped_ptr<base::Value> in_value) { dict_->SetWithoutPathExpansion(path, std::move(in_value)); return *this; @@ -90,14 +70,6 @@ ListBuilder::ListBuilder(const base::ListValue& init) : list_(init.DeepCopy()) { } ListBuilder::~ListBuilder() {} -ListBuilder::ListBuilder(ListBuilder&& other) - : list_(other.Build()) {} - -ListBuilder& ListBuilder::operator=(ListBuilder&& other) { - list_ = other.Build(); - return *this; -} - ListBuilder& ListBuilder::Append(int in_value) { list_->Append(new base::FundamentalValue(in_value)); return *this; @@ -118,13 +90,8 @@ ListBuilder& ListBuilder::Append(const base::string16& in_value) { return *this; } -ListBuilder& ListBuilder::Append(DictionaryBuilder in_value) { - list_->Append(in_value.Build()); - return *this; -} - -ListBuilder& ListBuilder::Append(ListBuilder in_value) { - list_->Append(in_value.Build()); +ListBuilder& ListBuilder::Append(scoped_ptr<base::Value> in_value) { + list_->Append(std::move(in_value)); return *this; } diff --git a/extensions/common/value_builder.h b/extensions/common/value_builder.h index d746904..27c4e01 100644 --- a/extensions/common/value_builder.h +++ b/extensions/common/value_builder.h @@ -6,19 +6,13 @@ // aren't specific to extensions and could move up to base/ if there's interest // from other sub-projects. // -// The general pattern is to write: +// The pattern is to write: // // scoped_ptr<BuiltType> result(FooBuilder() // .Set(args) // .Set(args) // .Build()); // -// For methods that take other built types, you can pass the builder directly -// to the setter without calling Build(): -// -// 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. // @@ -52,10 +46,6 @@ class DictionaryBuilder { explicit DictionaryBuilder(const base::DictionaryValue& init); ~DictionaryBuilder(); - // Move constructor and operator=. - DictionaryBuilder(DictionaryBuilder&& other); - DictionaryBuilder& operator=(DictionaryBuilder&& other); - // Can only be called once, after which it's invalid to use the builder. scoped_ptr<base::DictionaryValue> Build() { return std::move(dict_); } @@ -68,8 +58,6 @@ class DictionaryBuilder { DictionaryBuilder& Set(const std::string& path, const std::string& in_value); 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, scoped_ptr<base::Value> in_value); @@ -87,10 +75,6 @@ class ListBuilder { explicit ListBuilder(const base::ListValue& init); ~ListBuilder(); - // 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 std::move(list_); } @@ -98,8 +82,7 @@ class ListBuilder { 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(scoped_ptr<base::Value> in_value); // Named differently because overload resolution is too eager to // convert implicitly to bool. diff --git a/extensions/common/value_builder_unittest.cc b/extensions/common/value_builder_unittest.cc index 7c47451..1f1c14e 100644 --- a/extensions/common/value_builder_unittest.cc +++ b/extensions/common/value_builder_unittest.cc @@ -20,9 +20,8 @@ TEST(ValueBuilderTest, Basic) { scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue); ASSERT_FALSE(settings->GetList("permissions", nullptr)); - settings = DictionaryBuilder() - .Set("permissions", std::move(permission_list)) - .Build(); + settings = + DictionaryBuilder().Set("permissions", permission_list.Build()).Build(); base::ListValue* list_value; ASSERT_TRUE(settings->GetList("permissions", &list_value)); diff --git a/extensions/shell/browser/api/identity/identity_api_unittest.cc b/extensions/shell/browser/api/identity/identity_api_unittest.cc index bf9248c..0af6e4b1 100644 --- a/extensions/shell/browser/api/identity/identity_api_unittest.cc +++ b/extensions/shell/browser/api/identity/identity_api_unittest.cc @@ -65,18 +65,21 @@ class IdentityApiTest : public ApiUnitTest { // Create an extension with OAuth2 scopes. set_extension( ExtensionBuilder() - .SetManifest(std::move( + .SetManifest( DictionaryBuilder() .Set("name", "Test") .Set("version", "1.0") .Set("oauth2", - std::move(DictionaryBuilder() - .Set("client_id", - "123456.apps.googleusercontent.com") - .Set("scopes", - std::move(ListBuilder().Append( - "https://www.googleapis.com/" - "auth/drive"))))))) + DictionaryBuilder() + .Set("client_id", + "123456.apps.googleusercontent.com") + .Set("scopes", + ListBuilder() + .Append("https://www.googleapis.com/" + "auth/drive") + .Build()) + .Build()) + .Build()) .SetLocation(Manifest::UNPACKED) .Build()); } diff --git a/extensions/shell/browser/shell_native_app_window_aura_unittest.cc b/extensions/shell/browser/shell_native_app_window_aura_unittest.cc index 728e787..be7df4b 100644 --- a/extensions/shell/browser/shell_native_app_window_aura_unittest.cc +++ b/extensions/shell/browser/shell_native_app_window_aura_unittest.cc @@ -44,10 +44,11 @@ TEST_F(ShellNativeAppWindowAuraTest, Bounds) { new content::TestBrowserContext); scoped_refptr<Extension> extension = ExtensionBuilder() - .SetManifest(std::move(DictionaryBuilder() - .Set("name", "test extension") - .Set("version", "1") - .Set("manifest_version", 2))) + .SetManifest(DictionaryBuilder() + .Set("name", "test extension") + .Set("version", "1") + .Set("manifest_version", 2) + .Build()) .Build(); AppWindow* app_window = new AppWindow( |