OLD | NEW |
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 Loading... |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |