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

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

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 #ifndef COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_DOWNLOAD_DRIVER_H_
6 #define COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_DOWNLOAD_DRIVER_H_
7
8 #include "base/macros.h"
9 #include "components/download/internal/download_driver.h"
10
11 namespace download {
12
13 // Download driver that simulates content layer download logic.
14 class TestDownloadDriver : public DownloadDriver {
15 public:
16 TestDownloadDriver();
17 ~TestDownloadDriver();
18
19 // Marks download driver as ready, used to test logic that depends on
20 // data initialization.
21 void MakeReady();
22
23 // Simulates download events from content layer.
24 void NotifyDownloadUpdate(const std::string& guid,
25 const base::FilePath& path,
26 uint64_t size);
27 void NotifyDownloadFailed(const std::string& guid, int reason);
28 void NotifyDownloadSucceeded(const std::string& guid,
29 const base::FilePath& path,
30 int reason);
31
32 // DownloadDriver implementation.
33 void Start(const DownloadParams& params) override;
34 void Cancel(const std::string& guid) override;
35 void Pause(const std::string& guid) override;
36 void Resume(const std::string& guid) override;
37 bool IsReady() const override;
38 void SetObserver(DownloadDriver::Observer* observer) override;
39
40 private:
41 bool is_ready_;
42 DownloadDriver::Observer* observer_;
43
44 DISALLOW_COPY_AND_ASSIGN(TestDownloadDriver);
45 };
46
47 } // namespace download
48
49 #endif // COMPONENTS_DOWNLOAD_CONTENT_TEST_TEST_DOWNLOAD_DRIVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698