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

Side by Side Diff: chrome/browser/extensions/api/desktop_capture/desktop_capture_apitest.cc

Issue 2825963003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/extensions (Closed)
Patch Set: Created 3 years, 8 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 <array> 5 #include <array>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const base::string16& app_name, 57 const base::string16& app_name,
58 const base::string16& target_name, 58 const base::string16& target_name,
59 std::unique_ptr<DesktopMediaList> screen_list, 59 std::unique_ptr<DesktopMediaList> screen_list,
60 std::unique_ptr<DesktopMediaList> window_list, 60 std::unique_ptr<DesktopMediaList> window_list,
61 std::unique_ptr<DesktopMediaList> tab_list, 61 std::unique_ptr<DesktopMediaList> tab_list,
62 bool request_audio, 62 bool request_audio,
63 const DoneCallback& done_callback) override { 63 const DoneCallback& done_callback) override {
64 if (!expectation_->cancelled) { 64 if (!expectation_->cancelled) {
65 // Post a task to call the callback asynchronously. 65 // Post a task to call the callback asynchronously.
66 base::ThreadTaskRunnerHandle::Get()->PostTask( 66 base::ThreadTaskRunnerHandle::Get()->PostTask(
67 FROM_HERE, 67 FROM_HERE, base::BindOnce(&FakeDesktopMediaPicker::CallCallback,
68 base::Bind(&FakeDesktopMediaPicker::CallCallback, 68 weak_factory_.GetWeakPtr(), done_callback));
69 weak_factory_.GetWeakPtr(), done_callback));
70 } else { 69 } else {
71 // If we expect the dialog to be cancelled then store the callback to 70 // If we expect the dialog to be cancelled then store the callback to
72 // retain reference to the callback handler. 71 // retain reference to the callback handler.
73 done_callback_ = done_callback; 72 done_callback_ = done_callback;
74 } 73 }
75 } 74 }
76 75
77 private: 76 private:
78 void CallCallback(DoneCallback done_callback) { 77 void CallCallback(DoneCallback done_callback) {
79 done_callback.Run(expectation_->selected_source); 78 done_callback.Run(expectation_->selected_source);
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EXPECT_TRUE(result); 290 EXPECT_TRUE(result);
292 EXPECT_TRUE(test_flags[2].picker_created); 291 EXPECT_TRUE(test_flags[2].picker_created);
293 EXPECT_FALSE(test_flags[2].picker_deleted); 292 EXPECT_FALSE(test_flags[2].picker_deleted);
294 293
295 web_contents->Close(); 294 web_contents->Close();
296 destroyed_watcher.Wait(); 295 destroyed_watcher.Wait();
297 EXPECT_TRUE(test_flags[2].picker_deleted); 296 EXPECT_TRUE(test_flags[2].picker_deleted);
298 } 297 }
299 298
300 } // namespace extensions 299 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698