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

Side by Side Diff: components/offline_pages/offline_page_test_archiver.h

Issue 1521193002: [Offline pages] Refactor URL conversions from TabAndroid (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback, updating tests, moving functions to a static class Created 5 years 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
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698