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/favicon/content/content_favicon_driver.h" | 5 #include "components/favicon/content/content_favicon_driver.h" |
6 | 6 |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( | 272 std::unique_ptr<TestResourceDispatcherHostDelegate> delegate( |
273 new TestResourceDispatcherHostDelegate(icon_url)); | 273 new TestResourceDispatcherHostDelegate(icon_url)); |
274 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); | 274 content::ResourceDispatcherHost::Get()->SetDelegate(delegate.get()); |
275 | 275 |
276 PendingTaskWaiter waiter(web_contents(), this); | 276 PendingTaskWaiter waiter(web_contents(), this); |
277 ui_test_utils::NavigateToURLWithDisposition( | 277 ui_test_utils::NavigateToURLWithDisposition( |
278 browser(), url, WindowOpenDisposition::CURRENT_TAB, | 278 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
279 ui_test_utils::BROWSER_TEST_NONE); | 279 ui_test_utils::BROWSER_TEST_NONE); |
280 waiter.Wait(); | 280 waiter.Wait(); |
281 | 281 |
| 282 #if defined(OS_ANDROID) || defined(OS_IOS) |
282 EXPECT_TRUE(delegate->was_requested()); | 283 EXPECT_TRUE(delegate->was_requested()); |
| 284 #else |
| 285 EXPECT_FALSE(delegate->was_requested()); |
| 286 #endif |
283 } | 287 } |
284 | 288 |
285 // Test that loading a page that contains a Web Manifest without icons and a | 289 // Test that loading a page that contains a Web Manifest without icons and a |
286 // regular favicon in the HTML reports the icon. The regular icon is initially | 290 // regular favicon in the HTML reports the icon. The regular icon is initially |
287 // cached in the Favicon database. | 291 // cached in the Favicon database. |
288 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, | 292 IN_PROC_BROWSER_TEST_F(ContentFaviconDriverTest, |
289 LoadRegularIconDespiteWebManifestWithoutIcons) { | 293 LoadRegularIconDespiteWebManifestWithoutIcons) { |
290 ASSERT_TRUE(embedded_test_server()->Start()); | 294 ASSERT_TRUE(embedded_test_server()->Start()); |
291 GURL url = embedded_test_server()->GetURL( | 295 GURL url = embedded_test_server()->GetURL( |
292 "/favicon/page_with_manifest_without_icons.html"); | 296 "/favicon/page_with_manifest_without_icons.html"); |
(...skipping 18 matching lines...) Expand all Loading... |
311 { | 315 { |
312 PendingTaskWaiter waiter(web_contents(), this); | 316 PendingTaskWaiter waiter(web_contents(), this); |
313 ui_test_utils::NavigateToURLWithDisposition( | 317 ui_test_utils::NavigateToURLWithDisposition( |
314 browser(), url, WindowOpenDisposition::CURRENT_TAB, | 318 browser(), url, WindowOpenDisposition::CURRENT_TAB, |
315 ui_test_utils::BROWSER_TEST_NONE); | 319 ui_test_utils::BROWSER_TEST_NONE); |
316 waiter.Wait(); | 320 waiter.Wait(); |
317 } | 321 } |
318 | 322 |
319 EXPECT_NE(nullptr, GetFaviconForPageURL(url).bitmap_data); | 323 EXPECT_NE(nullptr, GetFaviconForPageURL(url).bitmap_data); |
320 } | 324 } |
OLD | NEW |