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

Unified Diff: content/test/test_web_contents.cc

Issue 2697803003: Improve test coverage for ContentFaviconDriver (Closed)
Patch Set: Minor revert. Created 3 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: content/test/test_web_contents.cc
diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc
index 3436003093b8a7b024580f9e7d5344dd4783205b..e210a0800fb6577c408e0abf21836b24017cc9e5 100644
--- a/content/test/test_web_contents.cc
+++ b/content/test/test_web_contents.cc
@@ -93,7 +93,10 @@ int TestWebContents::DownloadImage(const GURL& url,
bool bypass_cache,
const ImageDownloadCallback& callback) {
static int g_next_image_download_id = 0;
- return ++g_next_image_download_id;
+ ++g_next_image_download_id;
+ pending_image_downloads_[url].emplace_back(g_next_image_download_id,
+ callback);
+ return g_next_image_download_id;
}
void TestWebContents::TestDidNavigate(RenderFrameHost* render_frame_host,
@@ -186,6 +189,20 @@ const std::string& TestWebContents::GetSaveFrameHeaders() {
return save_frame_headers_;
}
+bool TestWebContents::TestDidDownloadImage(
+ const GURL& url,
+ int http_status_code,
+ const std::vector<SkBitmap>& bitmaps,
+ const std::vector<gfx::Size>& original_bitmap_sizes) {
+ if (pending_image_downloads_[url].empty())
+ return false;
+ int id = pending_image_downloads_[url].front().first;
+ ImageDownloadCallback callback = pending_image_downloads_[url].front().second;
+ pending_image_downloads_[url].pop_front();
+ callback.Run(id, http_status_code, url, bitmaps, original_bitmap_sizes);
+ return true;
+}
+
bool TestWebContents::CrossProcessNavigationPending() {
if (IsBrowserSideNavigationEnabled()) {
return GetRenderManager()->speculative_render_frame_host_ != nullptr;

Powered by Google App Engine
This is Rietveld 408576698