Commit 9b670bf7 authored by Alan Cutter's avatar Alan Cutter Committed by Commit Bot

Remove use of base::Bind and base::Callback from extensions/test

Bug: 1007786
Change-Id: I674710a2fd92a669c636ab190337483825bac6c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2076222
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#746669}
parent e8da5098
......@@ -372,7 +372,6 @@ _NOT_CONVERTED_TO_MODERN_BIND_AND_CALLBACK = '|'.join((
'^device/bluetooth/',
'^extensions/browser/',
'^extensions/renderer/',
'^extensions/test/',
'^google_apis/dive/',
'^google_apis/gcm/',
'^ios/chrome/',
......
......@@ -43,8 +43,8 @@ void BackgroundPageWatcher::WaitForOpenState(bool wait_for_open) {
bool* flag = wait_for_open ? &is_waiting_for_open_ : &is_waiting_for_close_;
base::AutoReset<bool> set_flag(flag, true);
base::RunLoop run_loop;
base::AutoReset<base::Closure> set_quit_run_loop(&quit_run_loop_,
run_loop.QuitClosure());
base::AutoReset<base::OnceClosure> set_quit_run_loop(&quit_run_loop_,
run_loop.QuitClosure());
run_loop.Run();
DCHECK_EQ(wait_for_open, IsBackgroundPageOpen());
}
......@@ -64,7 +64,7 @@ void BackgroundPageWatcher::OnExtensionFrameRegistered(
content::RenderFrameHost* rfh) {
if (is_waiting_for_open_ && extension_id == extension_id_ &&
IsBackgroundPageOpen())
quit_run_loop_.Run();
std::move(quit_run_loop_).Run();
}
void BackgroundPageWatcher::OnExtensionFrameUnregistered(
......@@ -72,7 +72,7 @@ void BackgroundPageWatcher::OnExtensionFrameUnregistered(
content::RenderFrameHost* rfh) {
if (is_waiting_for_close_ && extension_id == extension_id_ &&
!IsBackgroundPageOpen())
quit_run_loop_.Run();
std::move(quit_run_loop_).Run();
}
} // namespace extensions
......@@ -49,7 +49,7 @@ class BackgroundPageWatcher : public ProcessManagerObserver {
ProcessManager* process_manager_;
const std::string extension_id_;
base::Closure quit_run_loop_;
base::OnceClosure quit_run_loop_;
bool is_waiting_for_open_;
bool is_waiting_for_close_;
......
......@@ -20,7 +20,7 @@ namespace {
// A callback that returns true if the condition has been met and takes no
// arguments.
using ConditionCallback = base::Callback<bool(void)>;
using ConditionCallback = base::RepeatingCallback<bool(void)>;
const Extension* GetNonTerminatedExtensions(const std::string& id,
content::BrowserContext* context) {
......@@ -191,7 +191,7 @@ void ExtensionTestNotificationObserver::WaitForCondition(
std::unique_ptr<base::CallbackList<void()>::Subscription> subscription;
if (notification_set) {
subscription = notification_set->callback_list().Add(base::Bind(
subscription = notification_set->callback_list().Add(base::BindRepeating(
&ExtensionTestNotificationObserver::MaybeQuit, base::Unretained(this)));
}
run_loop.Run();
......@@ -202,7 +202,7 @@ void ExtensionTestNotificationObserver::WaitForCondition(
void ExtensionTestNotificationObserver::MaybeQuit() {
if (condition_.Run())
quit_closure_.Run();
std::move(quit_closure_).Run();
}
} // namespace extensions
......@@ -111,7 +111,7 @@ class ExtensionTestNotificationObserver : public content::NotificationObserver,
// notifications to wait for and to check |condition| when observing. This
// can be NULL if we are instead waiting for a different observer method, like
// OnPageActionsUpdated().
void WaitForCondition(const base::Callback<bool(void)>& condition,
void WaitForCondition(const base::RepeatingCallback<bool(void)>& condition,
NotificationSet* notification_set);
void WaitForNotification(int notification_type);
......@@ -131,10 +131,10 @@ class ExtensionTestNotificationObserver : public content::NotificationObserver,
// The condition for which we are waiting. This should be checked in any
// observing methods that could trigger it.
base::Callback<bool(void)> condition_;
base::RepeatingCallback<bool(void)> condition_;
// The closure to quit the currently-running message loop.
base::Closure quit_closure_;
base::OnceClosure quit_closure_;
// Listens to extension loaded notifications.
ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
......
......@@ -100,8 +100,7 @@ void ExtensionsTestSuite::Shutdown() {
int main(int argc, char** argv) {
content::UnitTestTestSuite test_suite(new ExtensionsTestSuite(argc, argv));
return base::LaunchUnitTests(argc,
argv,
base::Bind(&content::UnitTestTestSuite::Run,
base::Unretained(&test_suite)));
return base::LaunchUnitTests(argc, argv,
base::BindOnce(&content::UnitTestTestSuite::Run,
base::Unretained(&test_suite)));
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment