| 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 #include "components/offline_pages/offline_page_test_archiver.h" | 5 #include "components/offline_pages/offline_page_test_archiver.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
| 12 | 12 |
| 13 namespace offline_pages { | 13 namespace offline_pages { |
| 14 | 14 |
| 15 OfflinePageTestArchiver::OfflinePageTestArchiver( | 15 OfflinePageTestArchiver::OfflinePageTestArchiver( |
| 16 Observer* observer, | 16 Observer* observer, |
| 17 const GURL& url, | 17 const GURL& url, |
| 18 ArchiverResult result, | 18 ArchiverResult result, |
| 19 int64 size_to_report, | 19 int64_t size_to_report, |
| 20 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) | 20 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) |
| 21 : observer_(observer), | 21 : observer_(observer), |
| 22 url_(url), | 22 url_(url), |
| 23 result_(result), | 23 result_(result), |
| 24 size_to_report_(size_to_report), | 24 size_to_report_(size_to_report), |
| 25 create_archive_called_(false), | 25 create_archive_called_(false), |
| 26 delayed_(false), | 26 delayed_(false), |
| 27 task_runner_(task_runner) {} | 27 task_runner_(task_runner) {} |
| 28 | 28 |
| 29 OfflinePageTestArchiver::~OfflinePageTestArchiver() { | 29 OfflinePageTestArchiver::~OfflinePageTestArchiver() { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 archive_path = archives_dir_.Append(filename_); | 49 archive_path = archives_dir_.Append(filename_); |
| 50 // This step ensures the file is created and closed immediately. | 50 // This step ensures the file is created and closed immediately. |
| 51 base::File file(archive_path, base::File::FLAG_OPEN_ALWAYS); | 51 base::File file(archive_path, base::File::FLAG_OPEN_ALWAYS); |
| 52 } | 52 } |
| 53 observer_->SetLastPathCreatedByArchiver(archive_path); | 53 observer_->SetLastPathCreatedByArchiver(archive_path); |
| 54 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, this, result_, url_, | 54 task_runner_->PostTask(FROM_HERE, base::Bind(callback_, this, result_, url_, |
| 55 archive_path, size_to_report_)); | 55 archive_path, size_to_report_)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace offline_pages | 58 } // namespace offline_pages |
| OLD | NEW |