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

Side by Side Diff: components/download/internal/test/test_download_driver.cc

Issue 2880933002: Download driver for components/download. (Closed)
Patch Set: Created 3 years, 7 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "components/download/internal/test/test_download_driver.h"
6
7 #include "base/files/file_path.h"
8 #include "components/download/public/download_params.h"
9
10 namespace download {
11
12 TestDownloadDriver::TestDownloadDriver()
13 : is_ready_(false), observer_(nullptr) {}
14
15 TestDownloadDriver::~TestDownloadDriver() = default;
16
17 void TestDownloadDriver::MakeReady() {
18 is_ready_ = true;
19 if (observer_)
20 observer_->OnDriverReady();
21 }
22
23 void TestDownloadDriver::NotifyDownloadUpdate(const std::string& guid,
24 const base::FilePath& path,
25 uint64_t size) {
26 if (observer_)
27 observer_->OnDriverReady();
28 }
29
30 void TestDownloadDriver::NotifyDownloadFailed(const std::string& guid,
31 int reason) {
32 if (observer_)
33 observer_->OnDownloadFailed(guid, reason);
34 }
35
36 void TestDownloadDriver::NotifyDownloadSucceeded(const std::string& guid,
37 const base::FilePath& path,
38 int reason) {
39 if (observer_)
40 observer_->OnDownloadSucceeded(guid, path, reason);
41 }
42
43 void TestDownloadDriver::Start(const DownloadParams& params) {
44 if (observer_)
45 observer_->OnDownloadCreated(params.guid);
46 }
47
48 void TestDownloadDriver::Cancel(const std::string& guid) {}
49
50 void TestDownloadDriver::Pause(const std::string& guid) {}
51
52 void TestDownloadDriver::Resume(const std::string& guid) {}
53
54 bool TestDownloadDriver::IsReady() const {
55 return is_ready_;
56 }
57
58 void TestDownloadDriver::SetObserver(DownloadDriver::Observer* observer) {
59 observer_ = observer;
60 }
61
62 } // namespace downloads
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698