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

Side by Side Diff: chrome/browser/extensions/content_verifier_browsertest.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 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 <list> 5 #include <list>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 void JobObserver::JobStarted(const std::string& extension_id, 241 void JobObserver::JobStarted(const std::string& extension_id,
242 const base::FilePath& relative_path) { 242 const base::FilePath& relative_path) {
243 } 243 }
244 244
245 void JobObserver::JobFinished(const std::string& extension_id, 245 void JobObserver::JobFinished(const std::string& extension_id,
246 const base::FilePath& relative_path, 246 const base::FilePath& relative_path,
247 ContentVerifyJob::FailureReason failure_reason) { 247 ContentVerifyJob::FailureReason failure_reason) {
248 if (!content::BrowserThread::CurrentlyOn(creation_thread_)) { 248 if (!content::BrowserThread::CurrentlyOn(creation_thread_)) {
249 content::BrowserThread::PostTask( 249 content::BrowserThread::PostTask(
250 creation_thread_, FROM_HERE, 250 creation_thread_, FROM_HERE,
251 base::Bind(&JobObserver::JobFinished, base::Unretained(this), 251 base::BindOnce(&JobObserver::JobFinished, base::Unretained(this),
252 extension_id, relative_path, failure_reason)); 252 extension_id, relative_path, failure_reason));
253 return; 253 return;
254 } 254 }
255 Result result = failure_reason == ContentVerifyJob::NONE ? Result::SUCCESS 255 Result result = failure_reason == ContentVerifyJob::NONE ? Result::SUCCESS
256 : Result::FAILURE; 256 : Result::FAILURE;
257 bool found = false; 257 bool found = false;
258 for (std::list<ExpectedResult>::iterator i = expectations_.begin(); 258 for (std::list<ExpectedResult>::iterator i = expectations_.begin();
259 i != expectations_.end(); ++i) { 259 i != expectations_.end(); ++i) {
260 if (i->extension_id == extension_id && i->path == relative_path && 260 if (i->extension_id == extension_id && i->path == relative_path &&
261 i->result == result) { 261 i->result == result) {
262 found = true; 262 found = true;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 const ManifestFetchData* data = requests_.back().get(); 348 const ManifestFetchData* data = requests_.back().get();
349 349
350 for (const auto& id : data->extension_ids()) { 350 for (const auto& id : data->extension_ids()) {
351 if (ContainsKey(responses_, id)) { 351 if (ContainsKey(responses_, id)) {
352 // We use PostTask here instead of calling OnExtensionDownloadFinished 352 // We use PostTask here instead of calling OnExtensionDownloadFinished
353 // immeditately, because the calling code isn't expecting a synchronous 353 // immeditately, because the calling code isn't expecting a synchronous
354 // response (in non-test situations there are at least 2 network 354 // response (in non-test situations there are at least 2 network
355 // requests needed before a file could be returned). 355 // requests needed before a file could be returned).
356 base::ThreadTaskRunnerHandle::Get()->PostTask( 356 base::ThreadTaskRunnerHandle::Get()->PostTask(
357 FROM_HERE, 357 FROM_HERE,
358 base::Bind( 358 base::BindOnce(
359 &ExtensionDownloaderDelegate::OnExtensionDownloadFinished, 359 &ExtensionDownloaderDelegate::OnExtensionDownloadFinished,
360 base::Unretained(delegate), 360 base::Unretained(delegate),
361 CRXFileInfo(id, responses_[id].second), 361 CRXFileInfo(id, responses_[id].second),
362 false /* pass_file_ownership */, GURL(), responses_[id].first, 362 false /* pass_file_ownership */, GURL(), responses_[id].first,
363 ExtensionDownloaderDelegate::PingResult(), data->request_ids(), 363 ExtensionDownloaderDelegate::PingResult(), data->request_ids(),
364 ExtensionDownloaderDelegate::InstallCallback())); 364 ExtensionDownloaderDelegate::InstallCallback()));
365 } 365 }
366 } 366 }
367 } 367 }
368 368
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 // Remove the override and set ExtensionService to update again. The extension 887 // Remove the override and set ExtensionService to update again. The extension
888 // should be now installed. 888 // should be now installed.
889 PolicyExtensionReinstaller::set_policy_reinstall_action_for_test(nullptr); 889 PolicyExtensionReinstaller::set_policy_reinstall_action_for_test(nullptr);
890 service->set_external_updates_disabled_for_test(false); 890 service->set_external_updates_disabled_for_test(false);
891 delay_tracker.Proceed(); 891 delay_tracker.Proceed();
892 892
893 EXPECT_TRUE(registry_observer.WaitForInstall(id_)); 893 EXPECT_TRUE(registry_observer.WaitForInstall(id_));
894 } 894 }
895 895
896 } // namespace extensions 896 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc ('k') | chrome/browser/extensions/crx_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698