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

Side by Side Diff: extensions/browser/event_router_unittest.cc

Issue 2252373002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/event_router.h" 5 #include "extensions/browser/event_router.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 return EventListener::ForURL(event_name, listener_url, process, 86 return EventListener::ForURL(event_name, listener_url, process,
87 base::WrapUnique(filter)); 87 base::WrapUnique(filter));
88 } 88 }
89 89
90 // Creates an extension. If |component| is true, it is created as a component 90 // Creates an extension. If |component| is true, it is created as a component
91 // extension. If |persistent| is true, it is created with a persistent 91 // extension. If |persistent| is true, it is created with a persistent
92 // background page; otherwise it is created with an event page. 92 // background page; otherwise it is created with an event page.
93 scoped_refptr<Extension> CreateExtension(bool component, bool persistent) { 93 scoped_refptr<Extension> CreateExtension(bool component, bool persistent) {
94 ExtensionBuilder builder; 94 ExtensionBuilder builder;
95 std::unique_ptr<base::DictionaryValue> manifest = 95 std::unique_ptr<base::DictionaryValue> manifest =
96 base::WrapUnique(new base::DictionaryValue()); 96 base::MakeUnique<base::DictionaryValue>();
97 manifest->SetString("name", "foo"); 97 manifest->SetString("name", "foo");
98 manifest->SetString("version", "1.0.0"); 98 manifest->SetString("version", "1.0.0");
99 manifest->SetInteger("manifest_version", 2); 99 manifest->SetInteger("manifest_version", 2);
100 manifest->SetString("background.page", "background.html"); 100 manifest->SetString("background.page", "background.html");
101 manifest->SetBoolean("background.persistent", persistent); 101 manifest->SetBoolean("background.persistent", persistent);
102 builder.SetManifest(std::move(manifest)); 102 builder.SetManifest(std::move(manifest));
103 if (component) 103 if (component)
104 builder.SetLocation(Manifest::Location::COMPONENT); 104 builder.SetLocation(Manifest::Location::COMPONENT);
105 105
106 return builder.Build(); 106 return builder.Build();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 scoped_refptr<Extension> component_event = CreateExtension(true, false); 269 scoped_refptr<Extension> component_event = CreateExtension(true, false);
270 router.ReportEvent(events::HistogramValue::FOR_TEST, component_event.get(), 270 router.ReportEvent(events::HistogramValue::FOR_TEST, component_event.get(),
271 false /** did_enqueue */); 271 false /** did_enqueue */);
272 ExpectHistogramCounts(6, 2, 2, 1, 0, 2); 272 ExpectHistogramCounts(6, 2, 2, 1, 0, 2);
273 router.ReportEvent(events::HistogramValue::FOR_TEST, component_event.get(), 273 router.ReportEvent(events::HistogramValue::FOR_TEST, component_event.get(),
274 true /** did_enqueue */); 274 true /** did_enqueue */);
275 ExpectHistogramCounts(7, 3, 2, 2, 1, 2); 275 ExpectHistogramCounts(7, 3, 2, 2, 1, 2);
276 } 276 }
277 277
278 } // namespace extensions 278 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/event_listener_map_unittest.cc ('k') | extensions/browser/extension_function.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698