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

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/delayed_callback_runner_unittest.cc

Issue 2259523003: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/safe_browsing/incident_reporting/delayed_callback_runne r.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/delayed_callback_runne r.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 void OnDelete(const std::string& name) { 64 void OnDelete(const std::string& name) {
65 EXPECT_FALSE(callbacks_[name].deleted); 65 EXPECT_FALSE(callbacks_[name].deleted);
66 callbacks_[name].deleted = true; 66 callbacks_[name].deleted = true;
67 } 67 }
68 68
69 // Returns a callback argument that calls the test fixture's OnDelete method 69 // Returns a callback argument that calls the test fixture's OnDelete method
70 // on behalf of the given callback name. 70 // on behalf of the given callback name.
71 std::unique_ptr<CallbackArgument> MakeCallbackArgument( 71 std::unique_ptr<CallbackArgument> MakeCallbackArgument(
72 const std::string& name) { 72 const std::string& name) {
73 return base::WrapUnique(new CallbackArgument(base::Bind( 73 return base::MakeUnique<CallbackArgument>(base::Bind(
74 &DelayedCallbackRunnerTest::OnDelete, base::Unretained(this), name))); 74 &DelayedCallbackRunnerTest::OnDelete, base::Unretained(this), name));
75 } 75 }
76 76
77 // Returns a closure that calls |OnRun| when run and |OnDelete| when deleted 77 // Returns a closure that calls |OnRun| when run and |OnDelete| when deleted
78 // on behalf of the given callback name. 78 // on behalf of the given callback name.
79 base::Closure MakeCallback(const std::string& name) { 79 base::Closure MakeCallback(const std::string& name) {
80 return base::Bind(&DelayedCallbackRunnerTest::OnRun, 80 return base::Bind(&DelayedCallbackRunnerTest::OnRun,
81 base::Unretained(this), 81 base::Unretained(this),
82 name, 82 name,
83 base::Owned(MakeCallbackArgument(name).release())); 83 base::Owned(MakeCallbackArgument(name).release()));
84 } 84 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 base::RunLoop().RunUntilIdle(); 150 base::RunLoop().RunUntilIdle();
151 EXPECT_TRUE(CallbackWasRun(name)); 151 EXPECT_TRUE(CallbackWasRun(name));
152 EXPECT_TRUE(CallbackWasDeleted(name)); 152 EXPECT_TRUE(CallbackWasDeleted(name));
153 153
154 RegisterTestCallback(name2); 154 RegisterTestCallback(name2);
155 instance_->Start(); 155 instance_->Start();
156 base::RunLoop().RunUntilIdle(); 156 base::RunLoop().RunUntilIdle();
157 EXPECT_TRUE(CallbackWasRun(name2)); 157 EXPECT_TRUE(CallbackWasRun(name2));
158 EXPECT_TRUE(CallbackWasDeleted(name2)); 158 EXPECT_TRUE(CallbackWasDeleted(name2));
159 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698