Index: components/download/internal/test/test_download_driver.h |
diff --git a/components/download/internal/test/test_download_driver.h b/components/download/internal/test/test_download_driver.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5ffefdcaba51e63a8149bf1bdcdb689bca1a1509 |
--- /dev/null |
+++ b/components/download/internal/test/test_download_driver.h |
@@ -0,0 +1,49 @@ |
+// 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. |
+ |
+#ifndef COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_DOWNLOAD_DRIVER_H_ |
+#define COMPONENTS_DOWNLOAD_INTERNAL_TEST_TEST_DOWNLOAD_DRIVER_H_ |
+ |
+#include "base/macros.h" |
+#include "components/download/internal/download_driver.h" |
+ |
+namespace download { |
+ |
+// Download driver that simulates content layer download logic. |
+class TestDownloadDriver : public DownloadDriver { |
+ public: |
+ TestDownloadDriver(); |
+ ~TestDownloadDriver(); |
+ |
+ // Marks download driver as ready, used to test logic that depends on |
+ // data initialization. |
+ void MakeReady(); |
+ |
+ // Simulates download events from content layer. |
+ void NotifyDownloadUpdate(const std::string& guid, |
+ const base::FilePath& path, |
+ uint64_t size); |
+ void NotifyDownloadFailed(const std::string& guid, int reason); |
+ void NotifyDownloadSucceeded(const std::string& guid, |
+ const base::FilePath& path, |
+ int reason); |
+ |
+ // DownloadDriver implementation. |
+ void Start(const DownloadParams& params) override; |
+ void Cancel(const std::string& guid) override; |
+ void Pause(const std::string& guid) override; |
+ void Resume(const std::string& guid) override; |
+ bool IsReady() const override; |
+ void SetObserver(DownloadDriver::Observer* observer) override; |
+ |
+ private: |
+ bool is_ready_; |
+ DownloadDriver::Observer* observer_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TestDownloadDriver); |
+}; |
+ |
+} // namespace download |
+ |
+#endif // COMPONENTS_DOWNLOAD_CONTENT_TEST_TEST_DOWNLOAD_DRIVER_H_ |