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/time.h" |
10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
11 #include "chrome/browser/favicon/favicon_service_factory.h" | 12 #include "chrome/browser/favicon/favicon_service_factory.h" |
12 #include "chrome/browser/history/history.h" | 13 #include "chrome/browser/history/history.h" |
13 #include "chrome/browser/history/history_service_factory.h" | 14 #include "chrome/browser/history/history_service_factory.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_tabstrip.h" | 17 #include "chrome/browser/ui/browser_tabstrip.h" |
17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
18 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 19 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
19 #include "chrome/test/base/test_browser_window.h" | 20 #include "chrome/test/base/test_browser_window.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 GURL url2 = GURL("http://www.a.com/2"); | 521 GURL url2 = GURL("http://www.a.com/2"); |
521 GURL url1_favicon("http://www.a.com/1/favicon.ico"); | 522 GURL url1_favicon("http://www.a.com/1/favicon.ico"); |
522 | 523 |
523 NavigateAndCommit(url1); | 524 NavigateAndCommit(url1); |
524 // Navigate to a new URL so that url1 will be in the BackForwardMenuModel. | 525 // Navigate to a new URL so that url1 will be in the BackForwardMenuModel. |
525 NavigateAndCommit(url2); | 526 NavigateAndCommit(url2); |
526 | 527 |
527 // Set the desired favicon for url1. | 528 // Set the desired favicon for url1. |
528 HistoryServiceFactory::GetForProfile( | 529 HistoryServiceFactory::GetForProfile( |
529 profile(), Profile::EXPLICIT_ACCESS)->AddPage( | 530 profile(), Profile::EXPLICIT_ACCESS)->AddPage( |
530 url1, history::SOURCE_BROWSED); | 531 url1, base::Time::Now(), history::SOURCE_BROWSED); |
531 FaviconServiceFactory::GetForProfile( | 532 FaviconServiceFactory::GetForProfile( |
532 profile(), Profile::EXPLICIT_ACCESS)->SetFavicons( | 533 profile(), Profile::EXPLICIT_ACCESS)->SetFavicons( |
533 url1, url1_favicon, history::FAVICON, gfx::Image(new_icon_bitmap)); | 534 url1, url1_favicon, history::FAVICON, gfx::Image(new_icon_bitmap)); |
534 | 535 |
535 // Will return the current icon (default) but start an anync call | 536 // Will return the current icon (default) but start an anync call |
536 // to retrieve the favicon from the favicon service. | 537 // to retrieve the favicon from the favicon service. |
537 gfx::Image default_icon; | 538 gfx::Image default_icon; |
538 back_model.GetIconAt(0, &default_icon); | 539 back_model.GetIconAt(0, &default_icon); |
539 | 540 |
540 // Make the favicon service run GetFavIconForURL, | 541 // Make the favicon service run GetFavIconForURL, |
(...skipping 21 matching lines...) Expand all Loading... |
562 // Verify we did get the expected favicon. | 563 // Verify we did get the expected favicon. |
563 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), | 564 EXPECT_EQ(0, memcmp(new_icon_bitmap.getPixels(), |
564 valid_icon_bitmap.getPixels(), | 565 valid_icon_bitmap.getPixels(), |
565 new_icon_bitmap.getSize())); | 566 new_icon_bitmap.getSize())); |
566 | 567 |
567 // Make sure the browser deconstructor doesn't have problems. | 568 // Make sure the browser deconstructor doesn't have problems. |
568 chrome::CloseAllTabs(browser.get()); | 569 chrome::CloseAllTabs(browser.get()); |
569 // This is required to prevent the message loop from hanging. | 570 // This is required to prevent the message loop from hanging. |
570 profile()->DestroyHistoryService(); | 571 profile()->DestroyHistoryService(); |
571 } | 572 } |
OLD | NEW |