Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/reading_list/url_downloader.h" | 5 #include "ios/chrome/browser/reading_list/url_downloader.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #import "base/mac/bind_objc_block.h" | 10 #import "base/mac/bind_objc_block.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 working_ = false; | 66 working_ = false; |
| 67 HandleNextTask(); | 67 HandleNextTask(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 std::vector<GURL> downloaded_files_; | 70 std::vector<GURL> downloaded_files_; |
| 71 std::vector<GURL> removed_files_; | 71 std::vector<GURL> removed_files_; |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 void DownloadURL(GURL url, bool offlineURLExists) override { | 74 void DownloadURL(GURL url, bool offlineURLExists) override { |
| 75 if (offlineURLExists) { | 75 if (offlineURLExists) { |
| 76 DownloadCompletionHandler(url, false); | 76 DownloadCompletionHandler(url, "", false); |
|
sdefresne
2016/09/09 09:58:58
s/""/std::string()/
lody
2016/09/09 12:17:54
Done.
| |
| 77 return; | 77 return; |
| 78 } | 78 } |
| 79 distiller_.reset(new DistillerViewerTest( | 79 distiller_.reset(new DistillerViewerTest( |
| 80 url, | 80 url, |
| 81 base::Bind(&URLDownloader::DistillerCallback, base::Unretained(this)))); | 81 base::Bind(&URLDownloader::DistillerCallback, base::Unretained(this)))); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void OnEndDownload(const GURL& url, bool success) { | 84 void OnEndDownload(const GURL& url, |
| 85 bool success, | |
| 86 const GURL& distilledURL, | |
| 87 const std::string& title) { | |
| 85 downloaded_files_.push_back(url); | 88 downloaded_files_.push_back(url); |
| 86 } | 89 } |
| 87 | 90 |
| 88 void OnEndRemove(const GURL& url, bool success) { | 91 void OnEndRemove(const GURL& url, bool success) { |
| 89 removed_files_.push_back(url); | 92 removed_files_.push_back(url); |
| 90 } | 93 } |
| 91 }; | 94 }; |
| 92 | 95 |
| 93 namespace { | 96 namespace { |
| 94 class URLDownloaderTest : public testing::Test { | 97 class URLDownloaderTest : public testing::Test { |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 ASSERT_TRUE(std::find(downloader_->downloaded_files_.begin(), | 182 ASSERT_TRUE(std::find(downloader_->downloaded_files_.begin(), |
| 180 downloader_->downloaded_files_.end(), | 183 downloader_->downloaded_files_.end(), |
| 181 url) != downloader_->downloaded_files_.end()); | 184 url) != downloader_->downloaded_files_.end()); |
| 182 ASSERT_TRUE(std::find(downloader_->removed_files_.begin(), | 185 ASSERT_TRUE(std::find(downloader_->removed_files_.begin(), |
| 183 downloader_->removed_files_.end(), | 186 downloader_->removed_files_.end(), |
| 184 url) != downloader_->removed_files_.end()); | 187 url) != downloader_->removed_files_.end()); |
| 185 ASSERT_TRUE(downloader_->CheckExistenceOfOfflineURLPagePath(url)); | 188 ASSERT_TRUE(downloader_->CheckExistenceOfOfflineURLPagePath(url)); |
| 186 } | 189 } |
| 187 | 190 |
| 188 } // namespace | 191 } // namespace |
| OLD | NEW |