OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_ARCHIVER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_ARCHIVER_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_ARCHIVER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_ARCHIVER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 const CreateArchiveCallback& callback) override; | 42 const CreateArchiveCallback& callback) override; |
43 | 43 |
44 // Completes the creation of archive. Should be used with |set_delayed| set to | 44 // Completes the creation of archive. Should be used with |set_delayed| set to |
45 // ture. | 45 // ture. |
46 void CompleteCreateArchive(); | 46 void CompleteCreateArchive(); |
47 | 47 |
48 // When set to true, |CompleteCreateArchive| should be called explicitly for | 48 // When set to true, |CompleteCreateArchive| should be called explicitly for |
49 // the process to finish. | 49 // the process to finish. |
50 void set_delayed(bool delayed) { delayed_ = delayed; } | 50 void set_delayed(bool delayed) { delayed_ = delayed; } |
51 | 51 |
52 // Allows to explicitly specify a file name for the tests. | |
53 void set_file_name(const base::FilePath& file_name) { | |
dewittj
2015/12/16 22:20:16
I think that this be SetFileNameForTest instead.
jianli
2015/12/16 23:08:08
Why not just passing in the constructor?
fgorski
2015/12/17 19:00:14
This is a test helper class so we don't need to ad
| |
54 file_name_ = file_name; | |
55 } | |
56 | |
52 bool create_archive_called() const { return create_archive_called_; } | 57 bool create_archive_called() const { return create_archive_called_; } |
53 | 58 |
54 private: | 59 private: |
55 // Not owned. Outlives OfflinePageTestArchiver. | 60 // Not owned. Outlives OfflinePageTestArchiver. |
56 Observer* observer_; | 61 Observer* observer_; |
57 GURL url_; | 62 GURL url_; |
58 base::FilePath archives_dir_; | 63 base::FilePath archives_dir_; |
64 base::FilePath file_name_; | |
jianli
2015/12/16 23:08:08
nit: we tend to use filename
fgorski
2015/12/17 19:00:14
Done.
| |
59 ArchiverResult result_; | 65 ArchiverResult result_; |
60 int64 size_to_report_; | 66 int64 size_to_report_; |
61 bool create_archive_called_; | 67 bool create_archive_called_; |
62 bool delayed_; | 68 bool delayed_; |
63 CreateArchiveCallback callback_; | 69 CreateArchiveCallback callback_; |
64 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 70 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
65 | 71 |
66 DISALLOW_COPY_AND_ASSIGN(OfflinePageTestArchiver); | 72 DISALLOW_COPY_AND_ASSIGN(OfflinePageTestArchiver); |
67 }; | 73 }; |
68 | 74 |
69 } // namespace offline_pages | 75 } // namespace offline_pages |
70 | 76 |
71 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_ARCHIVER_H_ | 77 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TEST_ARCHIVER_H_ |
OLD | NEW |