OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/toolbar/back_forward_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/back_forward_menu_model.h" |
6 | 6 |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/history/history.h" | 11 #include "chrome/browser/history/history.h" |
| 12 #include "chrome/browser/history/history_service_factory.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
15 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 17 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
17 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
18 #include "content/public/browser/navigation_controller.h" | 19 #include "content/public/browser/navigation_controller.h" |
19 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
21 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 517 |
517 GURL url1 = GURL("http://www.a.com/1"); | 518 GURL url1 = GURL("http://www.a.com/1"); |
518 GURL url2 = GURL("http://www.a.com/2"); | 519 GURL url2 = GURL("http://www.a.com/2"); |
519 GURL url1_favicon("http://www.a.com/1/favicon.ico"); | 520 GURL url1_favicon("http://www.a.com/1/favicon.ico"); |
520 | 521 |
521 NavigateAndCommit(url1); | 522 NavigateAndCommit(url1); |
522 // Navigate to a new URL so that url1 will be in the BackForwardMenuModel. | 523 // Navigate to a new URL so that url1 will be in the BackForwardMenuModel. |
523 NavigateAndCommit(url2); | 524 NavigateAndCommit(url2); |
524 | 525 |
525 // Set the desired favicon for url1. | 526 // Set the desired favicon for url1. |
526 profile()->GetHistoryService(Profile::EXPLICIT_ACCESS)->AddPage(url1, | 527 HistoryServiceFactory::GetForProfile( |
527 history::SOURCE_BROWSED); | 528 profile(), Profile::EXPLICIT_ACCESS)->AddPage( |
| 529 url1, history::SOURCE_BROWSED); |
528 profile()->GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, | 530 profile()->GetFaviconService(Profile::EXPLICIT_ACCESS)->SetFavicon(url1, |
529 url1_favicon, icon_data, history::FAVICON); | 531 url1_favicon, icon_data, history::FAVICON); |
530 | 532 |
531 // Will return the current icon (default) but start an anync call | 533 // Will return the current icon (default) but start an anync call |
532 // to retrieve the favicon from the favicon service. | 534 // to retrieve the favicon from the favicon service. |
533 gfx::ImageSkia default_icon; | 535 gfx::ImageSkia default_icon; |
534 back_model.GetIconAt(0, &default_icon); | 536 back_model.GetIconAt(0, &default_icon); |
535 | 537 |
536 // Make the favicon service run GetFavIconForURL, | 538 // Make the favicon service run GetFavIconForURL, |
537 // FaviconDelegate.OnIconChanged will be called. | 539 // FaviconDelegate.OnIconChanged will be called. |
(...skipping 20 matching lines...) Expand all Loading... |
558 // Verify we did get the expected favicon. | 560 // Verify we did get the expected favicon. |
559 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), | 561 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), |
560 valid_icon_bitmap.getPixels(), | 562 valid_icon_bitmap.getPixels(), |
561 new_icon_bitmap.getSize())); | 563 new_icon_bitmap.getSize())); |
562 | 564 |
563 // Make sure the browser deconstructor doesn't have problems. | 565 // Make sure the browser deconstructor doesn't have problems. |
564 chrome::CloseAllTabs(&browser); | 566 chrome::CloseAllTabs(&browser); |
565 // This is required to prevent the message loop from hanging. | 567 // This is required to prevent the message loop from hanging. |
566 profile()->DestroyHistoryService(); | 568 profile()->DestroyHistoryService(); |
567 } | 569 } |
OLD | NEW |