| Index: components/download/internal/test/test_download_driver.cc
|
| diff --git a/components/download/internal/test/test_download_driver.cc b/components/download/internal/test/test_download_driver.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4f8e7e371daba10e5d041b923187e41af4152fbe
|
| --- /dev/null
|
| +++ b/components/download/internal/test/test_download_driver.cc
|
| @@ -0,0 +1,62 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/download/internal/test/test_download_driver.h"
|
| +
|
| +#include "base/files/file_path.h"
|
| +#include "components/download/public/download_params.h"
|
| +
|
| +namespace download {
|
| +
|
| +TestDownloadDriver::TestDownloadDriver()
|
| + : is_ready_(false), observer_(nullptr) {}
|
| +
|
| +TestDownloadDriver::~TestDownloadDriver() = default;
|
| +
|
| +void TestDownloadDriver::MakeReady() {
|
| + is_ready_ = true;
|
| + if (observer_)
|
| + observer_->OnDriverReady();
|
| +}
|
| +
|
| +void TestDownloadDriver::NotifyDownloadUpdate(const std::string& guid,
|
| + const base::FilePath& path,
|
| + uint64_t size) {
|
| + if (observer_)
|
| + observer_->OnDriverReady();
|
| +}
|
| +
|
| +void TestDownloadDriver::NotifyDownloadFailed(const std::string& guid,
|
| + int reason) {
|
| + if (observer_)
|
| + observer_->OnDownloadFailed(guid, reason);
|
| +}
|
| +
|
| +void TestDownloadDriver::NotifyDownloadSucceeded(const std::string& guid,
|
| + const base::FilePath& path,
|
| + int reason) {
|
| + if (observer_)
|
| + observer_->OnDownloadSucceeded(guid, path, reason);
|
| +}
|
| +
|
| +void TestDownloadDriver::Start(const DownloadParams& params) {
|
| + if (observer_)
|
| + observer_->OnDownloadCreated(params.guid);
|
| +}
|
| +
|
| +void TestDownloadDriver::Cancel(const std::string& guid) {}
|
| +
|
| +void TestDownloadDriver::Pause(const std::string& guid) {}
|
| +
|
| +void TestDownloadDriver::Resume(const std::string& guid) {}
|
| +
|
| +bool TestDownloadDriver::IsReady() const {
|
| + return is_ready_;
|
| +}
|
| +
|
| +void TestDownloadDriver::SetObserver(DownloadDriver::Observer* observer) {
|
| + observer_ = observer;
|
| +}
|
| +
|
| +} // namespace downloads
|
|
|